1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | h option (*nodebugio : *srcstmt) * Program Information d ProgStatus sds d Parms *PARMS d ProgName *PROC d ErrMsgID 40 46 d ErrMsg 91 169 d JobName 244 253 d Userid 254 263 d JobNumber 264 269 * Call Stack d FindCaller PR Extpgm ('QWVRCSTK') d 2000a d 10I 0 d 8a CONST d 56a d 8a CONST d 15a * Call Stack Data d Var DS 2000 d BytAvl 10I 0 d BytRtn 10I 0 d Entries 10I 0 d Offset 10I 0 d EntryCount 10I 0 * Call Stack Job Information d JobIdInf DS d JIDQName 26a Inz ('*') d JIDIntID 16a d JIDRes3 2a Inz ( *loval ) d JIDThreadInd 10I 0 Inz (1) d JIDThread 8a Inz ( *loval ) * Call Stack Program Names d Entry DS 256 d EntryLen 10I 0 d ReqstLvl 10I 0 Overlay (Entry:21) d PgmNam 10a Overlay (Entry:25) d PgmLib 10a Overlay (Entry:35) d VarLen s 10I 0 Inz ( %size (Var)) d ApiErr s 15a d Caller s 50a d WhoCalled s 10a d i s 10I 0 /free CallP FindCaller(Var:VarLen:'CSTK0100':JobIdInf :'JIDF0100':ApiErr); For i = 1 to EntryCount; Entry = %subst (Var:Offset + 1); Caller = %trim (PgmLib) + '/' + %trim (PgmNam); If (PgmNam <> ProgName and WhoCalled = *blanks ); WhoCalled = PgmNam; Endif ; Offset = Offset + EntryLen; Endfor ; dsply WhoCalled; *inlr = *on ; Return ; /end-free |
Please note: If you are using an ILE program and making a dynamic call then you will see the same program name twice in the call stack. Dynamic calls to ILE programs always results in a PEP being placed on the call stack corresponding to the ILE HLL used for the module specified on the ENTMOD keyword of the CRTPGM command.
No comments:
Post a Comment
NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.