I am comparing 2 Header files. When one is missing the last 6 characters, I am trying to force a return code of 12 and print an error message. Here is the Input data sets:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
HEADER BJ#19401061220 90213 000084 RJE TIME=22:44:15 OUTRECS 0000000 ENDEDD
******************************** Bottom of Data ******************************** ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
HEADER BJ#19401061220 90213 000084 RJE TIME=22:44:15 OUTRECS 0000083
******************************** Bottom of Data ********************************
Here is my source code:
Code:
SORT FIELDS=COPY HEADER FLAG
//*SYSIN DD DSN=SWP.SAS.CNTL(KILLPROD),
//* DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,NULLOUT=RC12
INREC IFTHEN=(WHEN=(75,6,CH,NE,C'ENDEDD'),
OUTFIL HEADER2=(
20:'**************************************************',/,
20:'* WARNING WARNING WARNING WARNING WARNING *',/,
20:'**************************************************',/,
20:'* *',/,
20:'* THIS PRODUCTION JOB HAS FAILED BECAUSE EITHER *',/,
20:'* THE BACKUP HEADER RECORD OR INTERMEDIATE *',/,
20:'* HEADER RECORD DATASET FOR THIS VENDOR *',/,
20:'* DOES NOT HAVE AN "ENDEDD" FLAG. THIS MAY MEAN *',/,
20:'* THAT THERE WAS A PROBLEM IN PREVIOUS *',/,
20:'* PRODUCTION PROCESSING OR A PROBLEM WITH THE *',/,
20:'* RJE TRANSMISSION. *',/,
20:'* PLEASE VERIFY IF THE PREVIOUS PRODUCTION JOB *',/,
20:'* RAN OKAY. IF SO PLEASE VERIFY THE INTERMEDIATE *',/,
20:'* HEADER TO SEE WHY IT IS NOT FLAGGED AS ENDEDD. *',/,
20:'* IF NECESSARY THE TRANSMISSION MIGHT NEED TO *',/,
20:'* BE REDONE. *',/,
20:'* CONTACT PRODUCTION PLANNING IF YOU NEED HELP! *',/,
20:'* *',/,
20:'**************************************************',/,
20:'* WARNING WARNING WARNING WARNING WARNING *',',
20:'**************************************************'))
/*
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
How and where do you compare both Headers? Are the Headers in two separate Datasets and is it the only Data there? The OUTRECS fields in the Header is different as well besides the ENDEDD text. Please respecify to make it more understandable what you are trying here.
NULLOUT=RC? was in effect and there were no records for the SORTOUT data set, or
NULLOFL=RC?was in effect and there were no data records for an OUTFIL data set
JOINKEYS is not needed for this task plus TS needs to set RC-12 when 75,6 is empty for either of the record from the dataset and NOT after the compare and mismatch found.
I would think of this as one of many ways, try it- Assuming both Data sets can be concatenated in F1.
RC-12 is set if at least one record with 75,6 is empty found and Header2 is printed as coded Else RC-00.
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
Rohit Umarjikar wrote:
Joerg.Findeisen wrote:
@Rohit: The second INCLUDE COND=(75,6,CH,NE,C' ') will never match IMHO.
It will match for the second record as it is not needed in final out1.
Please run the card with/without it.
I did of course.
In your CTL1 you filter for an empty condition only, to put matching records to DD:OUT. With CTL2 you attempt to copy non-empty conditions from DD:OUT that can't be there anymore. That's what I meant. The INCLUDE statement in CTL2 can be omitted as it is useless.
Why it cannot be there ? If there are none all good then it’s fine and it will not be there but if there is one or more then it will be there and except header2 messages TS don’t want anything else so filter them out.
//CHKBTH EXEC SSORT,
// REGION=1536K
//* SCSAS.FT12F001 DD DUMMY
//* SCSAS.WORK DD UNIT=SYSDA,
//* SPACE=(CYL,(30,15),RLSE)
//SYSOUT DD SYSOUT=*
//*HDRIN DD DSN=SWP.BJ#19401.TRANSHDR.INTM.DATA,
//SORTIN DD DSN=PA.TEST.BTR.PA0052.TRANSHDR.DATA,
// DISP=SHR
//* DD DSN=SWP.BJ#19401.TRANSHDR.BKUP.DATA,
// DD DSN=PA.TEST.BTR.PA0052.TRANSHDR.BKUP.DFAL,
// DISP=OLD
//OUT DD DISP=(NEW,PASS),UNIT=SYSDA,
// SPACE=(TRK,(10,10),RLSE),
// DSN=&&MASTER
//OUT1 DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//F1 DD *
COPY FROM(F1) TO (OUT) USING (CTL1)
* COPY FROM(OUT) TO (OUT1) USING (CTL2)
COUNT FROM (OUT) NOTEMPTY RC12
//CTL1CNTL DD *
INCLUDE COND=(75,6,CH,EQ,C' ')
//* CTL2CNTL DD *
* INCLUDE COND=(75,6,CH,NE,C' ')
OUTFIL HEADER2=(
20:'**************************************************',/,
20:'* WARNING WARNING WARNING WARNING WARNING *',/,
20:'**************************************************',/,
20:'* *',/,
20:'* THIS PRODUCTION JOB HAS FAILED BECAUSE EITHER *',/,
20:'* THE BACKUP HEADER RECORD OR INTERMEDIATE *',/,
Whether I comment out The second Include or not, this step doesn't return a 12 code or print the error. Is there something else I am missing?
Please run the one I shared as is before modifying anything as you are using some customized proc instead of straight ICETOOL . Check if your input is correct and have 75,6 as empty.
JOINKEYS is not needed for this task plus TS needs to set RC-12 when 75,6 is empty for either of the record from the dataset and NOT after the compare and mismatch found.
I would think of this as one of many ways, try it- Assuming both Data sets can be concatenated in F1.
RC-12 is set if at least one record with 75,6 is empty found and Header2 is printed as coded Else RC-00.
Rohit - It was not supposed to an precise answer to TS's question, more as an pointer to TS, if he finds it as an fit he can use it. Also, the question from TS starts with - "I am comparing 2 Header files."
Looks like you have shared another solution, so it should be good.
It is still not working. Here is what I have:
It still gives me rc 0. Any Ideas?
As requested earlier, Please rerun exactly as is of what I have shared and it will work.
To fix the issues with your JCL, OUTFIL HEADER2 don't have ')' and second don't keep any commented code in the JCL specially within TOOLIN DD *
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
Another solution w/o ICETOOL/SYNCTOOL could be like this:
Code:
//CHECK EXEC PGM=SORT,PARM='MSG=NO'
//SORTIN DD *
HEADER BJ#19401061220 90213 000084 RJE TIME=22:44:15 OUTRECS 0000000 ENDEDD
HEADER BJ#19401061220 90213 000084 RJE TIME=22:44:15 OUTRECS 0000083
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//CHECK DD DUMMY
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:+1,BI,LENGTH=2))
SORT FIELDS=(75,6,CH,A)
SUM FIELDS=(81,2,BI)
OUTFIL FNAMES=(CHECK),NULLOFL=RC4,REMOVECC,BUILD=(C'Done.'),
INCLUDE=(75,6,CH,EQ,C'ENDEDD',AND,81,2,BI,EQ,+2)
OUTFIL FNAMES(SORTOUT),SAVE,ACCEPT=1,
BUILD=(16:C'**************************************************',/,
16:C'* WARNING WARNING WARNING WARNING WARNING *',/,
16:C'**************************************************',/,
16:C'* *',/,
16:C'* THIS PRODUCTION JOB HAS FAILED BECAUSE EITHER *',/,
16:C'* THE BACKUP HEADER RECORD OR INTERMEDIATE *',/,
16:C'* HEADER RECORD DATASET FOR THIS VENDOR *',/,
16:C'* DOES NOT HAVE AN "ENDEDD" FLAG. THIS MAY MEAN *',/,
16:C'* THAT THERE WAS A PROBLEM IN PREVIOUS *',/,
16:C'* PRODUCTION PROCESSING OR A PROBLEM WITH THE *',/,
16:C'* RJE TRANSMISSION. *',/,
16:C'* PLEASE VERIFY IF THE PREVIOUS PRODUCTION JOB *',/,
16:C'* RAN OKAY. IF SO PLEASE VERIFY THE INTERMEDIATE *',/,
16:C'* HEADER TO SEE WHY IT IS NOT FLAGGED AS ENDEDD. *',/,
16:C'* IF NECESSARY THE TRANSMISSION MIGHT NEED TO *',/,
16:C'* BE REDONE. *',/,
16:C'* CONTACT PRODUCTION PLANNING IF YOU NEED HELP! *',/,
16:C'* *',/,
16:C'**************************************************',/,
16:C'* WARNING WARNING WARNING WARNING WARNING *',/,
16:C'**************************************************')
END
/*
It will give RC=0 if the eyecatcher ENDEDD is found exactly two times, otherwise RC=4 is given and the Warning banner is shown.
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
You can make NULLOFL only end with RC0, RC4 or RC16 unfortunately. That's why I have chosen RC4 here. If you change it to RC16 it will work again and is perhaps more obvious for your desired purpose.
You can make NULLOFL only end with RC0, RC4 or RC16 unfortunately. That's why I have chosen RC4 here. If you change it to RC16 it will work again and is perhaps more obvious for your desired purpose.
Unfortunately, NULLOFL=RC16 results not in RC=16, but in ABEND U0016.
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
sergeyken wrote:
Unfortunately, NULLOFL=RC16 results not in RC=16, but in ABEND U0016.
I usually only work with RC4 setting and wasn't aware of the difference for RC16 anymore. Thanks for another refresh, I really like your contributions.