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
 
Compare 2 files and set a RC based on that

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Compare 2 files and set a RC based on that
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 29, 2008 1:02 am    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 29, 2008 3:00 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM 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 Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm

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