Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing dates of different formats in two input files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Thu Jul 03, 2008 6:12 pm    Post subject: Comparing dates of different formats in two input files
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    Post subject:
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: 120
Location: USA

PostPosted: Fri Jul 04, 2008 5:17 pm    Post subject: Reply to: Comparing dates of different formats in two input
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us