Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7314

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: 10354
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

Senior Member


Joined: 08 May 2006
Posts: 1002
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: 7314

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: 7314

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: 10354
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 Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us