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
 

 

PLI sort within a program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
maks

New User


Joined: 22 Jun 2007
Posts: 7
Location: bangalore

PostPosted: Sat Dec 04, 2010 7:05 pm    Post subject: PLI sort within a program
Reply with quote

Hi,

In my PLI program i am using a table for ex:
dcl 1 table1(200),
2 data1 char(10),
2 data2 fixed dec(9,2),
2 data3 char(20);

i am filling this table with values within the program.
My requirement is that i want to sort data in below order:
data1 ascending,data2 descending.

I read about PLISRT* routine but am not able to figure out how to apply them.
Also if there is anything to sort a table please let me know.
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2433
Location: Netherlands, Amstelveen

PostPosted: Sat Dec 04, 2010 7:20 pm    Post subject:
Reply with quote

PLISRTx is an interface to DFSORT, so you can use all normal sort
statements, something like SORT FIELDS=(1,10,CH,A).
Back to top
View user's profile Send private message
maks

New User


Joined: 22 Jun 2007
Posts: 7
Location: bangalore

PostPosted: Sat Dec 04, 2010 7:30 pm    Post subject:
Reply with quote

Hi,

I believe PLISRT* routines deal with input files and afteer sorting writes them back. Is there anything where i don't have to read or write to a file in jcl.
I just have the table as mentioned and i want the sorted records in same table.

thanks in advance.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Dec 04, 2010 7:46 pm    Post subject: Reply to: PLI sort within a program
Reply with quote

Sounds like you need an equivalent to a COBOL SORT USING/GIVING?

In your applicable PL/I Programming Guide, review builtin sub-routine PLISRTA.

FWIW, sort exits E15 and E35 used together are equivalent to COBOL INPUT and OUTPUT Sort Procedures and they use sub-routine PLISRTD.

You should also review PLISRTB and PLISRTC as well.

As far as sorting a table in-storage and in-place, this may have to be a manual process.

Bill
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1755
Location: Bloomington, IL

PostPosted: Sat Dec 04, 2010 9:11 pm    Post subject:
Reply with quote

If your sort utility is not suitable for your use, here is a link to Wikipedia's "Sorting algorithm" page, which in turn has links to discussions of many specific algorithms, most of which include pseudocode. Pick one and implement it.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1018
Location: Oostende, Belgium

PostPosted: Sun Dec 05, 2010 6:38 am    Post subject:
Reply with quote

Ever thought about reading a manual? Try the Enterprise PL/I for z/OS Programming Guide, Chapter 14. You need PLISRTD.

If you want to code something yourself, I'd suggest you use a Shell sort with intervals of 1, 4, 10, 23, 57, 132, 301 and 701, which are proven to be the best, see the dozens of links on Google for Marcin Ciura Shellsort.
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 -> PL/I & Assembler 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
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
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm


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