I am trying to sort a VSAM file to a flat file with the condition that the date W1234-INPUT-DATE of the VSAM file should be in the range between 01012004 to 01012007 and W1234-MAIL-OPT-OUT = y .The JCL is running successfully but only the second condition is met and the record having the date which is not in the specified range are also getting copied.
Kindly help in this regard.
Thanks in advance.
Rahul
************************************
nuaxk67.TEST.PARMLIB(ADI36AA),
SORT FIELDS=(1,16,CH,A)
INCLUDE COND=(1417,8,CH,GE,C'01012004',AND,1417,8,CH,LE,C'27112007',
AND,1190,1,CH,EQ,C'Y')
******************************************************
JCL
Could you please explain me the below syntax.As the date in the file is of the format DDMMYYYY,thereby do I need to write another INREC OVERLAY statement to convert DDMMYYYY to MMDDYYYY.
*********************
Convert 'mmddyyyy' date to 'yyyymmdd' date in 3501-3508
INREC OVERLAY=(3501:1421,4,1417,4)
SORT FIELDS=(1,16,CH,A)
* Do INCLUDE on 'yyyymmdd' date in 3501-3508
OUTFIL INCLUDE=(3501,8,CH,GE,C'20040101',AND,
3501,8,CH,LE,C'20070101',AND,
1190,1,CH,EQ,C'Y'),
BUILD=(1,3500)
**********************
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
Rahul,
Most of the statements are self-explanatory. Anyways find below the explanations.
Code:
Convert 'mmddyyyy' date to 'yyyymmdd' date in 3501-3508
INREC OVERLAY=(3501:1421,4,1417,4)
SORT FIELDS=(1,16,CH,A)
The date which is of the form 'mmddyyyy' from pos 1417 till 1424 is overlayed in pos 3501 till 3508 in the form 'yyyymmdd'. Then it is sorted on the first 16 characters.
Then in the INCLUDE condition records with the date greater than 20040101 and less than 20070101 are selected. These records should also have Y in the 1109th position.
Code:
BUILD=(1,3500)
After selecting all the records meeting our requirement we are ignoring the data which we overlayed in the 3501 - 3508. This is done by building only the first 3500 characters using the BUILD command.
I beleive there might not be no records thats falls into the include condition option. let us say if any one of the condition among the three in the include is not met, it wont get included in the sort operation and it go for sorting as per you have given in the main sort card. (SORT FILEDS (....)).. So try with the same option by giving ONLY in the sort card.
Only those records having Input-date between 01012004 to 01012007 and Indicator set to 'y' will be included.
My doubt is that how I can convert DDMMYYYY to YYYYMMDD format.Do I have to use the INREC OVERLAY statement twice forst to convert the DDMMYYYY to YYYYDDMM and then to convert YYYYDDMM to YYYYMMDD.
If you get syntax errors with these control statements, show the error messages using code tags, and tell me exactly where the $ points in each line that got a syntax error.