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 2 headers on files

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

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue Apr 24, 2012 12:11 pm    Post subject: Comparing 2 headers on files
Reply with quote

My requirement is as follows. I have 2 files which has a header. the header of these 2 files contain the timestamp. I need to compare the timestamps on the header of these 2 files. if the timestamps match the job should not be processed. If the timestamps do not match the job should be processed.


File A
XXXXX DD-MM-YY-HH:MM:SS:USSSS
----
----


File B
XXXXX DD-MM-YY-HH:MM:SS:USSSS


Can we do this through a sort step? Can someone guide me on this.


Thanks
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Tue Apr 24, 2012 12:14 pm    Post subject: Reply to: Comparing 2 headers on files
Reply with quote

What are XXXXX, would they be the same on each file?
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue Apr 24, 2012 12:27 pm    Post subject:
Reply with quote

Yes its the same string but i would like to compare only the timestamps.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Tue Apr 24, 2012 1:14 pm    Post subject: Reply to: Comparing 2 headers on files
Reply with quote

This could get you started.

CHKOUT is a DD DUMMY which is used to give a RC of 4 if no data is written to the file (timestamps match). If timestamps do not match, two records are written, but you don't need to see them/use them, so the DUMMY.

If the timestamps do not match, they will also be written to SORTOUT so you can see them. This can be changed, or they can be shown in a more friendly way, and you can have them even when they do match, so you know what matched, if you want.

Code:
//STEP0100 EXEC PGM=SORT
//CHKOUT DD DUMMY
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=INA,FIELDS=(7,26,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(7,26,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F1,F2,ONLY
  REFORMAT FIELDS=(F1:1,32,?,F2:1,32)
  OUTFIL FNAMES=CHKOUT,NULLOFL=RC4
//JNF1CNTL DD *
 OPTION COPY,STOPAFT=1
//JNF2CNTL DD *
 OPTION COPY,STOPAFT=1
//INA      DD *
XXXXX DD-MM-YY-HH:MM:SS:USSSS
2222
3333
4444
5555
6666
7777
//INB      DD *
XXXXX TD-MM-YY-HH:MM:SS:USSSS
2222
3333
4444
5555
6666
7777
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Wed May 09, 2012 1:50 pm    Post subject:
Reply with quote

Thanks Bill, your solution was a starting point.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Thu May 10, 2012 11:16 pm    Post subject: Comparing 2 headers on files
Reply with quote

CJT wrote:
My requirement is as follows. I have 2 files which has a header. the header of these 2 files contain the timestamp. I need to compare the timestamps on the header of these 2 files. if the timestamps match the job should not be processed. If the timestamps do not match the job should be processed.


I suggest to use SuperCompare instead of DFSORT. Below is sample jcl that will compare just the first line:
Code:
//* COMPARE FIRST RECORD OF TWO FILES         
//* RC=0 MEANS THEY ARE THE SAME               
//* RC=1 MEANS THEY ARE DIFFERENT             
//SUPERC  EXEC PGM=ISRSUPC,                   
//        PARM='DELTAL,LINECMP,DLREFM NOPRTCC'
//NEWDD  DD DSN=?,
//          DISP=SHR                           
//OLDDD  DD DSN=?,
//          DISP=SHR                           
//OUTDD  DD SYSOUT=(*)                         
//SYSIN  DD *                                 
 CMPCOLM 51:61
 CMPLINE BTM 1                                 
/*                                             

Then check the return code on the next step.
The CMPLINE restricts it to the first line only. The CMPCOLM is optional. It will compare specified columns only.
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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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