IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Jun 26, 2020 11:39 pm
Reply with quote

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

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Sat Jun 27, 2020 12:40 am
Reply with quote

This works GREAT!!! How could I get it to return a 12? When I try to change
Code:
OUTFIL FNAMES=(CHECK),NULLOFL=RC4,REMOVECC,BUILD=(C'DONE.'),


TO

Code:
OUTFIL FNAMES=(CHECK),NULLOFL=RC12,REMOVECC,BUILD=(C'DONE.'),


I get a PARM error. It won't work if I change it to NULLOUT either. Any suggestions?

Thanks!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Jun 27, 2020 1:08 am
Reply with quote

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

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Sat Jun 27, 2020 2:17 am
Reply with quote

Joerg.Findeisen wrote:
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.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Jun 27, 2020 2:27 am
Reply with quote

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

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Sat Jun 27, 2020 3:23 am
Reply with quote

SYNCTOOL (and ICETOOL) both provide an option to return various RC without ABEND. But they both do not detect special conditions, as SYNCSORT (and DFSORT) do.
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Mon Jul 06, 2020 11:52 pm
Reply with quote

I am trying to adapt this group of steps
Code:
//CHKBTH  EXEC PGM=SORT,PARM='MSG=NO'                           
//*            REGION=1536K                                     
//SORTIN   DD  DSN=PA.TEST.BTR.PA0052.TRANSHDR.INTM.DATA,       
//             DISP=SHR                                         
//*        DD  DSN=SWP.BJ#19401.TRANSHDR.BKUP.DATA,             
//*        DD  DSN=PA.TEST.BTR.PA0052.TRANSHDR.BKUP.DFAL,       
//         DD  DSN=PA.TEST.BTR.PA0052.TRANSHDR.BKUP.DATA,       
//             DISP=OLD                                         
//* STEP01   EXEC PGM=ICETOOL                                   
//SYSOUT   DD SYSOUT=*                                         
//SORTOUT  DD SYSOUT=*                                               
//* F1       DD *                                                     
//CHECK    DD SYSOUT=*                                               
//*            UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),                   
//*            DSN=&&MASTER                                           
//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'GOOD.'),         
   INCLUDE=(75,6,CH,EQ,C'ENDEDD',AND,81,2,BI,EQ,+2)                   
 OUTFIL FNAMES=(SORTOUT),SAVE,ACCEPT=1,                               
   BUILD=(20:C'**************************************************',/,
          20:C'*    WARNING WARNING WARNING WARNING WARNING     *',/,
          20:C'**************************************************',/,
          20:C'*                                                *',/,
          20:C'* THIS PRODUCTION JOB HAS FAILED BECAUSE EITHER  *',/,
          20:C'* THE BACKUP HEADER RECORD OR INTERMEDIATE       *',/,
          20:C'* HEADER RECORD DATASET FOR THIS VENDOR          *',/,
          20:C'* DOES NOT HAVE AN "ENDEDD" FLAG. THIS MAY MEAN  *',/,
          20:C'* THAT THERE WAS A PROBLEM IN PREVIOUS           *',/,
          20:C'* PRODUCTION PROCESSING OR A PROBLEM WITH THE    *',/,
          20:C'* RJE TRANSMISSION.                              *',/,
          20:C'* PLEASE VERIFY IF THE PREVIOUS PRODUCTION JOB   *',/,
          20:C'* RAN OKAY. IF SO PLEASE VERIFY THE INTERMEDIATE *',/,
          20:C'* HEADER TO SEE WHY IT IS NOT FLAGGED AS ENDEDD. *',/,
          20:C'* IF NECESSARY THE TRANSMISSION MIGHT NEED TO    *',/,
          20:C'* BE REDONE.                                     *',/,
          20:C'* CONTACT PRODUCTION PLANNING IF YOU NEED HELP!  *',/,
          20:C'*                                                *',/,
          20:C'**************************************************',/,
          20:C'*    WARNING WARNING WARNING WARNING WARNING     *',/,
          20:C'**************************************************') 
 END                                                                 

To print 2 errors based on 2 different includes. Here is what I have:
Code:

//CHKHDR  EXEC PGM=SORT,COND=(0,NE)                           
//*          REGION=1536K                                     
//*HDRIN    DD  DSN=SWP.BJ#19401.TRANSHDR.DATA,               
//SORTIN   DD  DSN=PA.TEST.BTR.PA0052.TRANSHDR.DATA,           
//* SORTIN   DD  DSN=PA.TEST.BTR.PA0052.TRANSHDR.DFHR,         
//             DISP=OLD                                       
//*SYSIN    DD  DSN=SWP.SAS.CNTL(NULLSTOP),                   
//*             DISP=SHR                                       
//SYSOUT  DD   SYSOUT=*                                       
//SORTOUT DD   SYSOUT=*                                       
//ERROR1  DD   SYSOUT=* 6                                     
//ERROR2  DD   SYSOUT=*                                       
//SYSIN   DD  *                                               
 SORT FIELDS=(COPY)                                           
 OUTFIL FNAMES=(ERROR1),NULLOFL=RC4,REMOVECC,BUILD=(C'GOOD.'),
   INCLUDE=(3,6,CH,EQ,C'HEADER')                               
 OUTFIL FNAMES=(SORTOUT),SAVE,ACCEPT=1,                       
   BUILD=(20:C'********************************************',/,
          20:C'*   WARNING   WARNING   WARNING   WARNING  *',/,
          20:C'********************************************',/,
          20:C'*                                          *',/,
          20:C'*  THE PRIMARY AND/OR BACKUP TRANSMISSION  *',/,
          20:C'*  HEADER RECORD IS INVALID.  VERIFY BOTH  *',/,
          20:C'*  BY RUNNING THE TRANSMISSION VERIFICATION*',/,
          20:C'*  CLIST <<< RJEINPUT >>>.  IF HEADER IS   *',/,
          20:C'*  NOT VALID THE ASSOCIATED DATA FILE MAY  *',/,
          20:C'*  ALSO BE INVALID.  IF CORRECTIONS CANNOT *',/,
          20:C'*  BE MADE YOU MUST REMOVE THAT HEADER AND *',/,
          20:C'*  THE ASSOCIATED TRANSMISSION DATA FILE   *',/,
          20:C'*  FROM THE PRODUCTION JCL PER VENDOR/RJE  *',/,
          20:C'*  PROCEDURES FOR THIS NETWORK.  VENDOR    *',/,
          20:C'*  MAY THEN HAVE TO RETRANSMIT THIS DATA.  *',/,
          20:C'*                                          *',/,
          20:C'********************************************',/,
          20:C'*  WARNING   WARNING   WARNING   WARNING   *',/,
          20:C'********************************************')   
