ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Parameter Passing

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

  • Parameter Passing

    Hi
    i have some list of parameters being passed in and out of modules, i have to pass a zoned parameter to another module, there while receiving those parameters, how could i receive it as zoned??
    since i have already coded, while testing i found a runtime error, saying 'Decimal Data error'. when i checked, the passed value is 20000001 (8S 0) on receiving end the value is 2000.(defined just as 8 0) since we can't define as Zoned at the receiving end!!

    how can this be done!!
    Please help me as soon as possible!!

    Thanks a lot
    Revthy

  • #2
    Use default decimal size

    Always pass decimal parameters with a length of 15,5

    then Z-add them back into the correct size field once in the recieving program.




    K

    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
      i am getting an error
      "Decimal-data error occurred" when module 2 is called from module1
      though i have done as
      z-add the zonned decimal to a variable of 15,5 in Module1 and at the receiving end it is received as 15,5 and Z-added to required zonned standalone variable

      Thanks
      Revthy

      Comment


      • #4
        The entry Plist must b 15,5


        cl program
        Code:
        PGM        PARM(&INDEC15)                               
        DCL        VAR(&INDEC15) TYPE(*DEC) LEN(15) VALUE(5)    
        CALL       PGM(TESTR) PARM(&INDEC15)                    
        ENDPGM
        RPG program
        Code:
        d InDec155        s             15p 5                        
        d WkDecS6         s             06s 0                        
        d WkDecP6         s             06p 0                        
         * ===========================================   
         * M A I N   L I N E                                         
         * ===========================================      
         *                                                           
        c     *Entry        Plist                                    
        c                   Parm                    InDec155         
         *                                                           
        c                   z-add     Indec155      WkDecS6          
        c                   z-add     Indec155      WkDecP6          
         *                                                           
        c                   eval      *INLR = *On
        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


        • #5
          is it possible to have a variables in *Entry Plist to be defined in 'D' spec???
          or should it be defined only in 'Plist Entry Point'

          Comment


          • #6
            well. Jamie
            i am still haveing the same error of 'Decimal Data error'
            but now the there is different in the value!
            The value passed is 20000001 but at the receiving end, the intermediate var has got the value as 02000000.
            can u tell what could be the reason???

            Thanks
            Revthy

            Comment


            • #7
              maybe but hard without the code

              between where the value is equal to 20000001 and 02000000 you are z-adding the field to a 7,0 decimal field then z-adding it back to 8,0 field.

              Other than that I can only guess......



              You have to get parameters set up correctly first. Then direcly after the *Entry plist you must Z-add that 15,5 field to a 8,0 field.

              then only use that 8,0 field in your program. If you want to pass the 8,0 value to another program you have to Z-add back to 15,5 then call program with the 15,5 field...Then start the whole thing over again...


              You can define variables in the D specs or in the program at the C specs....It's now more common to see fields only defined in D Specs.


              good luck
              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


              • #8
                jamieeeeeee
                Really great..Problem solved....... thanks a lotttttts
                now i have to step on to next level where i am expecting many problemssss.
                would catch you later for more doubts....
                Thanks a lot.
                now i have to leave for the day., it is already 9.40pm here
                bye

                Thanksssssssss
                Revathy

                Comment

                Working...
                X