Page 1 of 1

Showing in reverse order

PostPosted: Wed Jul 20, 2016 2:28 pm
by arcnazareno
Hi,

Need assistance for the rexx code as I am new to this program.

Below is the code that I have been practicing to create a PDS and put some test data on it.

/* REXX */                                            
 PARSE VALUE DATE('S') WITH CC +2 YY +2 MM +2 DD        
                                                       
 WSDATE = MM||DD||YY                                    
                                                       
     DSNAME = 'XXXX.'||USERID()||'.TEST.D'||WSDATE    
     PDSOUT = DSNAME                                    
     DSE = SYSDSN("'"STRIP(DSNAME)"'")                  
     IF DSE <> 'OK' THEN DO                            
       "ALLOC FI(PDSOUT) DA('"DSNAME"') NEW            
         TRACKS SPACE(10 10) DIR(44)                    
         RECFM(F B) LRECL(80)"
                         
     END                                                
                                                       
     "ALLOC FI(PDSOUT) DA('"DSNAME"(ABCDEF)') SHR"      
     "EXECIO 1 DISKW PDSOUT (FINIS"                
     
     DO X=1 TO 5                                        
        PUSH 'TESTING'|| X                              
     END                                                

     "ALLOC DA('"DSNAME"(ABCDEF)') F(OUTDD) SHR REUSE"  
     "EXECIO 5 DISKW OUTDD (FINIS"                      
     "FREE  FI(PDSOUT)"                                
     "ISPEXEC EDIT DATASET('"DSNAME"(ABCDEF)')"        

 

After executing the program, below is the data written in the PDS.
TESTING5
TESTING4
TESTING3
TESTING4
TESTING1


if I try using display 'SAY' it is showing in proper order where it start from TESTING1 but using PUSH and write into the PDS became reverse as the above. is there a way for me to write in PDS in proper order?
In future use the code tags for all data/code. Done for you this time.

Re: Showing in reverse order

PostPosted: Wed Jul 20, 2016 2:34 pm
by prino
Don't use PUSH, use QUEUE

Re: Showing in reverse order

PostPosted: Wed Jul 20, 2016 3:26 pm
by arcnazareno
Thank you for the quick reply Prino. I tried the QUEUE syntax and is working now. Thank you very much for help