Procedury

zpět

 

Příklad jednoduché procedury

define variable promenna_1 as character no-undo.
define variable promenna_2 as character no-undo.

procedure Procedura:
    define input parameter promenna_i as character.
    define output parameter promenna_o as character.
    if promenna_i = „aaaaaa“ then
        assign promenna_o = „AAAAAA“.
    else
        assign promenna_o = „ZZZZZZ“.
end. /* procedure Procedura */

 

/* *** 1 **** */
assign promenna_1 = „aaaaaa“.
display promenna_1 promenna_2 with frame a.
┌──────────────────────┐
│ promenna_1 promenna_2│
│──────────────────────│
│aaaaaa                │
└──────────────────────┘

run Procedura(input promenna_1, output promenna_2).

display promenna_1 promenna_2 with frame b.
┌──────────────────────┐
│ promenna_1 promenna_2│
│──────────────────────│
│aaaaaa      AAAAAA    │
└──────────────────────┘

 

/* *** 2 **** */
assign promenna_1 = „bbbbbb“.

display promenna_1 promenna_2 with frame c.
┌──────────────────────┐
│ promenna_1 promenna_2│
│──────────────────────│
bbbbbb     AAAAAA     │
└──────────────────────┘

run Procedura(input promenna_1, output promenna_2).

display promenna_1 promenna_2 with frame d.
┌──────────────────────┐
│ promenna_1 promenna_2│
│──────────────────────│
│bbbbbb     ZZZZZZ     │
└──────────────────────┘

pause.

 

 

 

zpět