MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparision of First Record in Datasets and Decision making

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
manojagrawal
Beginner


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Thu Apr 29, 2004 1:03 pm    Post subject: Comparision of First Record in Datasets and Decision making Reply with quote

Hello,

Say I have to files, both FB RECL=240 with the records having HEX also.

The First file has a number of records.
The Second file has only 1 record.

I want to compare the first record of the first file, with the only record in the second file. If they are the same, I want the job to stop with some RC. If they are different, then I want the job to continue to the next step. How can I do the compare and such decision making?

I did a search but could not find anything similar.
_________________
Thanks & Regards,
Manoj.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2004 1:17 pm    Post subject: Reply with quote

Manoj,

This is fairly simple. Do you want to compare the records in a pgm or utility like sort?

If it is program, just compare the 2 records and if they match then move 16 to the return code or else move someother code to the return code . Then in the JCL using cond condition you can skip/continue all other steps.

Check this link for setting return code in cobol

http://www.mvsforums.com/helpboards/viewtopic.php?t=2059&highlight=returncode

Check this link for setting return code in PL/I

http://www.mvsforums.com/helpboards/viewtopic.php?t=2068&highlight=returncode

I will post the solution using sort if you provide me with the details.

1. what is the lrecl & recfm of the files?
2. what are the positions to be compared for equality check?

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojagrawal
Beginner


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Thu Apr 29, 2004 1:52 pm    Post subject: Reply with quote

Hello Kolusu,

I want to do this only using a job step's and not any program. As mentioned above the files are FB with LRECL = 240 and I want to compare the entire record for equality. Thanks!
_________________
Thanks & Regards,
Manoj.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2004 2:44 pm    Post subject: Reply with quote

Manoj,

The following JCl will give you the desired results. The first step copies the first record from your file which has more records.

The next step we concate the above created file with the one record file and sort on the entire record and using sum fields we eliminate the dupes.

using startrec on outfil we always will write out the second record.

Now if the both records are matched , there will only be one record since we are using sum fields=none. So writing the output from second record will end in an empty file. It is where we use the NULLOUT parm where we can set the return code to 0,4,or 16. Here I am setting the return code to 4 in this case.

If the records do not match then we have 1 record in the output and the return code will automatically be zero.

Now using cond on the following steps we either skip or run the other steps.

Code:

//STEP0100  EXEC PGM=SORT         
//SYSOUT    DD SYSOUT=*           
//SORTIN    DD DSN=YOUR MANY RECORD FILE,
//             DISP=SHR
//SORTOUT   DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
//SYSIN     DD *                                             
  SORT FIELDS=COPY                                           
  OPTION STOPAFT=1                                           
//*                                                           
//STEP0200  EXEC PGM=SORT                                   
//SYSOUT    DD SYSOUT=*                                     
//SORTIN    DD DSN=YOUR ONE RECORD FILE,
//             DISP=SHR
//          DD DSN=&T1,DISP=OLD
//SORTOUT   DD SYSOUT=*     
//SYSIN     DD *           
  OPTION NULLOUT=RC4         
  SORT FIELDS=(1,240,CH,A)   
  SUM FIELDS=NONE           
  OUTFIL STARTREC=2         
//*
//STEP0300  EXEC PGM=COBPGM1,COND=(4,EQ,STEP0200)
...
   
//STEP0400  EXEC PGM=COBPGM2,COND=(4,EQ,STEP0200)
...




If you get an error on NULLOUT parm then you are porbably using an older version of sort. In that case remove the option nullout=rc4 and you need one more step to check the empty file condition using any one of the method listed in this topic.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1285&highlight=empty

Hope this helps....

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manojagrawal
Beginner


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Fri Apr 30, 2004 9:25 am    Post subject: Reply with quote

Kolusu,

Wonderful!!!! Worked just as required. Thanks a ton and Hats off to you!!!

The NULLOUT Parm did not work (So I do have a older version of sort Mr. Green ). Used the other methods to check for the NULL file and make RC = 12 when empty, else the job automatically continues to the next step and the COND parameter was not needed.
_________________
Thanks & Regards,
Manoj.
Back to top
View user's profile Send private message
syandra
Beginner


Joined: 26 May 2003
Posts: 19
Topics: 6

PostPosted: Mon Dec 06, 2004 4:40 am    Post subject: Reply with quote

Hi manoj,

Can you explain breifly wht are the othe rmethods you employed to find the NULL file

Thanks,
Sukumar
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Dec 06, 2004 5:36 am    Post subject: Reply with quote

syandra,

Check the following link which explains different types of empty file checking.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1285&highlight=empty

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
syandra
Beginner


Joined: 26 May 2003
Posts: 19
Topics: 6

PostPosted: Thu Dec 09, 2004 2:16 am    Post subject: Reply with quote

Phantom,

Thanks for the info. Smile

Thanks,
Sukumar
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group