Page 2 of 2

Re: Merge two files and sum up the count in a single trailer

PostPosted: Wed Jan 14, 2015 10:22 pm
by gauravnnl
Yes Bill... source of the amount is not known. so I have the only option to use the existIng amount value in both the trailers. However I achieve this with my sort card. See above my input and output trailers.

Now the question is to convert the count and amount value in output trailer in signed byte. In my both input trailers count is 1B and 1E so output trailer count should be 2G.same way amount values in both trailers are 22878Q so output trailer should be 45757O being a -ve value.

I have implemented what u told above and got output but not in signed format..thts the only problem remaining.I got count as 27 and amount as 457576 in place of 2G and 45757O. I hope now I clarified the problem. I apologies if this was not clear in my previous post. If u can look at my above sortcard and suggest smthng to get the exact result pls...thanks.

Re: Merge two files and sum up the count in a single trailer

PostPosted: Wed Jan 14, 2015 10:32 pm
by BillyBoyo
Did you look at the ZDPRINT option? This controls whether a positive value from a SUM appears as an F or a C in the sign, which should get you what you want.
SUM
...
You can use installation option ZDPRINT=YES or run-time option ZDPRINT to
specify that positive zoned decimal fields that result from summing are to be
printable. That is, you can tell DFSORT to change the last digit of the zone from
hex C to hex F.


You are using ZDPRINT you can list the options, if that is not done automatically) and you want to use, for this job, NOZDPRINT.

 OPTION NOZDPRINT

Re: Merge two files and sum up the count in a single trailer

PostPosted: Thu Jan 22, 2015 5:39 pm
by gauravnnl
Sorry for the late reply...Actually it worked with NZDPRINT option . Below is the complete sort card for reference.
   INREC IFTHEN=(WHEN=INIT,                                         
                  OVERLAY=(98:SEQNUM,4,ZD,20C'0')),                 
          IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),               
                               END=(1,1,CH,EQ,C'9'),               
                  PUSH=(97:ID=1)),                                 
          IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),                           
                  OVERLAY=(98:4C'9',18,20))                         
    OPTION NZDPRINT                                                 
    SORT FIELDS=(98,4,CH,A)                                         
    SUM FIELDS=(102,7,ZD,109,13,ZD)                                 
                                                                   
   OUTFIL IFOUTLEN=96,                                             
          OMIT=(1,1,CH,EQ,C'1',AND,97,1,ZD,NE,1),                   
          IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),                           
           OVERLAY=(18:102,20))                                     


Thanks For your suggestion and help .. Cheers!!!