Page 1 of 1

Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 2:17 am
by nkulkarni
Hi,

Could it be possible to read a file, search for a specific string and set the return code of the step to a user defined value using REXX?

Example, input file ABC.DEF.GHI (flat file with 80 bytes of record length) which may or may not contain a string "REQUEST", read and search this file using REXX for string "REQUEST" and if the string is found then set the return code of the step which is executing the REXX to "999" else to "888".

Is this possible?

Re: Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 2:27 am
by enrico-sorichetti
why not use the ISPF srchfor ?

Re: Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 2:34 am
by nkulkarni
Hi Enrico-Sorichetti,

Thank you for your response.

Could it be possible to set the Return Codes using the ISPF SRCHFOR? If so, Could you please inform how can I achieve that?

If not, then is my below understanding about it correct?

JCL:
//SEARCH EXEC PGM=ISRSUPC,PARM=(SRCHCMP,ANYC)
//NEWDD DD DISP=SHR,DSN=ABC.DEF.GHI
//OUTDD DD DISP=OLD,DSN=ABC.DEF.GHI.OUT
//SYSIN DD *
SRCHFOR 'REQUEST'
//*

JCL will return code 00 when there is no occurrence of the string and 01 when there is at least one occurrence...

Re: Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 3:14 am
by enrico-sorichetti
what would it be impossible to test for 0 or 1 instead of 999 and 888 ?

Re: Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 10:09 am
by prino
You miss the point Enrico, the requirements are 888 and 999! :? :mrgreen:

Re: Search and Set RC in REXX

PostPosted: Fri Oct 16, 2015 9:26 pm
by nkulkarni
lol :D