View previous topic :: View next topic |
Author |
Message |
manojagrawal Beginner

Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Thu Apr 29, 2004 1:03 pm Post subject: Comparision of First Record in Datasets and Decision making |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
manojagrawal Beginner

Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Thu Apr 29, 2004 1:52 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Thu Apr 29, 2004 2:44 pm Post subject: |
|
|
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 |
|
 |
manojagrawal Beginner

Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Fri Apr 30, 2004 9:25 am Post subject: |
|
|
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 ). 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 |
|
 |
syandra Beginner

Joined: 26 May 2003 Posts: 19 Topics: 6
|
Posted: Mon Dec 06, 2004 4:40 am Post subject: |
|
|
Hi manoj,
Can you explain breifly wht are the othe rmethods you employed to find the NULL file
Thanks,
Sukumar |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
|
Back to top |
|
 |
syandra Beginner

Joined: 26 May 2003 Posts: 19 Topics: 6
|
Posted: Thu Dec 09, 2004 2:16 am Post subject: |
|
|
Phantom,
Thanks for the info.
Thanks,
Sukumar |
|
Back to top |
|
 |
|
|