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

PLI sort within a program


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Dec 04, 2010 7:20 pm
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Dec 04, 2010 7:46 pm
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: 1788
Location: Bloomington, IL

PostPosted: Sat Dec 04, 2010 9:11 pm
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: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Dec 05, 2010 6:38 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


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 Using API Gateway from CICS program CICS 0
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top