IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL table sort using the SORT command


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 691
Location: Earth

PostPosted: Fri Mar 23, 2007 10:41 am
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: 3156
Location: Tucson AZ

PostPosted: Fri Mar 23, 2007 1:07 pm
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: 691
Location: Earth

PostPosted: Fri Mar 23, 2007 2:34 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Load new table with Old unload - DB2 DB2 6
Search our Forums:

Back to Top