The following example shows how contexts can be used for avoiding name conflicts and for controlled resolution of external references.
A program stored as an element with the name PROG in a program library is called. DBL generates the default link concept LOCAL#DEFAULT for resolution of external references.
/START-EXECUTABLE-PROGRAM FROM-FILE=(LIBRARY=...,ELEMENT-OR-SYMBOL=PROG)
Result
During program execution, PROG calls the BIND macro in order to activate a PASCAL subroutine.
BIND SYMBOL=PASSUB,LIBNAM=...
Result
Subsequently, PROG calls the subroutine CSUB, which is written in a different programming language (in C) than that used for PASSUB but also uses runtime routines called x and y. In order to avoid name conflicts, the BIND macro must be called as follows:
BIND SYMBOL=CSUB,LIBNAM=...,...,LNCTX=CSUBCTX
Result
A further subroutine, which is also written in C and which, among other things, contains an external reference to ENTRY A in the main program PROG is called. External reference V(A) is to be resolved with ENTRY A in PROG, while other external references are to be resolved by the runtime routines written in C. For this reason, PROG must call the subroutine CSUB2 as follows:
BIND SYMBOL=CSUB2,LIBNAM=...,...,LNKCTX=CSUBCTX,REFCTX=LOCAL#DEFAULT
Result