|
INREC PARSE=(%00=(ENDBEFR=C',',FIXLEN=11),
%01=(ENDBEFR=C',',FIXLEN=5),
%02=(FIXLEN=6)),
BUILD=(1,4,5:%00,16:%01,21:%02,27:5)
SORT FIELDS=(5,11,CH,A,16,5,UFF,A,21,6,SFF,D)
OUTREC BUILD=(1,4,27)
This example illustrates how you can sort VB input records with
variable position/length fields, such as comma separated values.
This example is very similar to the previous example for FB records,
except that with VB records we need to copy the fixed parsed fields
after the 4-byte RDW rather than at the end of the records.
The VB input records might look like this: Length|Data
26|Marketing,96218,+27365
26|Development,3807,+1275
23|Research,7283,+5001
26|Development,1700,-5316
23|Research,978,+13562
25|Development,3807,-158
23|Research,7283,+5002
22|Marketing,52,-8736
26|Development,5781,+2736
22|Marketing,52,+1603
24|Research,16072,-2022
After the INREC statement is processed, the records look like this: Length|Data
48|Marketing 96218+27365Marketing,96218,+27365
48|Development3807 +1275 Development,3807,+1275
45|Research 7283 +5001 Research,7283,+5001
48|Development1700 -5316 Development,1700,-5316
45|Research 978 +13562Research,978,+13562
47|Development3807 -158 Development,3807,-158
45|Research 7283 +5002 Research,7283,+5002
44|Marketing 52 -8736 Marketing,52,-8736
48|Development5781 +2736 Development,5781,+2736
44|Marketing 52 +1603 Marketing,52,+1603
46|Research 16072-2022 Research,16072,-2022
After the SORT and OUTREC statements are processed, the output
records look like this: Length|Data
26|Development,1700,-5316
26|Development,3807,+1275
25|Development,3807,-158
26|Development,5781,+2736
22|Marketing,52,+1603
22|Marketing,52,-8736
26|Marketing,96218,+27365
23|Research,978,+13562
23|Research,7283,+5002
23|Research,7283,+5001
24|Research,16072,-2022
|