Card to SUM the amounts of similar items



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

Re: Card to SUM the amounts of similar items

Postby ghosts » Tue Apr 02, 2013 11:05 am

Hi,
I could not get the desired output yet

I have taken the below record as input
<name>a</name><lname>b</lname><TRNAMT>1.8</TRNAMT>


used the card
//SYSIN    DD *                                               
  INREC IFTHEN=(WHEN=INIT,                                     
  PARSE=(%01=(STARTAFT=C'<name>',ENDBEFR=C'</name>',FIXLEN=02),
     %02=(STARTAFT=C'<lname>',ENDBEFR=C'</lname>',FIXLEN=05),
     %03=(STARTAFT=C'<TRNAMT>',ENDBEFR=C'.',                   
                     ENDBEFR=C'</TRNAMT>',FIXLEN=10),         
     %04=(ENDBEFR=C'</TRNAMT>',FIXLEN=2)),                     
  BUILD=(1,4,%01,%02,%03,JFY=(SHIFT=RIGHT),%04,UFF,EDIT=(TT))),
  IFTHEN=(WHEN=INIT,OVERLAY=(12:12,10,SFF,PD,LENGTH=8))       
  SORT FIELDS=(5,12,CH,A)                                     
/*


Actual output
----+----1----+----2---
  <Ca b             108


But my expected output is
----+----1----+----2---
  <Ca b             180
ghosts
 
Posts: 12
Joined: Fri Mar 22, 2013 5:11 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Re: Card to SUM the amounts of similar items

 

Re: Card to SUM the amounts of similar items

Postby ghosts » Tue Apr 02, 2013 11:51 am

Also consider the below as input and suggest me correct card
//SORTIN   DD *                                         
  <Chnl>a</Chnl><SrvcId>b</SrvcId><TRNAMT>1.8</TRNAMT> 
  <Chnl>a</Chnl><SrvcId>b</SrvcId><TRNAMT>10.8</TRNAMT>
  <Chnl>a</Chnl><SrvcId>b</SrvcId><TRNAMT>100.0</TRNAMT>
  <Chnl>a</Chnl><SrvcId>b</SrvcId><TRNAMT>31.89</TRNAMT>
  <Chnl>a</Chnl><SrvcId>b</SrvcId><TRNAMT>32</TRNAMT>   
/*


output of the above is
  <Ca b       108
  <Ca b      1008
  <Ca b      0000
  <Ca b      3189
  <Ca b      3200
ghosts
 
Posts: 12
Joined: Fri Mar 22, 2013 5:11 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Card to SUM the amounts of similar items

Postby BillyBoyo » Tue Apr 02, 2013 2:53 pm

Well, you only showed two-digit decimals in your sample data. You have also used a fixed-length input file for your latest. You have the incorrect start-position for your numeric.

Note, I "uppercased" everything.

What is the OVERLAY for?

  INREC   IFTHEN=(WHEN=INIT,
                   PARSE=(%01=(STARTAFT=C'<CHNL>',
                               ENDBEFR=C'</CHNL>',
                               FIXLEN=02),
                          %02=(STARTAFT=C'<SRVCID>',
                               ENDBEFR=C'</SRVCID>',
                               FIXLEN=05),
                          %03=(STARTAFT=C'<TRNAMT>',
                               ENDBEFR=C'.',
                               ENDBEFR=C'</TRNAMT>',
                               FIXLEN=10),
                          %04=(ENDBEFR=C'</TRNAMT>',
                               FIXLEN=2)),
                   BUILD=(1,4,%01,%02,
                          %03,JFY=(SHIFT=RIGHT),
                          %04,JFY=(SHIFT=LEFT,
                                   TRAIL=C'00',
                                   LENGTH=2))),
          IFTHEN=(WHEN=INIT,
                   OVERLAY=(11:11,10,UFF,PD,LENGTH=8))
  SORT   FIELDS=(5,12,CH,A)


Output is:

    A B             180
    A B            1080
    A B           10000
    A B            3189
    A B            3200
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Card to SUM the amounts of similar items

Postby skolusu » Tue Apr 02, 2013 10:27 pm

ghosts wrote:Hi,
I could not get the desired output yet

I have taken the below record as input


Ghosts,

I can only read what you present in here. I don't have the ability to look over your shoulder or read your mind. Your earlier sample data did not show examples of single decimal data. So I assumed you either have no decimals or 2 decimal digits. So you need to be clear about what you want.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Card to SUM the amounts of similar items

Postby ghosts » Thu Apr 04, 2013 4:23 pm

skolusu wrote:
ghosts wrote:Hi,
I could not get the desired output yet

I have taken the below record as input


Ghosts,

I can only read what you present in here. I don't have the ability to look over your shoulder or read your mind. Your earlier sample data did not show examples of single decimal data. So I assumed you either have no decimals or 2 decimal digits. So you need to be clear about what you want.


I am not complaining skolusu, ya I admit it is fault from my end, I was just mentioning that I need something else. Don't consider it that way.
ghosts
 
Posts: 12
Joined: Fri Mar 22, 2013 5:11 pm
Has thanked: 2 times
Been thanked: 0 time

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post