PPT Slide
MAX/REXX will convert the packed data from the record so that it can be easily manipulated by simply using the COBOL field names as a REXX variable. Data will be converted to packed format at the time of the rewrite.
/* use MAX/REXX to calculate a new base salary amount for all */
/* employees in COLORADO. use the WHERE clause for it's high */
/* speed search capability in finding these records. */
/* note that the data in the record is in packed format but */
/* by using the copybook feature of MAX/REXX this calculation can */
/* be done by the REXX program */
DO WHILE "RXVSAM"("READNEXT FILE(SYSUT1) WHERE(63,EQ,'CO')")=0
EMPLOYEE_AMOUNT=EMPLOYEE_AMOUNT+EMPLOYEE_AMOUNT*.12
EMPLOYEE_AMOUNT=EMPLOYEE_AMOUNT+.0050 /* round the value */
EMPLOYEE_AMOUNT=TRUNC(EMPLOYEE_AMOUNT,2) /* truncate to 2 dec */
CALL "RXVSAM" "REWRITE FILE(SYSUT1)" /* rewrite the record */
SAY 'RC='VSAMCODE 'MSG='VSAMMSG