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
 

 

COBOL table sort using the SORT command

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

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Mar 23, 2007 10:12 am    Post subject: COBOL table sort using the SORT command
Reply with quote

Hi All,
I am having a COBOL table and I want to use SORT command on it. That's mean I want to use an internal sort for this COBOL table. Is it possible?

For example :
Code:

01 WS-TABLE.
     05 WS-TBL                        OCCURS 10 TIMES.
          10 NAME                       PIC x(20).
          10 AGE                         PIC 9(02).


Now I want to sort it using the SORT command. Can u pls help me out by sending some code-example?

Please help me out.
Back to top
View user's profile Send private message

agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Mar 23, 2007 10:41 am    Post subject:
Reply with quote

There is no SORT command as such to sort a table.
SORT verb in COBOL supports sorting in a file.
For sorting a table you can see sample programs section on this site.
Good luck. icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 23, 2007 1:07 pm    Post subject:
Reply with quote

Yes, you can sort a internal table, but you will still need to define an SD.
Just release your table entries to the sort in the input procedure and recieve them back in the output procedure.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Mar 23, 2007 2:34 pm    Post subject:
Reply with quote

That's incredible! I will try this and tell you about it. icon_smile.gif
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Mar 23, 2007 3:55 pm    Post subject:
Reply with quote

Thanks William! I have got the answer and I have tested it out. Its working. Thanks a lot once again to all of u.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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