Scenario:
a. 10 to 20 fixed length VSAM KSDS; key-len: 22; number of records per DS ranging from 40 to 50 mill.
b. In the DS, a particular field contains date in packed decimal format, this is the field to be tested.
Requirement: Test the aforementioned date field for each record for all the VSAM DS for a range of various dates, and accordingly count the records, segregating the count basis the date range.
A very crude pseudo-logic flow would appear as:
PERFORM THIS LOOP INCREMENTING N FROM 1 BY 1, 20 TIMES, FOR EACH SET OF VSAM DS
READ DATASET-N UNTIL END
EVALUATE TRUE
WHEN DATE-DS-N IS < RANGE-1 AND IS > RANGE-2
INCREMENT COUNTER-1
WHEN DATE-DS-N IS < RANGE-3 AND IS > RANGE-4
INCREMENT COUNTER-2
......
......
WHEN OTHER
INCREMENT COUNTER-M
END-EVALUATE
END-READ
END-PERFORM.
DISPLAY 'COUNTER-1:' COUNTER-1
....
....
DISPLAY 'COUNTER-M:' COUNTER-M
This can be very easily achieved in multiple passes of data. For a single pass, I coded the below card:
//SYSIN DD *
MERGE FIELDS=(4,19,CH,A)
OUTFIL FNAMES=OUT0,INCLUDE=(MY DATE CHECK RANGE1),
REMOVECC,NODETAIL,
TRAILER1=(COUNT15)
OUTFIL FNAMES=OUT1,INCLUDE=(MY DATE CHECK RANGE2),
REMOVECC,NODETAIL,
TRAILER1=(COUNT15)
OUTFIL FNAMES=OUT2,INCLUDE=(MY DATE CHECK RANGE3),
REMOVECC,NODETAIL,
TRAILER1=(COUNT15)
OUTFIL FNAMES=OUT3,INCLUDE=(MY DATE CHECK RANGE4),
REMOVECC,NODETAIL,
TRAILER1=(COUNT15)
OUTFIL FNAMES=OUT4,INCLUDE=(MY DATE CHECK RANGE5),
REMOVECC,NODETAIL,
TRAILER1=(COUNT15)
/*
This fails under the scenario, wherein the data between two or more VSAM DS goes out of (sorted) order, as MERGE FIELDS requires the data to be sorted. [ICE068A 0 OUT OF SEQUENCE <SORTIN DSN here>]
Query: Can I use ICETOOL COUNT to achieve this, or a similar logic which handles all VSAM DS in one go and produces a simple count. I tried coding an IFTHEN condition in the USING card, but couldn't work out how to segregate the final count on multiple conditions.
Thank you.