Page 1 of 2

Sort in VB file

PostPosted: Thu Aug 08, 2013 11:30 pm
by pramit
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) ?

Re: Sort in VB file

PostPosted: Thu Aug 08, 2013 11:37 pm
by Akatsukami
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.

Re: Sort in VB file

PostPosted: Thu Aug 08, 2013 11:46 pm
by pramit
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

Re: Sort in VB file

PostPosted: Fri Aug 09, 2013 12:02 am
by Akatsukami
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

Re: Sort in VB file

PostPosted: Fri Aug 09, 2013 12:12 am
by pramit
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?

Re: Sort in VB file

PostPosted: Fri Aug 09, 2013 12:24 am
by Akatsukami
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).

Re: Sort in VB file

PostPosted: Fri Aug 09, 2013 12:30 am
by pramit
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

Re: Sort in VB file

PostPosted: Fri Aug 09, 2013 1:33 am
by dick scherrer
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.

Re: Sort in VB file

PostPosted: Fri Aug 23, 2013 7:10 pm
by pramit
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

Re: Sort in VB file

PostPosted: Fri Aug 23, 2013 7:28 pm
by dick scherrer
Thank you for posting what you found :)

d