Set rc if a value in a file is > 0



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Set rc if a value in a file is > 0

Postby LasseH » Tue May 12, 2015 7:37 pm

Hi
Is it possible to check the value of the row "*** Total number of errors:" and set the RC to 4 if the value is greater than 0

File example:
*** Total number of read records:         000000000979340                           
*** Total number of processed records: 000000000979339                           
*** Total number of errors:                   000000000000001                                                 


//Lasse
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Set rc if a value in a file is > 0

Postby BillyBoyo » Tue May 12, 2015 7:45 pm

Yes. You use OUTFIL with INCLUDE= to match the zero record. You dummy-out the DD in the JCL (you can use SORTOUT or a named other DD). Use NULLOUT=RC4 (OPTION or PARM) or NULLOFL=RC4 on the OUTFIL for a named other DD.

When there are zero records on your dataset (even though it is a dummy) then you will get RC of 4.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Set rc if a value in a file is > 0

Postby LasseH » Wed May 13, 2015 1:12 pm

Thanks Billy, works just fine.
Showing the parms for others to use
(using SYMNAMES just because I like it, maybe overkill)

//Lasse

//*--------------------------------------------------------           
//* STEPNAME: S010                                                     
//* STEPINFO: ACT ON A VALUE IN A FILE                                 
//*--------------------------------------------------------           
//S010     EXEC PGM=SORT                                               
//SYMNAMES DD *                                                       
THECOUNT,43,15,ZD                                                     
THETEXT,01,27,CH                                                       
ROW2CHK,C'*** TOTAL NUMBER OF ERRORS:'                                 
ZERO,0                                                                 
//SORTIN   DD *                                                       
*** TOTAL NUMBER OF READ RECORDS:         000000000979340             
*** TOTAL NUMBER OF PROCESSED RECORDS:    000000000979339             
*** TOTAL NUMBER OF WARNINGS:             000000000000000             
*** TOTAL NUMBER OF ERRORS:               000000000000001             
//SORTOUT  DD DUMMY                                                   
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 OPTION COPY                                                           
 OUTFIL INCLUDE=((THETEXT,EQ,ROW2CHK),AND,(THECOUNT,EQ,ZERO)),         
        NULLOFL=RC4                                                   
//*                                                                   
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Set rc if a value in a file is > 0

Postby BillyBoyo » Wed May 13, 2015 2:38 pm

Thanks for the code.

Symbols/SYMNAMES are fine to use, they will always explain the code better. However, I think yours can be made more meaningful. Where I define fields, I like them to be in ascending order by start-position. Not essential, but easier to "understand". Here's a different example of symbol use:

//SYMNAMES DD *                                                       
* Record fields
ERROR-MESSAGE-AREA,01,27,CH                                                       
ERROR-COUNT-WHICH-MUST-BE-ZERO,43,15,ZD                                                     
* Constants
ERROR-MESSAGE-TEXT,C'*** TOTAL NUMBER OF ERRORS:'                                 
EXPECTED-RESULT-OF-ZERO,0


 OUTFIL INCLUDE=((ERROR-MESSAGE-AREA,
                  EQ,
                   ERROR-MESSAGE-TEXT),
                 AND,
                  (ERROR-COUNT-WHICH-MUST-BE-ZERO,
                  EQ,
                   EXPECTED-RESULT-OF-ZERO)),         
        NULLOFL=RC4
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post