Page 1 of 1

Unusual INCLUDE

PostPosted: Fri Aug 03, 2012 12:38 am
by JohnH
I need to sort a VSAM file and include only those records in the output which contain a 'Y' in column 1 and MMYY in the next four columns where MMYY is the two-digit month and two-digit year of the previous month. Example: in Autust of 2012 'Y0712...' would be selected, but 'y0812...' would not. Any help appreciated. John

Re: Unusual INCLUDE

PostPosted: Fri Aug 03, 2012 2:00 am
by dick scherrer
Hello,

You could consider generating a SYMNAMES statement containing the MMYY you want and usint this in the INCLUDE (along with the Y in col 1.

Re: Unusual INCLUDE

PostPosted: Fri Aug 03, 2012 4:40 pm
by bodatrinadh
Hello johnH,

You can try below code..

//STEP1A    EXEC PGM=SORT                                 
//SYSPRINT DD SYSOUT=*                                     
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
Y0812 AA1                                                 
 0412 AA2                                                 
 0712 AAC                                                 
Y0212 AA3                                                 
Y0712 AAA                                                 
 0112 AA4                                                 
 0612 BB1                                                 
//SORTOUT  DD SYSOUT=*                                     
  INREC BUILD=(01,10,81:04,02,83:02,02)                   
  SORT FIELDS=COPY                                         
  OUTFIL OUTREC=(1,10),INCLUDE=(1,1,CH,EQ,C'Y',AND,       
                                81,4,Y2T,EQ,Y'DATE2'-1)   


Output will be :-

Y0712 AAA