Page 1 of 1

Calculate the Julian date difference in input file

PostPosted: Wed Apr 24, 2013 9:51 am
by Prasanna G
Hi

I have an input file with record length 80. There are four fields in the input file. The record layout is as follows.
05 BRANCH-NO               PIC S9(7) COMP-3.
05 ACCOUNT-NO              PIC S9(9) COMP-3.
05 LIM-LAST-CHG-YYDDD      PIC S9(5) COMP-3.
05 LIM-EXP-YYDDD           PIC S9(5) COMP-3.
05 FILLER                  PIC X(65).


My requirement is to extract records from the input file for which the expiry date is greater than 12 months from last changed date field.
Please let me know if any other details are requried.

Thanks
Prasanna G.

Re: Calculate the Julian date difference in input file

PostPosted: Wed Apr 24, 2013 9:56 pm
by skolusu
Prasanna G,

Use the following DFSORT JCL which will give you the desired results. YYDDD is Y2U format in packed decimal format with a length of 3 bytes.

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD DISP=SHR,DSN=Your Input FB 80 byte file
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                     
  OPTION COPY                                       
  INREC OVERLAY=(81:10,3,Y2U,ADDMONS,+12,TOJUL=Y2U)
  OUTFIL INCLUDE=(13,3,Y2U,GT,81,3,Y2U),BUILD=(1,80)
//*