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

SORT by two fields in a comma separated variable length file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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: 1702
Location: Australia

PostPosted: Sat May 01, 2010 5:09 pm
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 Developer


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

PostPosted: Mon May 03, 2010 10:42 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top