by arya_s » Sat Jul 18, 2009 7:27 pm
I don't know what datasets are going to be there.
I need to check if the given pattern "REXX" is present in the Pds names or not.
My O/P file should have all the Pds names having the pattern "REXX"
I am attaching the modified code here which is not running properly.
I am not getting how to get the dataset names that I need for pattern matching.
I am new to REXX and therefore I am not comfortable with all the commands and syntax of REXX.
Any help would be kindly appreciated.
***************************** Top of Data ******************************
/*REXX*/
TRACE C
/*ARG DDNAME . */
/*PULL ADDNAME . */
X = OUTTRAP('NAME.')
"LISTA ST"
/*SAY 'X: ' X
SAY 'NAME.0' NAME.0
SAY 'NAME.1' NAME.1
SAY 'NAME.2' NAME.2
SAY 'NAME.3' NAME.3
SAY 'NAME.4' NAME.4
SAY 'NAME.5' NAME.5 */
FOUND = 'NO'
I = 1
DO WHILE (FOUND = 'NO') & (I <= NAME.0)
/*IF LENGTH(NAME.I) >= 18 THEN
DO */
SAY 'IN FIRST DO WHILE LOOP'
IF SUBSTR(NAME.I,3,7) = 'REXX' THEN
DO
SAY 'REXX FOUND'
FOUND = 'YES'
I = I - 1
/* CONCAT = "'"NAME.I"'"
SAY 'CONCAT: ' NAME.I */
END
ELSE
DO
I = I + 1
END
/* END
ELSE
I = I + 1 */
END
SAY 'FOUND: ' FOUND
IF FOUND = 'YES' THEN
DO WHILE (I + 3) <= NAME.0
I = I + 3
IF SUBSTR(NAME.I,1,3) = ' ' THEN
DO
I = I - 1
/*CONCAT = CONCAT",'"NAME.I"'" */
END
ELSE
I = NAME.0
END
ELSE NOP
/* ALLOCATE THE NEW CONCATENATION TO REXX */
"ALLOC F(REXX) DA('"ADDNAME"',"CONCAT") SHR REUSE"
**************************** Bottom of Data **************************
O/P coming:
6 *-* "LISTA ST"
>>> "LISTA ST"
IN FIRST DO WHILE LOOP
***
IN FIRST DO WHILE LOOP
IN FIRST DO WHILE LOOP
IN FIRST DO WHILE LOOP
FOUND: NO
54 *-* "ALLOC F(REXX) DA('"ADDNAME"',"CONCAT") SHR REUSE"
>>> "ALLOC F(REXX) DA('ADDNAME',CONCAT) SHR REUSE"
+++ RC(12) +++
***