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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm


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