IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Force a Return Code and print error message


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Thu Jun 25, 2020 1:18 am
Reply with quote

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:'**************************************************')) 
/*


What am I doing wrong?
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 352
Location: Bamberg, Germany

PostPosted: Thu Jun 25, 2020 1:37 am
Reply with quote

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.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 2:08 am
Reply with quote

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
Back to top
View user's profile Send private message
Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 14
Location: New Jersey

PostPosted: Thu Jun 25, 2020 2:55 am
Reply with quote

Hopefully similar, do check

Use [URL] BBCode for Links
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 9:09 am
Reply with quote

Quote:
What am I doing wrong?

Your syntax is not correct, IFTHEN condition is incomplete.

Tushar Sood wrote:
Hopefully similar, do check

Use [URL] BBCode for Links

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.

Code:
//STEP01   EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-                                                 
//F1       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 0000000
//OUT      DD  DISP=(NEW,PASS),                                         
//             UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),                     
//             DSN=&&MASTER                                             
//OUT1     DD  SYSOUT=*                                                 
//TOOLIN   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:C'WARNING')   
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 352
Location: Bamberg, Germany

PostPosted: Thu Jun 25, 2020 2:31 pm
Reply with quote

@Rohit: The second INCLUDE COND=(75,6,CH,NE,C' ') will never match IMHO.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 6:02 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Thu Jun 25, 2020 7:22 pm
Reply with quote

I apologize. yes the 2 headers are in 2 datasets which are sorted in:
Code:
//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                                   
 SORT FIELDS=COPY                   HEADER FLAG           
//*SYSIN    DD  DSN=SWP.SAS.CNTL(KILLPROD),               
//*             DISP=SHR                                 
//SORTOUT DD   SYSOUT=*                                   
//SYSIN    DD  *                                         
             

The first dataset has the header that ends with ENDEDD. The second one does not and should cause the failure. I will try your suggestion. Thanks!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 7:23 pm
Reply with quote

Rick Ryan wrote:
I apologize. yes the 2 headers are in 2 datasets which are sorted in:
Code:
//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                                   
 SORT FIELDS=COPY                   HEADER FLAG           
//*SYSIN    DD  DSN=SWP.SAS.CNTL(KILLPROD),               
//*             DISP=SHR                                 
//SORTOUT DD   SYSOUT=*                                   
//SYSIN    DD  *                                         
             

The first dataset has the header that ends with ENDEDD. The second one does not and should cause the failure. I will try your suggestion. Thanks!
Thanks and that's what I thought and assumed and should work.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 352
Location: Bamberg, Germany

PostPosted: Thu Jun 25, 2020 7:40 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 7:42 pm
Reply with quote

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.

I am surprised you did not see it in out1 sysout.
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Thu Jun 25, 2020 10:12 pm
Reply with quote

Here is what I currently have:
Code:
//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?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Thu Jun 25, 2020 10:15 pm
Reply with quote

Rick Ryan wrote:
Here is what I currently have:
Code:
//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.
Back to top
View user's profile Send private message
Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 14
Location: New Jersey

PostPosted: Fri Jun 26, 2020 12:12 am
Reply with quote

Rohit Umarjikar wrote:
Quote:
What am I doing wrong?

Your syntax is not correct, IFTHEN condition is incomplete.

Tushar Sood wrote:
Hopefully similar, do check

Use [URL] BBCode for Links

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.

Code:
//STEP01   EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-                                                 
//F1       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 0000000
//OUT      DD  DISP=(NEW,PASS),                                         
//             UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),                     
//             DSN=&&MASTER                                             
//OUT1     DD  SYSOUT=*                                                 
//TOOLIN   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:C'WARNING')   


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.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Fri Jun 26, 2020 12:21 am
Reply with quote

It was misleading as no compare needed suppose to whats being shown in the jcl by the TS.
Back to top
View user's profile Send private message
Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 14
Location: New Jersey

PostPosted: Fri Jun 26, 2020 12:44 am
Reply with quote

Rohit Umarjikar wrote:
It was misleading as no compare needed suppose to whats being shown in the jcl by the TS.


Call me and we will resolve it icon_smile.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Fri Jun 26, 2020 12:45 am
Reply with quote

Tushar Sood wrote:
Rohit Umarjikar wrote:
It was misleading as no compare needed suppose to whats being shown in the jcl by the TS.


Call me and we will resolve it icon_smile.gif
haha it’s resolved in that sense 😊
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Fri Jun 26, 2020 1:02 am
Reply with quote

It is still not working. Here is what I have:
Code:
//STEP01   EXEC PGM=ICETOOL                                                     
//TOOLMSG  DD SYSOUT=*                                                         
//DFSMSG   DD SYSOUT=*                                                         
//F1       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       
//* 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,5PACE=(TRK,(10,10),RLSE),                           
//             DSN=&&MASTER                                                   
//OUT1    DD   SYSOUT=*                                                       
//TOOLIN  DD  *                                                               
* SORT FIELDS=COPY                                                             
//*SYSIN    DD  DSN=SWP.SAS.CNTL(KILLPROD),                                   
//*             DISP=SHR                                                       
//*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:'**************************************************',/,         
                     

It still gives me rc 0. Any Ideas?
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 352
Location: Bamberg, Germany

PostPosted: Fri Jun 26, 2020 1:19 am
Reply with quote

Rick Ryan wrote:
It still gives me rc 0. Any Ideas?

Remove that clutter:
Code:
* SORT FIELDS=COPY                                                             
//*SYSIN    DD  DSN=SWP.SAS.CNTL(KILLPROD),                                   
//*             DISP=SHR                                                       
//*SORTOUT DD   SYSOUT=*                                                       
//* F1      DD *                                                               
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Fri Jun 26, 2020 1:40 am
Reply with quote

Rick Ryan wrote:
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 *
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
View Bookmarks
Forum Index -> SYNCSORT Goto page 1, 2  Next

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Getting error while xped JCL & VSAM 10
No new posts JCL for replacing code in Cobol JCL & VSAM 8
No new posts Proc print in Mainframe All Other Mainframe Topics 4
No new posts can someone please help me in finding... IBM Tools 9
No new posts SYNCSORT Error - CONTROL FIELD BEYOND... SYNCSORT 10

Back to Top