View previous topic :: View next topic
|
Author |
Message |
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Hi All,
Could you please help me in sorting using JCL. My requirement is, I have to sort the records based on the record numbers. The record numbers are presently in decreasing order like 30, 29,... upto 1. Now I want it o be in increasing order like 1,2,...30. Problem here is the record numbers are stored in char format.
I am using the below format in sysin of SORT JCL:
SORT FIELDS=(1,10,CH,A,755,5,CH,A) but it does sortin in following order
1
10
11
12
13
14
15
16
17
18
19
2
20
.
.
I also tried using SORT FIELDS=(1,10,CH,A,755,5,ZD,A), but of no use, .
Can anyone help me urgently on this. Appreciate your responses. Thanks. |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Hello,
Can you post the input file layout with the code tags.
Note: There is a code tab availiable, where you type the text, use it for better layout understanding. |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Hi Naveen,
How to get that code tab; the layout of the file is FB, LRECL=1200, PS FILE. |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Hello,
Copy the text of test input record & Paste it here, then look for tab Code beneath the Quick Reply, select the text which you want to tag it, then click the Code tab. Preview & Submit it.
Without seeing your test input record it is hard to assume. |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Do you want me to put the whole text of 1200 length of input record? |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Are you sorting the entire 1200 record length
Quote: |
SORT FIELDS=(1,10,CH,A,755,5,ZD,A), |
Your sort fields says different. |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Code: |
XYZ0199525 32
XYZ0199525 31 |
[/code] |
|
Back to top |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
I can see what the OP wants to do. The lower numbers, ie; <10, are represented as "1 ", "2 ", etc.
Thus when sorting, "10" comes before "2 ", which is not what is required.
Not sure what the solution is though. Sort is not my speciality. |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Hi, Can anyone please help me on this. I need it to get it done asap. Thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
see what happens when you change the 'type' from CH to UFF? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
this is an example of what you need
Code: |
//SORT1 EXEC PGM=SORT
//SORTIN DD *
1000000001
1
10
11
12
13
14
15
16
17
18
19
2
20
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,10,UFF,A)
/*
|
Gerry |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Kudos, Indeed a perfect reply,I am very thankful to you. My issue is resolved. . Thanks one again.
Thank you all for replying on the post. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Glad you got it working but it was NOT JCL that sorted it (your first post) but the sort program. Indeed, in the whole topic, the only JCL is in Gerry's solution. |
|
Back to top |
|
|
|