Page 1 of 1

Processing Array in Rexx

PostPosted: Tue Nov 29, 2016 11:27 am
by madrista
HI ,
I am beginner in rexx, i need to search a string in data set. for that i have referred the data set using array. but i am unable to search string in the array .
please help me
Thanks in Advance ..

Re: Processing Array in Rexx

PostPosted: Tue Nov 29, 2016 12:43 pm
by BillyBoyo
There are several ways. Surely you've read about some of them in the documentation? Or you've searched here? Or done a bit of search-engineing?

By "array" do you mean a stem variable? What do you mean by "string" in this context? When you say you've "referred the data set using array" you mean you've written one line of code, or more?

Re: Processing Array in Rexx

PostPosted: Tue Nov 29, 2016 2:45 pm
by madrista
Yes i have red the documents but i am unable to get what i want,
yes array mean stem variable im asking about, string is a word in the data set i would like to search.
my code is
"ALLOC F(INFILE) DSN(SAMPLE.REXX.PS) SHR REU"
"EXECIO * DISKR INFILE (FINIS STEM MYFILE.)"
"FREE F(INFILE)"

SO next i would like to search a word from the data set.
please guide me in this regard.
Thank you

Re: Processing Array in Rexx

PostPosted: Tue Nov 29, 2016 7:49 pm
by NicC
Read about the builtin functions especially those beginning WORD but also INDEX and POS.

Re: Processing Array in Rexx

PostPosted: Tue Nov 29, 2016 10:35 pm
by Pedro
I think what you want is to execute the srchfor utility. Normally, this is ISPF option 3.14. You can submit a job similar to this:
//MYPDS  EXEC PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC')
//NEWDD   DD   DISP=SHR,DSN=PEDRO.MY.PDS
//OUTDD   DD   SYSOUT=(H)                        
//SYSIN   DD *                                  
SRCHFOR  'XYZ'                                  
/*                                              

You can also use rexx to allocate the required DD names and invoke the ISRSUPC program.