Edit exit routines and QMF
QMF and your edit exit routine work together to format data by using the edit codes that you define.
Calling your exit routine to format the data
This image shows how a user edit routine works with QMF.
When you enter your own code in a column of FORM.MAIN or FORM.COLUMNS, QMF passes certain characteristics of the data into the first interface control block. These characteristics reside in specific fields of the control block. QMF also passes into the input area the data to be formatted and an output area that holds the formatted result.
Passing information to and from the exit routine
To format the data returned from the database, QMF calls your edit exit routine and passes information through fields of the interface control block. Information is also passed to and from the exit routine using the input and output areas, which contain the data to be formatted and information about where to put the formatted result.
The data to be formatted can be a column value, the result of a built-in function, a defined column, a calculation, or a value represented by a variable in a heading, a footing, or a final-summary line.
- Control information from the interface control block
- The value of ECSINPT, the data from the input area to be formatted
- ECSRSLT, which contains the output area for the formatted result
ECSRSLEN contains the length of the output area. If your formatted result doesn't fit in the output area, it must be truncated because the output area cannot be column-wrapped.
Important: Do not use more memory in the output area than is indicated by the value in the ECSRSLEN field, or you will see error DSQ60439: User edit program memory overwrite. To correct this error, do one of the following:- Increase the width of the column by modifying the edit code in the QMF form to the length expected on the report.
- Code your edit exit program so that it checks the value of the ECSRSLEN field to determine if your program should pad or truncate the results passed back to QMF.
ECSINPT, ECSRSLT, and ECSRSLEN are fields of the interface control block.
Passing control to the exit routine when QMF terminates
Use the ECSRQMF field of the control block to indicate that you want your exit routine to receive control when QMF terminates.
The ECSRQMF value should be updated the first time the edit exit routine receives control.
When your edit exit routine receives control upon termination of QMF, the parameters passed to the routine are the control block, the input area, and the output area. Only the control block contains usable information.