Arrays in CLIST

USE OF ARRAYS IN CLIST
 

Arrays are not supported by CLIST, but REXX has this option. In case you still want to use arrays in CLIST, find below the work around.

 

SET NUM=1                               
SET &ARRAY = &STR(&&ARRAY)              
DO WHILE &NUM<8                         
SET &ARRAY&NUM=&STR(mainframe&NUM)          
WRITE &ARRAY&NUM                        
SET NUM=&NUM +1                         
END                                     
SET NUM=1                               
DO WHILE &NUM<8                         
WRITE 'OUTSIDE' &ARRAY&NUM              
SET NUM=&NUM +1                         
END                                    

 

Note: Here "mainframe" is used as a literal.