Sort in VB file



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Sort in VB file

Postby pramit » Thu Aug 08, 2013 11:30 pm

Dear All,

I have two questions, kindly help me to resolve.
We know in case of VB, we have to start from position 5.( 4 for offset)
SORT FIELDS=(5,15,CH,A) where 15 is the length and 5 is the start position

1. Now if i will start from position 1 in VB, SORT FIELDS=(1,15,CH,A), what will happen?
2. Now if i put SORT FIELDS=(1,19,CH,A), what will happen?
3. Is it same ? SORT FIELDS=(1,19,CH,A) and (5,15,CH,A) ?
pramit
 
Posts: 5
Joined: Thu Aug 08, 2013 11:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort in VB file

 

Re: Sort in VB file

Postby Akatsukami » Thu Aug 08, 2013 11:37 pm

Specifying position 1 for a VB data set sorts on record length (and on start and stop flags in the case of a VBS data set). It is not equivalent to sorting on anything else.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Sort in VB file

Postby pramit » Thu Aug 08, 2013 11:46 pm

Akatsukami wrote:Specifying position 1 for a VB data set sorts on record length (and on start and stop flags in the case of a VBS data set). It is not equivalent to sorting on anything else.


thnx a lot. If it is not VBS dataset means it is just VB and all the records present there ( say upto 100 record length), then the VB file will be as it is means it will not be sorted. Am i right?

Just an overview of an example

position
1.........................100
abccccccccccccccccccccccc
cbbbbbbbbbcbbbbbcbbbbc
aaaaasssssssssssssssssss
pramit
 
Posts: 5
Joined: Thu Aug 08, 2013 11:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort in VB file

Postby Akatsukami » Fri Aug 09, 2013 12:02 am

pramit wrote:
Akatsukami wrote:Specifying position 1 for a VB data set sorts on record length (and on start and stop flags in the case of a VBS data set). It is not equivalent to sorting on anything else.


thnx a lot. If it is not VBS dataset means it is just VB and all the records present there ( say upto 100 record length), then the VB file will be as it is means it will not be sorted. Am i right?

Just an overview of an example

position
1.........................100
abccccccccccccccccccccccc
cbbbbbbbbbcbbbbbcbbbbc
aaaaasssssssssssssssssss

As I've said, the records will be sorted by length. Your example would actually look like:
....abccccccccccccccccccccccc
00028888888888888888888888888
00051233333333333333333333333
 ----------------------------
....cbbbbbbbbbcbbbbbcbbbbc   
00028888888888888888888888   
00013222222222322222322223   
 ----------------------------
....aaaaasssssssssssssssssss
000288888AAAAAAAAAAAAAAAAAAA
0004111112222222222222222222

and if sorted on (1,19,CH,A) would sort as:
....cbbbbbbbbbcbbbbbcbbbbc   
00028888888888888888888888   
00013222222222322222322223   
 ----------------------------
....aaaaasssssssssssssssssss
000288888AAAAAAAAAAAAAAAAAAA
0004111112222222222222222222
 ----------------------------
....abccccccccccccccccccccccc
00028888888888888888888888888
00051233333333333333333333333
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Sort in VB file

Postby pramit » Fri Aug 09, 2013 12:12 am

Awesome explanation. Many thanks Akatsukami.
Now say this is the below scenario.
Position
1-----------10
1234567899
9956789542
3456789233

For this case, the sort will not happen if i will mention the start position:1
Could you review pls?
pramit
 
Posts: 5
Joined: Thu Aug 08, 2013 11:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort in VB file

Postby Akatsukami » Fri Aug 09, 2013 12:24 am

As these records are all the same length (characters 1-2 are identical), they will effectively be sorted on the remaining positions (note that you may need the VLSHORT parameter).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Sort in VB file

Postby pramit » Fri Aug 09, 2013 12:30 am

Akatsukami wrote:As these records are all the same length (characters 1-2 are identical), they will effectively be sorted on the remaining positions (note that you may need the VLSHORT parameter).


Thanks :D .But say, I have not used the parameter VLSHORT and I need to know whether it will be sorted or not? Kindly advise.

Take this example. SORT FIELDS = (1, 5, CH, A)

Position.

1-----------10
4356789999
9999567899
1212345678
pramit
 
Posts: 5
Joined: Thu Aug 08, 2013 11:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort in VB file

Postby dick scherrer » Fri Aug 09, 2013 1:33 am

Hello and welcome to the forum,

Rather than guessing and asking for different situations, suggest you run a vew tests on your system and watch happens. You only need a few records and make sure that you look at your input and output in Hex and see what your control statements cause to happen. If there is anything that abends or looks questionable, post here what you tried, the input and the output.

We should be able to clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Sort in VB file

Postby pramit » Fri Aug 23, 2013 7:10 pm

Thanks for your help.
Checked and tested with every example. It really doesn't matter if we start from postion 1 in case of every records lenghth is same, It will be sorted in ascending order.

Position.

1-----------10
4356789999
9999567899
1212345678

for : SORT FIELDS=(1,5,CH,A) and SORT FIELDS=(5,5,CH,A) and for SORT FIELDS=(1,10,CH,A) it gives the same result.

1-----------10
1212345678
4356789999
9999567899
pramit
 
Posts: 5
Joined: Thu Aug 08, 2013 11:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort in VB file

Postby dick scherrer » Fri Aug 23, 2013 7:28 pm

Thank you for posting what you found :)

d
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post