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
 

 

Help for SORTing data in a JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Help for SORTing data in a JCL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Oct 17, 2012 4:10 pm    Post subject: Reply to: Help for SORTing data in a JCL
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    Post subject: Reply to: Help for SORTing data in a JCL
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    Post subject: Reply to: Help for SORTing data in a JCL
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Oct 17, 2012 4:27 pm    Post subject: Reply to: Help for SORTing data in a JCL
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

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Oct 17, 2012 4:28 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Oct 17, 2012 4:30 pm    Post subject: Reply to: Help for SORTing data in a JCL
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    Post subject: Reply to: Help for SORTing data in a JCL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Oct 17, 2012 5:42 pm    Post subject: Reply to: Help for SORTing data in a JCL
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Oct 17, 2012 5:53 pm    Post subject: Reply to: Help for SORTing data in a JCL
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    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 ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm


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