Sort sum with a zoned field



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

Sort sum with a zoned field

Postby xcspg3 » Fri Jun 02, 2017 11:36 pm

Hi,
I can't understand how the sum of positive fields gives an unsigned result. Only the sum of negative fields is signed field.

The sysin is
//SYSIN    DD *                  
 SORT FIELDS=(1,125,CH,A)        
 SUM FIELDS=(126,15,ZD)  


The sum of this 3 records is positive and the field is unsigned
                                                   Columns 00069 00140
-7----+----8----+----9----+----0----+----1----+----2----+----3----+----4
062016-05-052015-06-250000-00-00ALTRE     00000000227734F00000000000041C
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFC
062016005005201500602500000000001339500000000000002277346000000000000413
-----------------------------------------------------------------------
062016-05-052015-06-250000-00-00ALTRE     00000000227734F00000000000103B
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFC
062016005005201500602500000000001339500000000000002277346000000000001032
-----------------------------------------------------------------------
062016-05-052015-06-250000-00-00ALTRE     00000000227734F00000000002855E
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFC
062016005005201500602500000000001339500000000000002277346000000000028555


                                                    Columns 00069 00140
-7----+----8----+----9----+----0----+----1----+----2----+----3----+----4
062016-05-052015-06-250000-00-00ALTRE     00000000227734F000000000030000
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFF
062016005005201500602500000000001339500000000000002277346000000000030000
 


The sum of this 2 records is negative and the field is signed
                                                   Columns 00069 00140
-7----+----8----+----9----+----0----+----1----+----2----+----3----+----4
002009-12-102007-10-112009-12-14ALTRE     00000000374109E00000000008442Q
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFD
002009012010200701001120090120141339500000000000003741095000000000084428
-----------------------------------------------------------------------
002009-12-102007-10-112009-12-14ALTRE     00000000374109E00000000009329P
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFD
002009012010200701001120090120141339500000000000003741095000000000093297

                                                    Columns 00069 00140
-7----+----8----+----9----+----0----+----1----+----2----+----3----+----4
002009-12-102007-10-112009-12-14ALTRE     00000000374109E00000000017772N
FFFFFF6FF6FFFFFF6FF6FFFFFF6FF6FFCDEDC44444FFFFFFFFFFFFFFCFFFFFFFFFFFFFFD
002009012010200701001120090120141339500000000000003741095000000000177725
 


Can you help me?
Thanks
xcspg3
 
Posts: 29
Joined: Tue Sep 25, 2007 6:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort sum with a zoned field

Postby Akatsukami » Sat Jun 03, 2017 12:12 am

Try adding a

OPTION NZDPRINT
 

card to your control deck.
"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: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Sort sum with a zoned field

Postby enrico-sorichetti » Sat Jun 03, 2017 12:50 am

review your understanding of negative/positive zoned representation
also remember , the concept of signed/unsigned applies usually ONLY to the binary integer representation
in 32 bits You can represent a 2**31 SIGNED number or a 2**32 UNSIGNED numnber
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Sort sum with a zoned field

Postby xcspg3 » Mon Jun 05, 2017 1:35 pm

Your suggestion is ok
thanks a lot
max
xcspg3
 
Posts: 29
Joined: Tue Sep 25, 2007 6:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort sum with a zoned field

Postby vinayjai » Thu Jun 22, 2017 11:01 pm

Akatsukami wrote:Try adding a

OPTION NZDPRINT
 

card to your control deck.


thanks for this info. But how to fix the same issue with OUTREC instead of sum fields ?

OUTREC FIELDS=(1:1,643,644:361,15,ZD,ADD,391,15,ZD,M11,LENGTH=15) ->>> the value created at 644 having F0 instead of C0
vinayjai
 
Posts: 3
Joined: Thu Jun 22, 2017 10:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort sum with a zoned field

Postby vinayjai » Fri Jun 23, 2017 1:20 am

I resolved the issue usingTO=ZDC:
OUTREC FIELDS=(1:1,643,644:361,15,ZD,ADD,391,15,ZD,TO=ZDC,LENGTH=15)
vinayjai
 
Posts: 3
Joined: Thu Jun 22, 2017 10:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort sum with a zoned field

Postby NicC » Fri Jun 23, 2017 2:02 am

vinayjai - please do not tailgate other peoples topics. In future, start you own topic.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post