3

I'm trying to call a procedure which is is another file. What I've got so far results in an error:

test.p

DEFINE VARIABLE tmp AS CHARACTER.
      RUN sumWords.p(INPUT "Hello", INPUT "World", OUTPUT tmp).
DISPLAY tmp.

sumWords.p

 PROCEDURE sumWords:
        DEFINE INPUT PARAMETER i_firstWord AS CHARACTER.
        DEFINE INPUT PARAMETER i_secondWord AS CHARACTER.
        DEFINE OUTPUT PARAMETER o_returnWord AS INTEGER. 

        o_returnWord = i_firstWord + i_secondWord.
    END PROCEDURE.

test.p passed parameters to sumWords.p, which didn't expect any. (1005)

sander
  • 1,426
  • 4
  • 19
  • 46

1 Answers1

7

You have created an internal procedure "sumWords" in "sumWords.p". sumWords.p does indeed not expect parameters.

Either change sumWords.p and remove the lines PROCEDURE sumWords: and END PROCEDURE.

That way the sumWords.p expects the parameters.

Or change the caller:

DEFINE VARIABLE hSumWords AS HANDLE NO-UNDO.

RUN sumWords.p PERSISTENT SET hSumWords. 

RUN sumWords IN hSumWords (INPUT "Hello", INPUT "World", OUTPUT tmp).

DELETE OBJECT hSumWords.
Mike Fechner
  • 6,627
  • 15
  • 17