Showing posts with label Sorting in REXX. Show all posts
Showing posts with label Sorting in REXX. Show all posts

Saturday, August 13, 2016

Sorting in REXX

The following sort can be used to sort a Stem. In this algorithm, Stem_Variable is the stem.

 I = COUNT                                                                      
 DO UNTIL I < 2                                                                 
    NEWI = 1                                                                    
    DO J = 1 UNTIL J >= I-1                                                     
       K = J + 1                                                                
       IF Stem_Variable.J > Stem_Variable.K THEN                                  
       DO                                                                       
          SWAP            = Stem_Variable.K                                      
          Stem_Variable.K = Stem_Variable.J                                      
          Stem_Variable.J = SWAP                                               
          NEWI = J                                                              
       END                                                                      
    END                                                                         
    I = NEWI                                                                    
 END                             

Featured Post

REXX Skeleton: Submitting jobs through Rexx

Submitting jobs through REXX and reading the spool through REXX gives us immense potential to automate many manual activities in mainframes....