ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Replacing MOVEA with DO statements

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

  • Replacing MOVEA with DO statements

    Hi,
    This is driving me nuts. I have an RPGLE pgm passing 4 parms to be used by 3 arrays
    I have 3 do loops replacing alfa from Zoned to pass back to a calling RPGLE

    1st do loop, works fine until 2nd do loop which is supposed to clear the next array, but it clears the 1st
    Then on the 3rd do loop, it puts all garbage into array1
    I will upload a .doc that shows detail
    Thanks!
    Attached Files

  • #2
    First check the call in the CL program. &LCL should be the first variable in the call. You have placed it last.


    Then in the RPG program check the lines 87-88.
    eval dtea(k) = %editc(hold8:'X');
    eval dtea(k) = %char(hold8);

    The eval in line 88 overwrites what you have done in line 87

    Comment


    • #3
      thanks Peder,
      I added a new attachment so it could format for easier reading
      (I tried formatting in this body, but lost it 3 times, so Word is better)

      Stu
      Attached Files

      Comment


      • #4
        I don't really know where to begin as you haven't shown us the Call, the parameter definitions, the array definitions, or pretty much anything that we would need to help you.

        And beyond that - why on earth do you need a program to do this? To convert char to numeric it is simply:
        Code:
        dcl-s  num  packed(7:2);
        dcl-s  char  char(6);
        
        num = %Dec(char);
        I'd really like to help but need information.

        Comment


        • #5
          In my original attachment, I included the call:
          DCL VAR(&LCL) TYPE(*CHAR) LEN(5)
          DCL VAR(&DTEA) TYPE(*CHAR) LEN(1608)
          DCL VAR(&ENMA) TYPE(*CHAR) LEN(2412)
          DCL VAR(&LSDA) TYPE(*CHAR) LEN(500)

          OVRDBF FILE(LIMITS) TOFILE(STUART/STLIMITS3)

          CALL PGM(GETLIMITR) PARM(&DTEA &ENMA &LSDA &LCL)


          Sent empty return data
          Called from RPGLE and then used arrays there

          d dtea_ like(dtea) dim(201) ( 8 * 201 = 1608 )
          d enma_ like(enma) dim(201) ( 12 * 201 = 2412 )
          d lsda_ l ike(lsda) dim(100) ( 5 * 100 = 500 )

          I would like to use %dec, but that's why I use the do loops,
          It would be simple to to a movea, but that does not work dec to char
          I can't send back just a single packed field

          Thanks anyway
          Stu

          Comment


          • #6
            I'm still baffled. You say you are converting to numeric (which an eval by itself won't do) from alpha. But ALL your parms are defined as alpha - there's no numerics there!

            Can you try and spell out in simple English what you are trying to do. Forget the MOVEA stuff etc. Right now you are passing in character fields and moving them a bit at a time to another character field. The most likely cause of errors is that the strings are not as long as you say.

            Just explain simply the task and we'll then know how to code it.

            Comment


            • #7
              I thought it was clear
              the 3 arrays are defined as numeric, changing back to char to pass back to calling pgm
              sorry, can't get clearer than that
              unless you can send back numeric parms of that large size
              it always worked fine until I added the one new 5 char field LCL

              Attached Files

              Comment


              • #8
                Leaving aside the whole numeric to character thing, if it worked fine until you added the new parameter, then I would suggest changing both programs to make the new prameter the last one instead of the first one and see if that helps. My guess is that there is some parameter mismatching going on, like when Peder pointed out that it was first in one program and last in the other.

                Comment

                Working...
                X