bhaskar_kanteti
Active User
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
|
|
|
|
Hi,
I need to compare two input files based on date.
In the first file the date will be of PIC X(10) and the date format is YYYY-MM-DD.
And in my second file the date will be of type s9(9) comp-3 and the date format is YYYYMMDD.
Basically the second file will have current business date which will change every day.
I want to compare the current business date from file 2 with field 3(date) of first file and write those records when the date is matching.
Here are my input and output files:
Input File 1 -> FB, LRECL=22
Input File 2 -> FB, LRECL=80
Code: |
INPUT FILE 1:
FIELD1 FIELD2 FIELD3
9(6) 9(6) X(10)
100001 200001 2008-07-03
100002 200002 2008-07-03
100003 200003 2007-06-11
100004 200004 2006-05-22
100005 200005 2008-07-01
INPUT FILE 2:
FIELD1
20080703 -> THIS IS OF TYPE S9(9) COMP-3 FORMAT WHICH WILL CONTAIN
CURRENT BUSINESS DATE. THIS DATE WILL VARY EVERY DAY.
OUTPUT FILE :
FIELD1 FIELD2 FIELD3
9(6) 9(6) X(10)
100001 200001 2008-07-03
100002 200002 2008-07-03
100005 200005 2008-07-01
|
How can i get this output. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
bhaskar_kanteti,
If you are matching on the date how did you pick the last record? i.e 2008-07-01
Assuming that it is a typo the following DFSORT JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your 80 byte date file,
// DISP=SHR
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(C'BUSDAY,C''',1,5,PD,EDIT=(TTTT-TT-TT),C'''',80:X)
/*
//STEP0200 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&T1,DISP=SHR
//SORTIN DD *
1000012000012008-07-03
1000022000022008-07-03
1000032000032007-06-11
1000042000042006-05-22
1000052000052008-07-01
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(13,10,CH,EQ,BUSDAY)
/*
|
Hope this helps... |
|