sarath pelluri
sarath pelluri

Reputation: 1

Required sort jcl to copy last 3 days data from date format mmddyyyy in alphanumeric variable

I have input file with 10100 RL with date in MMDDYYYY format at 7033 position which is picx(08), I want to copy only last three days data.

I tried so many date functions but did not work.

Upvotes: -1

Views: 240

Answers (1)

Kolusu
Kolusu

Reputation: 566

You can use DFSORT to filter the last 3 day records from current date quite easily. Since your date format is a bit different, we need to re-arrange that in a temp area.

Assuming your Input file has an RECFM=FB then the following JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DISP=SHR,DSN=Your.Input.FB.LRECL.10100.file
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                  
  OPTION COPY                                    
  INREC OVERLAY=(10101:7037,04,         # CCYY   
                       7033,02,         # MONTH  
                       7035,02)         # DAY    
                                                 
  OUTFIL BUILD=(01,10100),                       
  INCLUDE=(10101,8,CH,GE,DATE1-3)                
/*                               

PS: If your input file is Variable length(VB) then you need to use different control cards.

Upvotes: 0

Related Questions