Where is the WORKAREA acquired from when using FILE EXIT within a CA Easytrieve program?
search cancel

Where is the WORKAREA acquired from when using FILE EXIT within a CA Easytrieve program?

book

Article ID: 54202

calendar_today

Updated On:

Products

PanAudit Plus Easytrieve Report Generator PAN/SQL Endevor Endevor Natural Integration Endevor - ECLIPSE Plugin Endevor - Enterprise Workbench

Issue/Introduction

Solution:

All the addressed areas for the FILE EXIT are acquired by the Easytrieve runtime automatically by the GETMAIN macro and the addresses passed to the user file exit program. All addressed areas can not be acquired within a user-exit-program by the DEFINE-macro.

The FILE EXIT statement with MODIFY specified in the FILE....EXIT statement, passes the address of the record and the address of the required WORKAREA.
The only time EZT+ will perform the i/o is when MODIFY is specified in the exit. Code WORKAREA in the EXIT statement as mentioned in the manual where it states 'For MODIFY exits (subparameter of the FILE statement), the required 2 parameters are record area address and work area address because the exit receives all records after input and before output.'
If code the MODIFY subparameter on the FILE EXIT statement, CA-Easytrieve performs the I/O. The user file exit should examine the record and convert it into the correct form. On an input operation, CA-Easytrieve reads the record, then passes it to user MODIFY file exit to be reformatted. On an output operation, CA-Easytrieve passes the record to your exit to be reformatted. When the user exit finishes, CA-Easytrieve writes the reformatted record to the file. The prototype for user's MODIFY file exit as sample in C should look like this:

unsigned long YRMDEXIT(
void * pRecordArea,
void * pWorkArea,
unsigned long cbRecordLength,
unsigned long * pcbWorkAreaLength,
void * * pExitArgList
);
where:
pRecord points to the record buffer. The record to be reformatted is in this buffer.
pWorkArea points to a buffer. The record from pRecord must be reformatted and placed in this buffer.
cbRecord is the length of the record at pRecord.
pcbWorkArea points to the length of pWorkArea s buffer. When your exit has placed the reformatted in the buffer, it must place the length of the reformatted record at this field.
pExitArgList Is the pointer to the array of pointers to the fields in the USING list of the EXIT phrase. The pointers are ordered as the fields in the USING list are ordered.

Environment

Release: EDBMSU00200-6.4-Easytrieve-Report Generator-Option for DB2-MSU
Component: