progress-4gl Procedures INPUT and OUTPUT parameters

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

A procedure can have parameters of different kinds: input, output, input-output (bidirectional) and also some special types like temp-tables and datasets).

In the run statement it's optional to declare INPUT (it's considered default) - all other directions must be specifically declared.

A procedure taking two integers as input and outputting a decimal.

PROCEDURE divideAbyB:
    DEFINE INPUT  PARAMETER piA       AS INTEGER     NO-UNDO.
    DEFINE INPUT  PARAMETER piB       AS INTEGER     NO-UNDO.
    DEFINE OUTPUT PARAMETER pdeResult AS DECIMAL     NO-UNDO.

    pdeResult = piA / piB.

END PROCEDURE.

DEFINE VARIABLE de AS DECIMAL     NO-UNDO.

RUN divideAbyB(10, 2, OUTPUT de).

DISPLAY de. //5.00

Parameters are totally optional. You can mix and match any way you want. The order of the parameters are up to you but it's handy to start with input and end with output - you have to put them in the right order in the run statement and mixing directions can be annoying.



Got any progress-4gl Question?