Record Editing

Record editing can include any combination of:
  • Rearranging fields of certain records.
  • Adding constants or text to certain records.
  • Removing fields from certain records.
  • Dropping whole records from the output based on the contents of the record.

Example:

Rearrange a record of type "A" (as designated in the first byte) to be a record of type "Z", by reversing the first field of 20 bytes (first name) and the next field of 30 bytes (last name). Then drop the next 4 bytes (52 thru 55) and include the rest of the record. Also, drop all records of type "B".

FASTREXX:
If FLD(1,1) = "B" Then RETURN DROP
If FLD(1,1) = "A" Then Do
   SET_OLEN( 0 )
   OVLY_OUT( "Z", 1, 1 )
   FLD_OUT( 22, 30 )
   FLD_OUT( 2, 20 )
   FLD_OUT( 56 )
   End
REXX:
InitChar = SUBSTR( INREC, 1, 1 )
If InitChar = "B" Then RETURN DROP
If InitChar = "A" Then Do
   OUTREC = OVERLAY("Z" || FLD( 22, 30 ) || FLD( 2, 20 ), OUTREC, 1 )
   End
DFSORT:
Note:
  1. Requires DFSORT PTFs UQ95214 and UQ95213
  2. This only works on sequential input files.
*FASTPROC
 OMIT COND=(1,1,CH,EQ,'B')
 OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,'A'),
      OVERLAY=(1:'Z',22,30,2,20,52)),
   IFTHEN=(WHEN=NONE,
      BUILD=(1)))