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
 

 

Can we sort the records based on the record length.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can we sort the records based on the record length.
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: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 10, 2010 2:13 pm    Post subject:
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    Post subject:
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    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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm


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