Search and Set RC in REXX



IBM's Command List programming language & Restructured Extended Executor

Search and Set RC in REXX

Postby nkulkarni » Fri Oct 16, 2015 2:17 am

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?
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

Re: Search and Set RC in REXX

Postby enrico-sorichetti » Fri Oct 16, 2015 2:27 am

why not use the ISPF srchfor ?
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Search and Set RC in REXX

Postby nkulkarni » Fri Oct 16, 2015 2:34 am

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...
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time

Re: Search and Set RC in REXX

Postby enrico-sorichetti » Fri Oct 16, 2015 3:14 am

what would it be impossible to test for 0 or 1 instead of 999 and 888 ?
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
nkulkarni (Fri Oct 16, 2015 9:27 pm)
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Search and Set RC in REXX

Postby prino » Fri Oct 16, 2015 10:09 am

You miss the point Enrico, the requirements are 888 and 999! :? :mrgreen:
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Search and Set RC in REXX

Postby nkulkarni » Fri Oct 16, 2015 9:26 pm

lol :D
NK
nkulkarni
 
Posts: 52
Joined: Mon Sep 28, 2015 2:28 pm
Has thanked: 17 times
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post