' Percent Equates — %identifier = value numeric constants
#COMPILE EXE
#DIM ALL

%MAX_ITEMS = 100
%BUFFER_SIZE = 4096
%FLAG_READ = 1
%FLAG_WRITE = 2
%FLAG_EXEC = 4
%FLAG_ALL = %FLAG_READ OR %FLAG_WRITE OR %FLAG_EXEC

FUNCTION PBMAIN() AS LONG
    LOCAL buf(%MAX_ITEMS) AS LONG
    LOCAL mode AS LONG

    mode = %FLAG_READ OR %FLAG_WRITE

    PRINT "MAX_ITEMS = "; %MAX_ITEMS
    PRINT "BUFFER_SIZE = "; %BUFFER_SIZE
    PRINT "FLAGS: READ="; %FLAG_READ; " WRITE="; %FLAG_WRITE; " EXEC="; %FLAG_EXEC
    PRINT "Combined mode = "; mode
    PRINT "ALL flag = "; %FLAG_ALL

    buf(1) = 42
    PRINT "buf(1) = "; buf(1)

    FUNCTION = 0
END FUNCTION