END                                                             
OUTFIL FNAMES=(ERROR2),NULLOFL=RC4,REMOVECC,BUILD=(C'GOOD.'),   
  INCLUDE=(75,6,CH,EQ,C'      ')                               
OUTFIL FNAMES=(SORTOUT),SAVE,ACCEPT=1,                         
  BUILD=(20:C'**********************************************',/,
         20:C'**  WARNING   WARNING   WARNING   WARNING   **',/,
         20:C'**********************************************',/,
         20:C'*                                            *',/,
         20:C'*  THE HEADER RECORD FLAG SHOWS AN ERROR     *',/,
         20:C'*  WAS DETECTED BY THE TRANSMISSION PROGRAM  *',/,
         20:C'*  DURING A VENDOR TRANSMISSION.             *',/,
         20:C'*                                            *',/,
         20:C'*  THE ERROR HAS NOT BEEN RECONCILED!        *',/,
         20:C'*                                            *',/,
         20:C'*  EXECUTE THE TRANSMISSION VERIFICATION     *',/,
         20:C'*  CLIST <<< RJEINPUT >>> TO DETERMINE WHICH *',/,
         20:C'*  DATASET IS IN ERROR.                      *',/,
         20:C'*                                            *',/,
         20:C'*  THERE CAN BE MORE THAN ONE IN ERROR!      *',/,
         20:C'**********************************************',/,
         20:C'**  WARNING   WARNING   WARNING   WARNING   **',/,
         20:C'**********************************************') 
 END                                                           
/*                                                             


I am getting these error messages:
Code:
000112 .AAAHA  12 CAY6006S VERB                                       
                           "FNAMES=(ERROR2),NULLOFL=RC4,REMOVECC,BUIL
                           =(C"GOOD."),INCLUDE=(75,6,CH,EQ,C"" IS     
                           UNKNOWN                                   
000114 .AAAHC  12 CAY6006S VERB                                       
                           "FNAMES=(SORTOUT),SAVE,ACCEPT=1,BUILD=(20:
                           "***********************************" IS   
                           UNKNOWN                                   


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

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Jul 07, 2020 12:01 am
Reply with quote

END is not needed.
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Tue Jul 07, 2020 12:54 am
Reply with quote

I removed the 2 END statements. I am still getting duplicate parameter errors for FNAMES and Build related to ERROR2. I renamed SORTOUT to SORTOF2 for the second one and I am still getting the same errors. Any Ideas?:If I change the FNAMES files to
Code:
 OUTFIL FNAMES=(ERROR1,error2),NULLOFL=RC4,REMOVECC,BUILD=(C'GOOD.'),
   INCLUDE=(3,6,CH,EQ,C'HEADER')                                     
 OUTFIL FNAMES=(SORTOUT,sortof2),SAVE,ACCEPT=1,                     

Where would I place the second INCLUDE and BUILD Commands?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Jul 07, 2020 7:15 pm
Reply with quote

Rick Ryan wrote:
I removed the 2 END statements. I am still getting duplicate parameter errors for FNAMES and Build related to ERROR2. I renamed SORTOUT to SORTOF2 for the second one and I am still getting the same errors. Any Ideas?:If I change the FNAMES files to
Code:
 OUTFIL FNAMES=(ERROR1,error2),NULLOFL=RC4,REMOVECC,BUILD=(C'GOOD.'),
   INCLUDE=(3,6,CH,EQ,C'HEADER')                                     
 OUTFIL FNAMES=(SORTOUT,sortof2),SAVE,ACCEPT=1,                     

Where would I place the second INCLUDE and BUILD Commands?


0) There is no BUILD command

1) END has nothing to do with any problem

2) RTFM

3) INCLUDE can be used:
- as optional stand-alone statement, applied before INREC, and SORT processing
- as optional parameter of any OUTFIL statement

4) BUILD can be used:
- as optional parameter of INREC statement
- as optional parameter of OUTREC statement
- as optional parameter of OUTFIL statement

5) No lowercase statements/parameters/options are accepted by SORT utilities

This all is described in SORT manuals, if you ever tried to read them?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jul 07, 2020 7:28 pm
Reply with quote

All I can say , this topic need not to this far when two working solutions provided already.

Why do you need OUTFIL FNAMES=(SORTOUT),SAVE,ACCEPT=1, twice, because of two different INCLUDE? Did you just change the requirement ? The solutions given were based on earlier requirements. You could fix syntax errors by looking in manuals,
Please restate the new requirement to distinguish between earlier ask and now.

To ease the understanding , you can always breaks into multiple steps solutions for different conditions and messages in SORTOUT, no hard and fast rule to combine them in one step.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top