After receiving a few questions related to the usefulness of the LE formatted dumps (CEE5DMP) for PL/I VSE/ESA programs I thought it would be a good subject for a blog entry.
Over the years I have had a number of PL/I for VSE/ESA users comment on the lack of a formatted variable and contents section in a CEE5DMP dump produced in response to an application failure. This is in contrast to COBOL/VSE and C/VSE programs that will include a formatted variable and contents dump in any CEE5DMP dump produced when the application has been compiled with the required options and an application unhandled abend occurs.
Noting the lack of a formatted variable dump I can inform readers that there is a method available for PL/I for VSE/ESA users that will provide a basic formatted variable and contents dump when an application abend occurs. There are a few ways in which to implement this but I will just focus on the version that requires modification of the application program.
PL/I for VSE/ESA has some very good condition handling capabilities. To ensure that a formatted variable and contents dump is produced whenever an application abend occurs we need to insert a "system" handle that will gain control prior to an abend. In this handler procedure we can add the required code that will then produce the variable and contents dump we are after.
For example. In the following code section we establish an "ON UNIT" for any system error condition. Once triggered, we call the LE z/VSE PLIDUMP service to produce a Traceback ("T") report with a title indicting the traceback report was initiated by our "On Unit". Next, we print out (to "SYSLST") a simple title line to say that what will be following is a formatted variable and contents dump. We then issue the "Put Data;" directive which is what requests the LE PL/1 run-time to produce the variable and contents dump for us. Once this is complete we printout a blank line and then jump (via a "Goto") to the label "Complete" so as to exit the condition handling procedure. The "Complete" label simply allows a "normal" return to the operating system. It would be unwise to attempt to continue execution without first establishing what the error was and if it was a recoverable type.
On error system;
Call PLIDUMP('T','PLIDUMP called from error ON-unit');
Put Skip List (' Variable contents follow : ');
Put Skip List (' ');
Put Data; /* Display variables */
Put Skip List (' ');
Display ('Program Complete');
A few points to remember. Variables that contain invalid data for their definition type will be displayed as empty. They will also not have an "=" sign included. Variables that contain data that does conform to the definition type will be reported with both an "=" sign and the contents of that variable.
Given the following variable definitions in the above PL/I for VSE/ESA program :
DCL CL4 char(4) init('ABCD');
DCL GD7 Fixed Decimal(7) init(12345);
DCL FD7 Fixed Decimal(7) Based(Addr(CL4));
When the above "On Unit" procedure is executed, the resultant output in SYSLST will be :
Variable contents follow :
FD7 GD7= 12345 CL4='ABCD'
The contents of "FD7" are invalid (C"ABCD") for the definition type (fixed decimal) so the "=" and contents are missing. However variables GD7 and CL4 are both valid for their definition types so their contents are clearly displayed.