How enhanced processing works

The REXX procedure that you supply is run against each input record in sequence, either until the end of the input data set is reached, or until the REXX procedure issues a RETURN STOP (or RETURN STOP IMMEDIATE) command.

FM/Db2 defines two special REXX variables, INREC and OUTREC, that you can use in the REXX procedure that you supply to perform enhanced processing. When the FM/Db2 function or panel calls the REXX procedure, the contents of each input record selected for processing are passed to the procedure in both INREC and OUTREC. When the procedure is called, the contents of INREC and OUTREC are identical.

The variable INREC is intended to be used as a reference variable (FM/Db2 ignores any changes to INREC). The variable OUTREC can be updated by the procedure, and (unless you drop the record from further processing, as described later in this section) when the REXX procedure has completed, is passed back for processing by the Import utility. For example, the following code changes a two-digit year in the output record to a four-digit year:

/* Changes a date of format MMDDYY (starting at column 1) to MMDDYYYY */
If fld(5,2,z) > 50
   outrec = fld(1,4)||'19'||fld(5)
else
   outrec = fld(1,4)||'20'||fld(5)