Page 1 of 1

Tot in trailer3 is giving values in hex

PostPosted: Thu May 05, 2011 1:45 pm
by Swati Gupta
Hi,
I have defined a file in symnames like:-
A,1,2,CH
B,3,1,CH
C,4,6,CH
D_AMT,10,7,PD
Date,17,10,CH
CD,27,1,CH
CD1,27,5,CH
CD2,32,1,CH
R,33,1,CH


File looks like
050475111 Ø|2011-03-290 D
050475111 2011-03-2990000 D
050475110 2011-03-290 D
050475111 Ø(2011-03-2990000 D

i need to total the amount field D_AMT,10,7,PD in trailer3.

i tried making the sum card as:-
SORT FIELDS=(1,2,CH,A,4,6,CH,A,17,10,CH,A)
OUTFIL FNAMES=TEMP01,NODETAIL,REMOVECC,
INCLUDE=((A,EQ,C'05'),AND,
(R,EQ,C'D'),AND,
(CD,EQ,0)),
OUTREC=(132:X),
SECTIONS=(1,2,4,6,17,10,
TRAILER3=(3:C'Trailer ',30:C',',
31:4,6,37:C',',
38:17,10,48:C',',
49:TOT=(10,07,PD,M25,LENGTH=20),71:C',',
72:COUNT=(M25,LENGTH=9)))
OUTFIL FNAMES=TEMP01,NODETAIL,REMOVECC,
INCLUDE=((A,EQ,C'05'),AND,
(R,EQ,C'D'),AND,
(CD1,EQ,90000)),
OUTREC=(132:X),
SECTIONS=(1,2,4,6,17,10,
TRAILER3=(3:C'Trailer1 ',30:C',',
31:4,6,37:C',',
38:17,10,48:C',',
49:TOT=(10,07,PD,M25,LENGTH=20),71:C',',
72:COUNT=(M25,LENGTH=9)))

But its giving output as:-

Trailer ,475110,2011-03-29, 4040404040404 , 1
Trailer1 ,475111,2011-03-29, 4040404040804 , 1


4040404040804 is amount which is coming wrong. It should give correct amount in numeric form.
Can some on guide me to the correct sort card to be used.

Re: Tot in trailer3 is giving values in hex

PostPosted: Thu May 05, 2011 9:41 pm
by skolusu
swati Gupta,

You have several errors in your job.

1. You cannot have a symbol as A
2. CD symbol is defined as a character but on your include cond on OUTFIL you are treating it as a numeric which is not valid.
3. The same is the case with CD1 symbol.
4. You have defined Duplicate OUTFIL FNAMES TEMP01, only the first definition is considered and the second OUTFIL is ignored.
5. Your data seems to be a variable format with as pos 10 thru 16 does not always contain valid packed decimal data.

hex value of 404040 you see is just that you have spaces in the packed decimal field. But I wonder how you got to that far given all the errors I have described.

Enclose the data in code tags like this so that it retains the formatting.

[code]your data here[/code]

Re: Tot in trailer3 is giving values in hex

PostPosted: Fri May 06, 2011 1:57 am
by Frank Yaeger
Swat P,

As Kolusu points out, you have quite a few errors in your job. Here's a version of the DFSORT job that will run to completion and produce output in TEMP01 and TEMP02 providing you have valid PD values in positions 10-16 (which I don't think you do). Whether the output it produces is the output you want, I couldn't say since you haven't told us what's in the input PD fields or what you expect for output.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
AX,1,2,CH
B,3,1,CH
C,4,6,CH
D_AMT,10,7,PD
Date,17,10,CH
CD,27,1,CH
CD1,27,5,CH
CD2,32,1,CH
R,33,1,CH
//SORTIN DD DSN=...  input file
//TEMP01 DD SYSOUT=*
//TEMP02 DD SYSOUT=*
//SYSIN DD *
  SORT FIELDS=(1,2,CH,A,4,6,CH,A,17,10,CH,A)
  OUTFIL FNAMES=TEMP01,NODETAIL,REMOVECC,
    INCLUDE=((AX,EQ,C'05'),AND,
             (R,EQ,C'D'),AND,
             (CD,EQ,C'0')),
      OUTREC=(132:X),
   SECTIONS=(1,2,4,6,17,10,
    TRAILER3=(3:C'Trailer',30:C',',
             31:4,6,37:C',',
             38:17,10,48:C',',
             49:TOT=(10,07,PD,M25,LENGTH=20),71:C',',
             72:COUNT=(M25,LENGTH=9)))
  OUTFIL FNAMES=TEMP02,NODETAIL,REMOVECC,
    INCLUDE=((AX,EQ,C'05'),AND,
             (R,EQ,C'D'),AND,
             (CD1,EQ,C'90000')),
      OUTREC=(132:X),
   SECTIONS=(1,2,4,6,17,10,
    TRAILER3=(3:C'Trailer1',30:C',',
             31:4,6,37:C',',
             38:17,10,48:C',',
             49:TOT=(10,07,PD,M25,LENGTH=20),71:C',',
             72:COUNT=(M25,LENGTH=9)))
/*


As an example, if each input PD value was PL7'1', TEMP01 would have:

  Trailer                    ,475110,2011-03-29,                   4  ,        1
  Trailer                    ,475111,2011-03-29,                   4  ,        1


and TEMP02 would have:

  Trailer1                   ,475111,2011-03-29,                   8  ,        2


Perhaps this will give you an idea of what your job should really look like.

Re: Tot in trailer3 is giving values in hex

PostPosted: Fri May 06, 2011 4:11 pm
by Swati Gupta
Thanks Frank,
The code that you wrote is giving desired results. Also i have created diffrent input file as it seems the file does not contain correct PD values(as it was output of a diffrent program).

Thanks Kolusu,
I will take care of the points you mentioned.