danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Tue Apr 28, 2009 9:47 am Post subject: PL1 FETCH |
|
|
We have a PL1 program that occassionaly hangs, I tracck down "FETCH PROGRAM" being executed multiple times to be the curplit. Here is the screnro:
Code: |
MainProg: Procedure Option Main;
DCL Prog1 ENTRY (FIXED BIN(15));
.....
FETCH Prog1;
CALL Prog1;
.....
End MainProg;
Prog1: PROC OPTIONS(REENTRANT) REORDER;
....
CALL PROCESS;
......
.......
PROCESS:PROCREC(A,B,C) OPTIONS(BYVALUE);
.....
. .....
CALL ProgA(X,Y,Z);
....
....
End PROCESS;
....
ProgA: PROC(U,V,W) OPTIONS(BYVALUE);
.....
DCL PROG99 ENTRY;
FETCH PROG99; <-- FETCH PROG99 executed multiple times
CALL PROG99(W);
.....
END PROGA;
END Prog1;
|
Once I move "FETCH PROG99" (executed 64 times in my test case) out of internal subroutine ProgA to be executed only once (which it supposed to be) in Prog1, then it works fine. From the language manual:
Code: |
The FETCH statement checks main storage for the named procedures. Procedures not already in main storage are loaded from the disk.
|
If FETCH checks and only loads into memory if the program is not already there, why it does matter if "FETCH" is being executed 1000 times? |
|