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

Help for SORTing data in a JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
santhoshm

New User


Joined: 13 Jun 2007
Posts: 32
Location: chennai

PostPosted: Wed Oct 17, 2012 3:28 pm
Reply with quote

Hi,
I have an input file with data as below

abc AA GROSS
abc 16 GROSS
abc BH GROSS
abc 72 GROSS
abc 68 GROSS
abc 24 NET

I will need output like below
abc 16 GROSS
abc 68 GROSS
abc 72 GROSS
abc AA GROSS
abc BH GROSS
abc 24 NET

I have used SORT FIELDS=(8,5,CH,A,5,2,CH,A) but I got result like below.
abc AA GROSS
abc BH GROSS
abc 16 GROSS
abc 68 GROSS
abc 72 GROSS
abc 24 NET

Is there anyway we can get the desired results using SORT fiels ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 17, 2012 4:10 pm
Reply with quote

Perhaps if you explain clearly the order that you want. You want to Sort on GROSS/NET, then numbers followed by alphas?
Back to top
View user's profile Send private message
santhoshm

New User


Joined: 13 Jun 2007
Posts: 32
Location: chennai

PostPosted: Wed Oct 17, 2012 4:21 pm
Reply with quote

Yes. The order is first it should sort by GROSS/NET and then field at 4th position of 2 characters.
Back to top
View user's profile Send private message
santhoshm

New User


Joined: 13 Jun 2007
Posts: 32
Location: chennai

PostPosted: Wed Oct 17, 2012 4:22 pm
Reply with quote

Sorry 2nd order position starts at 5th with 2 bytes.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 17, 2012 4:27 pm
Reply with quote

look at the sort manuals on how to define an alternate character sequence
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Oct 17, 2012 4:28 pm
Reply with quote

It looks like you are expecting SORT to be based on ASCII rather than EBCDIC, so I'd suggest you look at ALTSEQ processing.

Garry. icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 17, 2012 4:30 pm
Reply with quote

Consult your documentation. Look in the index for "collating sequence". In DFSORT ALTSEQ is your answer. With that you could change all the numbers, for the purpose of the sequencing only (not changing the data itself) to hex-values "lower" than "A".

EDIT: It seems we all agree :-)
Back to top
View user's profile Send private message
santhoshm

New User


Joined: 13 Jun 2007
Posts: 32
Location: chennai

PostPosted: Wed Oct 17, 2012 5:22 pm
Reply with quote

Thank you all very much for your idea..

It worked with follwoing SORT card:

SORT FIELDS=(8,3,CH,A,5,2,AQ,A)
ALTSEQ CODE=(F0A0,F1A1,F2A2,F3A3,F4A4,F5A5,F6A6,F7A7,F8A8,F9A9)
SUM FIELDS=NONE
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 17, 2012 5:42 pm
Reply with quote

Thanks for letting us know. Now you've done your research and tested it, it is probably best to go with what Garry suggested if EBCDIC to ASCII is available (in ASCII the numbers come before the letters, and they even "mess around" with lower-case :-) ).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 17, 2012 5:53 pm
Reply with quote

why not try with the AC format , the ASCII sequence ?
special chars
numbers
lower case
upper case
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top