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

Can we sort the records based on the record length.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Markandeyulu

New User


Joined: 27 May 2010
Posts: 10
Location: Chennai

PostPosted: Wed Nov 10, 2010 1:59 pm
Reply with quote

Hi,

Can we sort the records based on the record length?

For example:

In my input -

Code:
abcdefghijklmnopqrstuvwxyz
abcdefghijklmno 1 111
abcdefghijklmnopqrstu
abcdefghijklmnopqrstu12345
abcdefghijkl


So the above mentioned records should be sorted based on the length, i.e. the output should be like:

Code:
abcdefghijkl
abcdefghijklmnopqrstu
abcdefghijklmno 1 111
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstu12345


Please suggest me with the solution. Thanks in advance.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 10, 2010 2:13 pm
Reply with quote

If the file is a VB file, very easily as bytes 1-2 of a VB file is the binary record length.

If it is a FB file, I can only think of converting to a VB file and then sorting as above.

But, I am sure that if it can be done any easier then the DFSORT guys will show us how icon_smile.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 10, 2010 10:39 pm
Reply with quote

Markandeyulu,

As expat mentioned you can sort on the first 2 bytes of RDW if the input file is a VB File. If the file is FB then you need to convert to vb and strip off the trailing blanks and then sort.

However you output doesn't make sense. take a look at the 2 records below. Both records are of the same length and how did your output has 111 record end up at the bottom? Both records have a length of 21 bytes and the first 15 bytes are the same. For the 111 record the 16th byte is a space and the other record has P. Technically if you sort it ascending , the space record comes first followed by P record.

Code:

----+----1----+----2--
ABCDEFGHIJKLMNO 1 111
ABCDEFGHIJKLMNOPQRSTU


So you need to explain the rules for sorting along with DCB properties of the input and output files.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top