Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Internal table not sorted even declaared ASEN Key and Index?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri May 21, 2010 11:36 am    Post subject: Internal table not sorted even declaared ASEN Key and Index?
Reply with quote

I have created internal table with some key but it is not sorted based on mentioned key,why it is not sorting?

Code:
1 WS-HOLD-VSAM-TABLE.                                           
   05 WS-SUB1                PIC 9(03) VALUE ZEROS.               
   05 WS-HOLD-DATA-REC OCCURS 1 TO 100 TIMES DEPENDING ON WS-SUB1
                           ASCENDING KEY IS WS-CAPT-DTE-HOLD     
                           INDEXED BY WS-SUB-INDEX.               
       10 WS-ACCOUNT-HOLD     PIC X(34) VALUE SPACES.             
       10 WS-AMOUNT-HOLD      PIC 9(11)V9(2) VALUE ZEROS.         
       10 WS-HLD-SQN-HOLD     PIC 9(05) VALUE ZEROS.             
       10 WS-ITEM-CNTR-HOLD   PIC 9(10) VALUE ZEROS.             
       10 WS-CAPT-DTE-HOLD    PIC 9(08) VALUE ZEROS.             
       10 WS-FLAG-HOLD        PIC X(01) VALUE SPACES. 




    PERFORM VARYING WS-SUB-INDEX FROM 1 BY 1                       
                           UNTIL WS-SUB-INDEX > WS-SUB1           
     SEARCH ALL WS-HOLD-DATA-REC                                                                     
      AT END                                                       
        DISPLAY "DATE NOT FOUND"                                   
      WHEN WS-CAPT-DTE-HOLD(WS-SUB-INDEX) = WS-LEAST-DATE         
                                                                   
        MOVE WS-HLD-SQN-HOLD(WS-SUB-INDEX) TO WS-RTI-HLD-SQN-SAVE 
        MOVE WS-AMOUNT-HOLD(WS-SUB-INDEX)  TO WS-RTI-AMOUNT-SAVE   
        MOVE 'Y' TO WS-FLAG-HOLD(WS-SUB-INDEX)                     
     END-SEARCH                                                   
    END-PERFORM.               

When i tried to use SEARCH ALL i am not getting right date? Because the table is not in sorted order.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri May 21, 2010 4:24 pm    Post subject:
Reply with quote

You DO realize that YOU are responsible for loading the table in ascending key order, right? Merely indicating to COBOL that your table has an ascending key does not cause COBOL to load the table in that order -- it is YOUR responsibility to ensure that the table is loaded correctly.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us