ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Decimal data error on passed parms

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Decimal data error on passed parms

    Hi,
    I got myself a real head-scratcher here.

    I have an RPG that calls another RPG with 4 parms: 4/8/4,0/3,0.
    In the second program all these parms make a key and when that program does it's first chain using this key, I get a decimal data error, on both numeric fields.

    I have checked the parms in debug mode and they are all correct in the calling program and then when the call to the second program is made (still in debug) and I check the parms, both numeric fields have invalid decimal data in them!!

    How can this be?
    Everyday's a school day, what grade are you in?

  • #2
    Re: Decimal data error on passed parms

    I know I'm gonna start a fight here.....


    Make incoming decimal parms 15,5
    then move them to proper size fields once in program...

    I know pass HEX... Ummmmm NO!

    jamie

    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Decimal data error on passed parms

      Can we see the prototypes of both caller and callee ?
      Philippe

      Comment


      • #4
        Re: Decimal data error on passed parms

        Jamie,
        2 things;
        1- I do not understand your 15,5 reasoning. I'm not a seasoned veteran of millions of programs but I have been around for quite a while and have never had this problem, nor have I ever done what you suggest.

        2- The time out feature is driving me nuts. I posted then, received an email that you responded, came back to the page, hit refresh so I could see your response, saw it, hit reply and was told I wasn't signed in...
        Everyday's a school day, what grade are you in?

        Comment


        • #5
          Re: Decimal data error on passed parms

          I do it always I can call from command line without using HEX.. Just as a thought check the key order in ("Klist") against logical you are using are they Outta Order?

          PHP Code:
            //                                         
            //  entry plist                            
            //                                         
          d ARC16           pr                         
          d  insales
          #                     15  5        
                                                       
          d ARC16           pi                         
          d  insales
          #                     15  5 

          Are you checking the box to keep me signed in????

          anyone else having issues?

          Jamie
          Attached Files
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: Decimal data error on passed parms

            Apparently not.
            Where is this check box you speak of, settings, profile, I did not see anything at the sign in page.
            (Sorry to be a pita.)
            Everyday's a school day, what grade are you in?

            Comment


            • #7
              Re: Decimal data error on passed parms

              Originally posted by redvan
              Hi,
              I got myself a real head-scratcher here.

              I have an RPG that calls another RPG with 4 parms: 4/8/4,0/3,0.
              In the second program all these parms make a key and when that program does it's first chain using this key, I get a decimal data error, on both numeric fields.

              I have checked the parms in debug mode and they are all correct in the calling program and then when the call to the second program is made (still in debug) and I check the parms, both numeric fields have invalid decimal data in them!!

              How can this be?
              The caller has the field defined as zoned - the other as packed.

              Comment


              • #8
                Re: Decimal data error on passed parms

                You are correct in that statement sir.
                What do I need to do to correct this? (In your opinion.)
                Everyday's a school day, what grade are you in?

                Comment


                • #9
                  Re: Decimal data error on passed parms

                  redvan -- Look at the image on my above post...

                  Jon -- You can give me a stern talking to at the conference


                  jamie
                  All my answers were extracted from the "Big Dummy's Guide to the As400"
                  and I take no responsibility for any of them.

                  www.code400.com

                  Comment


                  • #10
                    Re: Decimal data error on passed parms

                    Yes Jamie,
                    I saw your image but I still don't get it and I checked, the fields are not out of order. I tried to check all the obvious stuff before bothering these people. What I don't get is, this was all working fine. I added some other code, in a different part of the process and when I tried to test that code, this issue arose. I double checked and nothing I added changed the attributes of the fields in question from the calling pgm and as for the called pgm, I didn't touch it. Besides, the fields being passed are read from a file, they're not work fields where there may have been a possibility that I accidently changed the attributes. So why did tjis work before and not now?
                    Everyday's a school day, what grade are you in?

                    Comment


                    • #11
                      Re: Decimal data error on passed parms

                      One more thing, in the calling pgm, should I move the numerics to a 15,5 field then call the other pgm which also has these numeric fields defined as 15,5, then move them to what they should be?
                      Everyday's a school day, what grade are you in?

                      Comment


                      • #12
                        Re: Decimal data error on passed parms

                        Id hold off the 15,5 thing a second... Was Jon correct about the zoned and packed?
                        did you add a datastructure with the parms in it?

                        data structure default to signed...

                        If so INZ the data structure...

                        PHP Code:
                        d arclda          ds                  dtaara(*LDAqualified inz 
                        d  Type                   1      2                               
                        d  Month                  3      4  0                            
                        d  Year                   5      6  0                            
                        d  PrintBySalesP          7      7                               
                        d  InsideOrOut            8      8                               
                        d  salesperson            9     11  0                            
                        d  ByCustomer            12     12                               
                        d  Customer              13     17  0                            
                        d  MinSales              18     24  0                            
                        d  WeightsOnly           25     25                               
                        d  Affiliates            26     26                               
                        d  DateType              27     27                               
                        d  EmailPDF              28     28 
                        these are all guesses cause we cant see your code...

                        jamie
                        All my answers were extracted from the "Big Dummy's Guide to the As400"
                        and I take no responsibility for any of them.

                        www.code400.com

                        Comment


                        • #13
                          Re: Decimal data error on passed parms

                          Originally posted by redvan View Post
                          You are correct in that statement sir.
                          What do I need to do to correct this? (In your opinion.)
                          Personally I would do it by prototyping the call and using the CONST keyword on the parameters in question. This will not work if the called program changes the values of the parameters.

                          If you can't/won't do that then either change the definition in the called program to match - or - create temporary fields of the correct type/size in the caller and copy the data in. If using the old-style CALL/PARM structure then you can use the Result field and Factors 1 and 2 to do this semi-automagically.

                          Comment


                          • #14
                            Re: Decimal data error on passed parms

                            Well, too late.
                            While waiting I made the change and that one pgm that was bombing now works but the other 8 that get called afterwards at various points in the application now bomb.

                            You are good, yes, I did add a DS, that was the new code I spoke of.
                            So that is where I shot myself in the foot, the DS changes the attributes of it's fields to zoned?
                            Everyday's a school day, what grade are you in?

                            Comment


                            • #15
                              Re: Decimal data error on passed parms

                              Originally posted by redvan View Post
                              Well, too late.
                              While waiting I made the change and that one pgm that was bombing now works but the other 8 that get called afterwards at various points in the application now bomb.

                              You are good, yes, I did add a DS, that was the new code I spoke of.
                              So that is where I shot myself in the foot, the DS changes the attributes of it's fields to zoned?
                              The field in the DS will be defined as Zoned unless you specify P on the definition. So the DS should be like this:
                              Code:
                              D myDS       DS 
                              D   aPackedNum                                  7p 2 
                              D   aZonedNum                                   7  2

                              Comment

                              Working...
                              X