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 by two fields in a comma separated variable length file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sarat6900

New User


Joined: 02 Mar 2009
Posts: 12
Location: India

PostPosted: Sat May 01, 2010 4:33 pm    Post subject: SORT by two fields in a comma separated variable length file
Reply with quote

Hi All,

The fields in my input file are comma separated but can have varying length.

For Eg.
Rec1 : AH,TEST 2222,JHHsss,03/21/2010,9,c
Rec2 : AAA,TESssT aa2222,JHHsss,03/21/2010,5,c
Rec3 : AAA,TESssT ddd2222,JHHsss,03/21/2010,18,c
Rec4 : AAA,TEssST sddd2222,JHHsss,03/21/2010,1,c
Rec5 : AAA,TEssST a2222,JHHsss,03/21/2010,2,c
Rec6 : B11,TEsST ddd2222,JHHsss,03/21/2010,13,c
Rec7 : B11,TEsST ssssss2222,JHHsss,03/21/2010,1,c
Rec8 : B11,TEsST ddsssd2sssssss222,JHHsss,03/21/2010,3,c

I would like to have the input file sorted on field 1(AH on first Rec) and then by the second last field (9 on first Rec)

expected output

Rec1 : AH,TEST 2222,JHHsss,03/21/2010,9,c
Rec4 : AAA,TEssST sddd2222,JHHsss,03/21/2010,1,c
Rec5 : AAA,TEssST a2222,JHHsss,03/21/2010,2,c
Rec2 : AAA,TESssT aa2222,JHHsss,03/21/2010,5,c
Rec3 : AAA,TESssT ddd2222,JHHsss,03/21/2010,18,c
Rec7 : B11,TEsST ssssss2222,JHHsss,03/21/2010,1,c
Rec8 : B11,TEsST ddsssd2sssssss222,JHHsss,03/21/2010,3,c
Rec6 : B11,TEsST ddd2222,JHHsss,03/21/2010,13,c

Can i unstring and sort the file?

Any help is highly appreciated.

Thanks,
Sarat.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat May 01, 2010 5:08 pm    Post subject:
Reply with quote

which codeset are you using to have AH sort before AAA?

Here is a link to DFSORT Tricks Look for: Deconstruct and reconstruct CSV records


Sorry Frank, I could not resist.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat May 01, 2010 5:09 pm    Post subject:
Reply with quote

Hi Sarat,

why is AH in the expected output come before AAA ?

What is the maximum length of any field ?

Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon May 03, 2010 10:42 pm    Post subject:
Reply with quote

Sarat,

Before we can give you a solution, we need more information.

What is the RECFM and LRECL of the input file?

What is the maximum length of field1 (the first key field)?

What is the maximum length of field5 (the second key field)?

In the expected output, why do you show AH before AAA - why wouldn't AAA collate before AH?
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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