Page 2 of 2

Re: Card to SUM the amounts of similar items

PostPosted: Tue Apr 02, 2013 11:05 am
by ghosts
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

Re: Card to SUM the amounts of similar items

PostPosted: Tue Apr 02, 2013 11:51 am
by ghosts
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

Re: Card to SUM the amounts of similar items

PostPosted: Tue Apr 02, 2013 2:53 pm
by BillyBoyo
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

Re: Card to SUM the amounts of similar items

PostPosted: Tue Apr 02, 2013 10:27 pm
by skolusu
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.

Re: Card to SUM the amounts of similar items

PostPosted: Thu Apr 04, 2013 4:23 pm
by ghosts
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.