Question & Answer
Question
We're getting branches to strange and unexpected functions in a program loaded by an assembler module, the assembler module itself having been loaded from the LE mainline. It appears that the writeable static (WSA) for the new load module is not being initialized. How should I go about getting the WSA initialized?
Cause
Using the LOAD macro simply returns a pointer to the new executable, and branching through the resulting pointer doesn't switch WSA contexts, leaving the mainline's WSA as the current WSA.
In the absence of the WSA switch, the new executable will use its WSA offsets within the mainline's WSA, leading to strange problems if not outright abends.
Answer
Although the documentation omits mention of it, the CEEFETCH macro returns a pointer to a function descriptor that you can call using CEEPCALL to transfer control to a separately loaded executable AND have the WSA switch take place.
Note that you generally need to avoid calling CEEFETCH more than once for a module. Although reentrant code won't actually be loaded again, it does create a new instance of the module as far as the WSA is concerned. You need to keep a pointer to the returned function descriptor around for as long as you'll be calling the module.
The CEEFETCH documentation notes that "If MF=I or MF=L are specified, you must specify TOKEN" but the macro doesn't generate an MNOTE for it if omitted; CEEBFTCH will 0C4 later on the missing TOKEN.
Related Information
Historical Number
66086.487.000
Was this topic helpful?
Document Information
Modified date:
03 September 2021
UID
isg3T1012049