MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting a FLAT file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
koolspark
Beginner


Joined: 27 May 2010
Posts: 29
Topics: 13

PostPosted: Wed Feb 02, 2011 12:34 pm    Post subject: Sorting a FLAT file Reply with quote

hi,

I've unloaded CHAR(10) data from a DB2 table to a flat file, so the file is created with LRECL=10. The db2 table always contails numbers in this column. My unload file looks like,

11111111
33333333
22222222
9999

Remember the last record (9999) is the smallest number among all the input data

I tried sorting the file with all the data types(CH,ZD,BI,PD) in the following sort card, but nothing seemed working.

SORT FIELDS=(1,10,CH,A)

My output file should look like
9999
11111111
22222222
33333333

Please advice.

Thanks,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Feb 02, 2011 12:55 pm    Post subject: Reply with quote

koolspark,

If your data is always numeric then you can use UFF format to sort the numbers which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *           
11111111                   
33333333                   
22222222                   
9999                       
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *           
  SORT FIELDS=(1,10,UFF,A)
//* 

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
koolspark
Beginner


Joined: 27 May 2010
Posts: 29
Topics: 13

PostPosted: Fri Feb 04, 2011 1:13 am    Post subject: Reply with quote

Thank you verymuch kolusu..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group