I was wondering if there is a way to set the RETURN CODE to a job to 04 (as an example) if a specific field on the record is not numeric.
Let's say you have a file and in position 1 for a length of 10, you expect it to be numeric. When you check the value and it's not numeric, you want to set the return code to 04 to issue a warning to let someone know that there may be an issue with the file.
It's ZD. But regardless of he format, it would be nice if there is a way to check a field for a value and depending on the criteria, you can set the return code in the job.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
What do you consider to be "not numeric" for a ZD field?
What do you consider to be "not numeric" for a PD field?
Does the data set contain one record, or more than one record? If the data set contains more than one record, do you want to set a non-zero return code if any record has a "not numeric" value?
These 3 fields need to be checked to see if they are numeric or not. Spaces is considered numeric in this instance. I could set zeroes into those fields by replacing all spaces with zeores and then check for numeric. But what I eventually want to do is, if any of those fields are not numeric, then I would like to set a return code 04 to the job to warn the user that there are non-numeric values in the fields.
----+----1----+----2----+----3----+----4----+----5----+----6----+-
********************************* Top of Data ********************
HDRXXXX100XXXXXXXX20060821081912
IRO 200606059999-1001 X 1026259 001828 000000003
IRO 200606059999-1001 008247 X 000000000
any other character other than space '0' thru '9' would be invalid.
I just added an 'X' in one of the fields for each record above...
Thanks
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what I think you asked for. If any record has a non-numeric value in your specified fields, the ICETOOL step will pass back RC=4. Otherwise, it will pas back RC=0.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COUNT FROM(T1) NOTEMPTY RC4
/*
//CTL1CNTL DD *
* Change spaces to '0's.
ALTSEQ CODE=(40F0)
INREC OVERLAY=(24:24,34,TRAN=ALTSEQ)
* Include any record with non-numeric values.
OUTFIL FNAMES=T1,INCLUDE=(24,34,FS,NE,NUM)
/*
I finally got around testing this, sorry for the delay... I ran it this morning and I got the following error (RC 16)
Code:
ICE630I 0 MODE IN EFFECT: STOP
COPY FROM(IN) USING(CTL1)
ICE606I 0 DFSORT CALL 0001 FOR COPY FROM IN TO OUTFIL USING CTL1CNTL TERMINATED
ICE602I 0 OPERATION RETURN CODE: 16
ICE630I 2 MODE IN EFFECT: SCAN
COUNT FROM(T1) NOTEMPTY RC4
ICE612I 0 NO ERRORS FOUND IN STATEMENT
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE000I 0 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 08:10 ON FRI AUG 25, 2006 -
* CHANGE SPACES TO '0'S.
ALTSEQ CODE=(40F0)
INREC OVERLAY=(24:24,34,TRAN=ALTSEQ)
* INCLUDE ANY RECORD WITH NON-NUMERIC VALUES.
OUTFIL FNAMES=T1,INCLUDE=(24,34,FS,NE,NUM)
$
ICE113A E COMPARISON FIELD ERROR
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,DYN*
ALLOC
SORT FIELDS=COPY
ICE052I 3 END OF DFSORT
I looked up the error IEC602I & IEC200I, but cannot figure out the problem.
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE000I 0 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 08:10 ON FRI AUG 25, 2006 -
* CHANGE SPACES TO '0'S.
ALTSEQ CODE=(40F0)
INREC OVERLAY=(24:24,34,TRAN=ALTSEQ)
* INCLUDE ANY RECORD WITH NON-NUMERIC VALUES.
OUTFIL FNAMES=T1,INCLUDE=(24,34,FS,NE,NUM)
$
ICE113A E COMPARISON FIELD ERROR
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,DYN*
ALLOC
SORT FIELDS=COPY
ICE052I 3 END OF DFSORT
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
The error message indicates you don't have DFSORT R14 PTF UK90006 (April, 2006) installed. You need the April, 2006 PTF to use NUM. Ask your System Programmer to install that PTF (it's free).