View previous topic :: View next topic
|
Author |
Message |
bharath_gct2002
New User
Joined: 08 Oct 2007 Posts: 27 Location: Dallas, TX
|
|
|
|
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 |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
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 |
|
|
bharath_gct2002
New User
Joined: 08 Oct 2007 Posts: 27 Location: Dallas, TX
|
|
|
|
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 |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
bharath_gct2002
New User
Joined: 08 Oct 2007 Posts: 27 Location: Dallas, TX
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
COBOL, Easytrieve, or even HLASM would be shorter and easier then trying to do it with utilities. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Good to hear you have it working
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 |
|
Back to top |
|
|
|