Page 1 of 2

Need Help with a DFSORT issue

PostPosted: Tue Oct 06, 2015 9:56 pm
by zxdalma
Hello all,

Let us have the following control statement :

SORT FIELDS=(1,10,CH,A,26,4,CH,A,23,2,CH,A,20,2,CH,A,
             36,4,CH,A,33,2,CH,A,30,2,CH,A,    --> here is where I have the problem     
             11,2,CH,A,13,2,CH,A,40,1,CH,A)         
OPTION DYNALLOC 


I'd like to know if is is possible to do this sort altering the collating sequence ONLY for some of the positions of the file. These positions are : 36,4,CH,A,33,2,CH,A,30,2,CH,A.

What I need is to do the sort in such a way that character SPACES X'40' is higher than any other alphanumeric character only for fields 36,4,CH,A,33,2,CH,A,30,2,CH,A.

Example :

Input Sample File is :

038555168SITMC     24/04/200702/05/20072
038555168SITMC     08/05/200701/06/20076
038555168SITMC     08/05/2007                  2
038555168SITMC     10/09/200729/11/20072


Output file now I have is :

038555168SITMC     24/04/200702/05/20072
038555168SITMC     08/05/2007                  2
038555168SITMC     08/05/200701/06/20076
038555168SITMC     10/09/200729/11/20072


What I need is :
038555168SITMC     24/04/200702/05/20072
038555168SITMC     08/05/200701/06/20076
038555168SITMC     08/05/2007                  2
038555168SITMC     10/09/200729/11/20072


Code'd

Re: Need Help with a DFSORT issue

PostPosted: Tue Oct 06, 2015 10:34 pm
by BillyBoyo
Locate Altering EBCDIC Collating Sequence—Examples in the DFSORT Application Programming Guide and look at Example 1

 SORT FIELDS=(18,20,AQ,A)
 ALTSEQ CODE=(5BEA)

The character $ (X'5B') is to collate at position X'EA', that is, after uppercase Z
(X'E9').


You should easily be able to arrange what you want from that.

You show your output in the same order as the input. Do you really need to SORT anyway?

Re: Need Help with a DFSORT issue

PostPosted: Tue Oct 06, 2015 10:51 pm
by zxdalma
Thanks for your quick reply.

Yes I do need to SORT; the file excerpts were only shown to make someone understand the problem I'm facing.

I've also consulted DFSORT Application Programming Guiide; and example 1 does not suit my needs; the question I'm posing is altering the collating sequence for ONLY SOME of the SORT arguments without affecting the others.

Is this possible?.

Re: Need Help with a DFSORT issue

PostPosted: Tue Oct 06, 2015 11:06 pm
by BillyBoyo
Humour me, and try it before dismissing it. Change only the fields you want affected from CH to AQ.

Re: Need Help with a DFSORT issue

PostPosted: Tue Oct 06, 2015 11:22 pm
by zxdalma
Hello again, I've tried changing field from CH to AQ and it does not work¡¡¡. As with EBCBIC, in ASCII a blank is lower than any alphanumeric character¡¡; I need the other way round.

Re: Need Help with a DFSORT issue

PostPosted: Wed Oct 07, 2015 1:31 am
by BillyBoyo
Show the code you have tried please. ASCII has nothing directly to do with anything I've mentioned.

Re: Need Help with a DFSORT issue

PostPosted: Wed Oct 07, 2015 3:17 am
by zxdalma
The SYSIN I've tried is as follows :

SORT FIELDS=(1,10,CH,A,26,4,CH,A,23,2,CH,A,20,2,CH,A,
36,4,AQ,A,33,2,AQ,A,30,2,AQ,A,
11,2,CH,A,13,2,CH,A,40,1,CH,A)
OPTION DYNALLOC

Note I've changed the affected fields treatment from CH to AQ.

Re: Need Help with a DFSORT issue

PostPosted: Wed Oct 07, 2015 4:04 am
by Akatsukami
Well, since you neglected -- against Mr. Boyo's explicit recommendation -- to specify ALTSEQ, your failure isn't surprising.

Re: Need Help with a DFSORT issue

PostPosted: Wed Oct 07, 2015 8:35 am
by BillyBoyo
Yes, the example included the ALTSEQ, and the description tells you want it does.

 ALTSEQ CODE=(40FA)


That should sort space (X'40') as higher than the number nine (X'F9') which is what you want, yes? It will only affect fields defined as AQ, you your CH fields are unaffected. Look at OPTION CHALT while you are at it, if you wanted to affect all SORT/MERGE fields without changing from CH.

Re: Need Help with a DFSORT issue

PostPosted: Wed Oct 07, 2015 6:24 pm
by zxdalma
Thanks to BillyBoyo I've solved this issue.

The DFSORT SYSIN is as follows :

SORT FIELDS=(1,10,CH,A,26,4,CH,A,23,2,CH,A,20,2,CH,A,
36,4,AQ,A,33,2,AQ,A,30,2,AQ,A,
11,2,CH,A,13,2,CH,A,40,1,CH,A)
ALTSEQ CODE=(40F9)
OPTION NOCHALT DYNALLOC

Use NOCHALT option to override standard installation defaults in case these were set to CHALT=Y.