Question: There is an error handling procedure that I need to write up in a module that will be called from other programs bound to the module when there is a program error. This needs to include the statement to take a DUMP. My question is suppose the call to this procedure goes from program A to Module B (to which A is bound through a service program also the Module has the error handler procedure with a Sumo statement), will the Dump work as expected?Should the dump be included in the caller program to get the dump of the correct process? Or would it work if included in the Called procedure?

Answer: 
The DUMP opcode dumps the values for the variables in automatic storage for all the procedures in the module, but the values listed in the dump are only valid if the procedure is active.

So if you want the dump to show the correct values for the automatic variables in the called procedure, you should do the DUMP from the called procedure.
From [the manual](https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/zzdump.htm)

> 
> The DUMP operation provides a dump (all fields, all files, indicators, data structures, arrays, and tables
>  defined) of the module.
> 
> 
> 

So you'd want the DUMP op-code and related error handling in each module involved.

You can't have an error in A and call a procedure in B with the dump op-code.