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
 

 

Sort numeric values stored in character format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 4:53 pm    Post subject: Sort numeric values stored in character format
Reply with quote

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, icon_sad.gif.

Can anyone help me urgently on this. Appreciate your responses. Thanks.
Back to top
View user's profile Send private message

xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Apr 17, 2012 4:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 5:00 pm    Post subject:
Reply with quote

Hi Naveen,

How to get that code tab; the layout of the file is FB, LRECL=1200, PS FILE.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Apr 17, 2012 5:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 5:08 pm    Post subject:
Reply with quote

Do you want me to put the whole text of 1200 length of input record?
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Apr 17, 2012 5:11 pm    Post subject:
Reply with quote

Are you sorting the entire 1200 record length

Quote:
SORT FIELDS=(1,10,CH,A,755,5,ZD,A),


Your sort fields says different. icon_exclaim.gif
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 5:15 pm    Post subject:
Reply with quote

Code:
XYZ0199525       32
XYZ0199525       31
[/code]
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Tue Apr 17, 2012 5:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 5:32 pm    Post subject:
Reply with quote

Hi, Can anyone please help me on this. I need it to get it done asap. Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 17, 2012 5:37 pm    Post subject:
Reply with quote

see what happens when you change the 'type' from CH to UFF?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Apr 17, 2012 5:43 pm    Post subject:
Reply with quote

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
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Tue Apr 17, 2012 5:43 pm    Post subject: Hi Dick
Reply with quote

Kudos, Indeed a perfect reply,I am very thankful to you. My issue is resolved. icon_smile.gif. Thanks one again.

Thank you all for replying on the post. icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Tue Apr 17, 2012 11:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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