|
OUTREC syntax
|
In OUTREC statement, you can reformat the record using below parameters.
BUILD or FIELDS - Build parameter is used to reformat record. Build give
complete control over output file format. BUILD parameter can be used on
INREC and OUTREC statements in SORT card. BUILD parameter is an alias of
the FIELDS parameter.
OVERLAY - Replace the selected columns without impacting other columns.
FINDREP - Can do find and Replace operation using this parameter.
IFTHEN - Give us the more flexibility in handling different types
of records, in different ways.
|
IF THEN in sort, OVERLAY in sort - Example
Input file for SORT card
10 suresh 20000 01
20 NARENDRA 40000 06
30 jacob A 25000 07
40 RAMESH 34000 03
50 Kishore 50000 02
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,2,FS,EQ,30),OVERLAY=(45:C'YES')), -
IFTHEN=(WHEN=NONE,OVERLAY=(45:C'NO'))
/*
Explanation - If input record has 30 in the 1st position, string YES will be moved
to 45th position of output file. If input record has other value in the 1st and 2nd
position in the input file, string NO will be moved to 45th position in the output file.
Output file
10 suresh 20000 01 NO
20 NARENDRA 40000 06 NO
30 jacob A 25000 07 YES
40 RAMESH 34000 03 NO
50 Kishore 50000 02 NO
******************************** Bottom of Data *********************
FINDREP in SORT - Example
Input file for SORT card
10 suresh 20000 01
20 NARENDRA 40000 06
30 jacob A 25000 07
40 RAMESH 34000 03
50 Kishore 50000 02
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FINDREP=(IN=C'06',OUT=C'000006')
/*
Output file for SORT card
10 suresh 20000 01
20 NARENDRA 40000 000006
30 jacob A 25000 07
40 RAMESH 34000 03
50 Kishore 50000 02
|
|