Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Hi,
"CALL" concept is same for both PL/I and COBOL. Like in COBOL, PL/I has static and dynamic call. Static call is directly calling by giving the subroutine name or entry name.
EX:-
M: PROC OPTIONS(MAIN);
DCL A,B FIXED DEC(5,2);
CALL SUB(A,B);
PUT LIST (A,B);
SUB: PROC (X,Y);
DCL X,Y FIXED DEC(5,2);
Y=X+100;
END SUB;
END M;
In Dynamic call, a variable is used in CALL and in run time , the name of the subroutine is given as input.
EX:-
M: PROC OPTIONS(MAIN);
DCL A,B FIXED DEC(5,2);
DCL EV ENTRY VARIABLE, SUB1 ENTRY, SUB2 ENTRY;
GET LIST(EV);
CALL EV(A,B);
PUT LIST (A,B);
END M;
SUB1: PROC (X,Y);
DCL X,Y FIXED DEC(5,2);
Y=X+100;
END SUB1;
SUB2: PROC (X1,Y1);
DCL X1,Y1 FIXED DEC(5,2);
Y1=X1-100;
END SUB2;
Do correct me for any mistake(s).
Thanks!
Sridevi |
|