IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comparing dates of different formats in two input files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Jul 03, 2008 6:12 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 03, 2008 9:24 pm
Reply with quote

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...
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Fri Jul 04, 2008 5:17 pm
Reply with quote

Hi kolusu,
Thank you. Its working.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top