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

Compare 2 files and set a RC based on that


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Thu Aug 28, 2008 3:34 am
Reply with quote

Hi All,

I have a requirement to create a Job which does the following:

1. I need to compare a file (FILE1 LRECL=80) with 3 different files (FILE2, FILE3, FILE4 all with LRECL=80). All the 4 files are in same format and has just only 1 record as shown below.
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
08/26/2008200823908/25/20082008238108/27/2008200824023..........................

If FILE1=FILE2 AND FILE1=FILE3 AND FILE1=FILE4, then set RC = 0, Else
Set RC = 1.

2. If RC=1, ABEND the JOB and also display which file ( out of FILE2,3,4) does not MATCH with FILE1.

I need to know with which I can code this with . SUPERCE, FILA or SORT.

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

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Thu Aug 28, 2008 6:04 pm
Reply with quote

May not be the efficient solution but you can try with three SUPERCE steps to compare FILE1 with the three other files. Validate the return codes of these three steps in an IF , when all three codes are zero set maxcc as zero and exit, have three other steps in the else part of the IF to validate which of the three codes are non-zero (using COND) and print the file in the steps to identify the mismatch record.
Back to top
View user's profile Send private message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Thu Aug 28, 2008 8:11 pm
Reply with quote

I can build the code to compare using any of the above methods but am not sure how can we set the RC usng JCL. Please help me.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Thu Aug 28, 2008 8:52 pm
Reply with quote

You can set returncodes in JCL using IDCAMS. Just do a simple repro or list a dataset . Then validate the LASTCC which most likely will be zero from this step and set the MAXCC. Something like this

IF LASTCC = 0 THEN DO
SET MAXCC = 0
END

This will work only when you get a RC of zero from the steps where you SUPERCE the files.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 29, 2008 1:02 am
Reply with quote

Hello,

If you wrote a most trivial bit of cobol code, you could open the files and compare each of the files to file1 and set the return-code accordingly.

Clone some existing little program. . .
1 select - copy it 3 more times,
1 fd - copy it 3 more times,
1 open for all 4 files,
1 read/at end - copy it 3 more times,
1 compare - copy it 2 more times,
2 set return-code (depending),
1 close for all 4 files,

I believe that's all. . .

You could do something easily with Easytrieve also if your system has Easytrieve.
Back to top
View user's profile Send private message
bharath_gct2002

New User


Joined: 08 Oct 2007
Posts: 27
Location: Dallas, TX

PostPosted: Fri Aug 29, 2008 1:06 am
Reply with quote

Thanks Dick!!

I have already coded the same in EazyTrieve.I thought can this be done using any of the utilities in an effecient way.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Aug 29, 2008 1:07 am
Reply with quote

COBOL, Easytrieve, or even HLASM would be shorter and easier then trying to do it with utilities.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 29, 2008 3:00 am
Reply with quote

Hello,

Good to hear you have it working icon_smile.gif

Thank you for letting us know.

Quote:
COBOL, Easytrieve, or even HLASM would be shorter and easier then trying to do it with utilities.
Yup, that's a big 10-4 icon_wink.gif
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 -> JCL & VSAM

 


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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top