Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Need input in Scheduling Benchwarmer CA Products 5 Tue Jun 06, 2017 1:44 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us