The following is an entire MAX/REXX Program
/* DOC: produce a report of employee and their start dates */
IF ADDRESS()="TSO" THEN "ALLOC FI(SYSUT1) DA('MXS.TEST.KSDS') SHR"
/* OPEN the file using a copybook and the field names can be used */
/* to access the data in each field of the record */
IF "RXVSAM"("OPEN FILE(SYSUT1) COPYBOOK(MXS.P390.COPYLIB(CBHDR2))",
SAY 'RC='VSAMCODE 'MSG='VSAMMSG
/* use MAX/REXX to provide a report of employee name and start date */
DO WHILE "RXVSAM"("READNEXT FILE(SYSUT1)")=0
SAY 'EMPLOYEE:'NAME_LAST','NAME_FIRST ' ',
'STARTING DATE:'START_DATE /* show start date */
CALL "RXVSAM" "CLOSE FILE(SYSUT1)"
IF ADDRESS()="TSO" THEN "FREE FI(SYSUT1)"