View previous topic :: View next topic
|
Author |
Message |
maks
New User
Joined: 22 Jun 2007 Posts: 7 Location: bangalore
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
maks
New User
Joined: 22 Jun 2007 Posts: 7 Location: bangalore
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
|