MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sorting a table ??

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Chandru
Beginner


Joined: 18 May 2004
Posts: 6
Topics: 6

PostPosted: Thu Jul 01, 2004 9:52 am    Post subject: sorting a table ?? Reply with quote

Hi friends,

Is there any easiest method to sort a table? Help me .


chandru.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Jul 01, 2004 10:10 am    Post subject: Reply with quote

Chandru,

Here is a sample code to sort a table.

Code:

01  W-FEE-TBL.                                         
    02 FEES-TABLE OCCURS 30 TIMES DEPENDING ON T-COUNT.
       03 FEES-REC.                                     
          04 FEE-TYPE       PIC X.                     
          04 FILLER         PIC X.                     
          04 FEE-BAL        PIC 9(05)V99.       
       
01 W-SUB                        PIC S9(9) COMP. 
01 W-SUB1                       PIC S9(9) COMP. 
01 W-SUB2                       PIC S9(9) COMP. 
01 W-TMP-REC                    PIC X(09).       
01 T-COUNT                      PIC S9(9) COMP. 

PROCEDURE DIVISION.

      PERFORM VARYING W-SUB1 FROM 1 BY 1 UNTIL W-SUB1 >= T-COUNT
         PERFORM VARYING W-SUB2 FROM T-COUNT BY -1             
           UNTIL W-SUB2 <= W-SUB1                               
           EVALUATE TRUE                                       
               WHEN FEE-TYPE (W-SUB2) < FEE-TYPE (W-SUB2 - 1)   
                    MOVE FEES-REC (W-SUB2) TO W-TMP-REC         
                    MOVE FEES-REC (W-SUB2 - 1) TO               
                         FEES-REC (W-SUB2)                     
                    MOVE W-TMP-REC TO FEES-REC (W-SUB2 - 1)     
               WHEN FEE-TYPE (W-SUB2) > FEE-TYPE (W-SUB2 - 1)   
                    CONTINUE                                   
           END-EVALUATE                                         
         END-PERFORM                                           
      END-PERFORM                                               
      .
                                                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group