LOGEDIT: Log edit user exit (DFSFLGE0 and other LOGEDIT exits)

The log edit exit routine allows you to alter the content of messages in IMS log data. This exit routine may be used to provide additional security by eliminating the logging of sensitive information under limited circumstances.

This topic contains Product-sensitive Programming Interface information.

After the message is edited, the message-related record is then logged. Even though the altered record is logged, IMS processes the original version of the message. After a subsequent restart, IMS processes the edited version of the message. If restart reschedules an edited message, the transaction might fail because of the edits.

Attention: The log edit user exit can potentially damage system information, such as the system segments in a type01 record. Use it only when no alternative exists. Test the routine rigorously before using it in a production environment.

Subsections:

About this routine

You can write a log edit exit routine that is called before each message-related log record is written to the log. The exit overlays segments of the record data with other data. The record types that are presented to the exit are controlled through the LOGEDIT statement in the LOGGER section of the DFSDFxxx PROCLIB member. If you want to use the REFRESH USEREXIT command to add the LOGEDIT user exit, you must have selected log records to edit when IMS initialized. If no records were selected, message DFS4586E is issued and the LOGEDIT user exit is not added.

The user exit cannot directly edit log data. Instead, it returns an offset and length where data is to be changed and the address of a replacement. IMS overwrites the actual record starting at the specified offset for the specified length using the data at the address indicated for replacement data.

The user exit can specify that no alterations are to be made. Or, after specifying an edit, it can indicate that further edits are needed in the same record.

If the offset or length that is specified extends outside the data portion of the record, no editing occurs, and the user exit is notified on the next call. The user exit can assess the situation, but no further editing of the record is allowed. After the user exit returns, it is called for the next record.

This user exit is optional. No default user exit and no samples are provided. The following table shows the attributes of the log edit user exit.

Table 1. Log Edit User Exit Attributes
Attribute Description
IMS environments DB/DC, DBCTL.
Naming convention

You can name this exit routine DFSFLGE0 and link it into a library that is included in the STEPLIB concatenation.

If DFSFLGE0 is linked into a library in the STEPLIB concatenation and the USER_EXITS section of the DFSDFxxx member defines exit routines, the exit routines defined in the DFSDFxxx member will be loaded. DFSFLGE0 is only loaded if it is listed as one of the exit routines in the DFSDFxxx member.

Alternatively, you can define one or more exit routine modules with the EXITDEF parameter of the USER_EXITS section of the DFSDFxxx member of the IMS.PROCLIB data set. The routines are called in the order that they are listed in the parameter.

Binding

You must bind the exit routine into IMS.SDFSRESL (or a library concatenated with it) as a separate reentrant load module. If the module is not present in the load library, the IMS logger does not load or call it.

The following example demonstrates how to bind the exit routine into IMS.SDFSRESL.
//LINKIT JOB 1,MSGLEVEL=1 
//LINK EXEC PGM=IEWL,PARM=RENT 
//SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(20,20))
//SYSPRINT DD SYSOUT=A
//SYSLMOD DD DSN=IMS.SDFSRESL,DISP=SHR
//OBJIN DD DSN=IMS.USERLIB,DISP=SHR
//SYSLIN DD *
  INCLUDE OBJIN(DFSFLGE0)
  MODE AMODE(31),RMODE(ANY)
  NAME DFSFLGE0(R)
//
Including the routine

The module or modules must be included in an authorized library in the JOBLIB, STEPLIB, or LINKLIST concatenation. No additional steps are necessary to use a single exit routine that is named DFSFLGE0. If you use multiple exit routines, specify EXITDEF=(TYPE= LOGEDIT,EXIT=(exit_names)) in the EXITDEF parameter of the USER_EXITS section of the DFSDFxxx member of the IMS.PROCLIB data set

IMS callable services This exit routine can use IMS callable services. This exit routine is defined to IMS as an IMS standard user exit. Exit routines that are defined to IMS receive the callable services token in the standard exit parameter list. This exit routine does not need to issue an initialization call (DFSCSII0) to use IMS callable services. This exit routine must be manually link-edited with DFSCSI00.
Sample routine location No sample exit routine is provided.

Attributes of this routine

The log edit user exit must be written as reentrant. The user exit receives control running in 31-bit addressing mode and must return control in that mode. It is called in TASK mode, with no locks held, and in non-cross memory, non-AR mode. In an online IMS environment, the log edit user exit runs in key 7, supervisor state, in the IMS control region address space.

Calling this routine

The log edit user exit is called at each of the times described in the list that follows. The type of call is determined when IMS calls the user exit.
Initialization call
IMS calls the LOGEDIT user exit when the logger is initialized. IMS makes this call when it opens the first OLDS.
Edit record call
The log edit user exit is called immediately before the log record (OLDS or WADS) is written.
Termination call
IMS calls the LOGEDIT user exit when the logger is terminated. IMS makes this call after it closes the output log and notifies DBRC. If IMS terminates abnormally, it attempts to make this call from the log task ESTAE routine.

If IMS terminates abnormally, there might be cases when the logger cannot make the termination call to LOGEDIT. Therefore, your user exit must be able to tolerate not being called for termination.

Restrictions

The log edit user exit is subject to the following restrictions:

  • This user exit should not modify any storage other than the parameter lists and associated work areas.
  • All addresses, entry register contents, and parameter list contents can change from one call of the LOGEDIT user exit to the next call. One call should not depend on addresses from a prior call. The sole exception is the content of the work area indicated by SXPLAWRK, which will persist across calls.
  • This user exit can call only z/OS® services that it is authorized to call. It must not call any internal IMS services.
Important: The IMS logger is critical to performance. Avoid coding the exit routine to do things that could negatively affect performance in the IMS logger, such as WAITs and other z/OS services that could cause long delays before returning to your exit routine.

Communicating with IMS

IMS communicates with this user exit through the entry registers, a parameter list, and the exit registers.

Content of Registers on Entry

On entry, the user exit must save all registers using the provided save area. The registers contain the following:
Register Content
1 Address of the IMS standard user exit parameter list
13 Address of the save area. Your user exit must not change the first three words of this save area. This save area is not chained to any other IMS save area.
14 Return address to IMS.
15 Entry point of this user exit.

Standard exit parameter list

This user exit uses the Version 6 standard exit parameter list. The address of the work area passed to this user exit in SXPLAWRK will be the same each time that this user exit is called.

If your LOGEDIT user exit can be called in an enhanced user exit environment, additional user exit routines might be called after your routine. When your user exit routine finds a transaction upon which to act, it can set SXPL_CALLNXTN in the byte that SXPLCNXT points to. This tells IMS to not call additional exit routines.

Function-specific parameter list on entry

The following table shows the content of the function-specific parameter list. The address of this parameter list is in the standard IMS user exit parameter list field SXPLFSPL.

Table 2. Function-specific parameter list for log edit user exit (Mapped by LGEXPL, which is included in LCDSECT)
Field Offset Length Content
LGEXVERA X'0' X'4' Address of parameter list version number.
LGEXTYPA X'4' X'4' Address of call type field.
The remaining fields apply only to the edit record call type:
LGEXRCDA X'8' X'4' Address of log record image.
LGEXEINA X'C' X'4' Address of edit instruction area.
LGEXFBKA X'10' X'4' Address of feedback field.

LGEXVERA points to LGEXVER, described in the following table:

Table 3. LGEXVERA field
Field Offset Length Content
LGEXVER X'0' X'4' Parameter list version number.

LGEXTYPA points to LGEXCTYPE, described in the following table:

Table 4. LGEXTYPA field
Field Offset Length Content
LGEXCTYP X'0' X'4' Call type:
  • 1 = initialization call
  • 2 = record edit call
  • 3 = termination call

As shown in the preceding table, some fields apply only to the record edit call.

  • LGEXRCDA points to a copy of the log record. It does not point into a log buffer.
  • LGEXEINA points to the edit instructions area mapped by LGEXEI (included in LCDSECT). These fields are described in the following table.
  • LGEXFBKA points to the feedback field, described in Table 6:
Table 5. LGEXEI - edit instruction information
Field Offset Length Content
LGEXFUNC X'0' X'4' Functions.
LGEXFNC1 X'0' X'1' Functions byte 1.
  • X'80' = edit record using the information provided in the LGEXOFFS, LGEXLENG, and LGEXREPL fields.
  • X'40' = redrive exit for this record.
X'1' X'3' Functions, reserved bytes.
LGEXOFFS X'4' X'4' Offset for the record edit call.
LGEXLENG X'8' X'4' Length for the record edit call.
LGEXREPL X'C' X'4' The address of the replacement data for the record edit call
Table 6. LGEXFBKA - feedback field information
Field Offset Length Content
LGEXFDBK X'0' X'4' Feedback field, which includes feedback to the exit routine from IMS:
  • 0 = success on prior call
  • 4 = error in edit parameters

The user exit cannot actively edit log data. Instead, it returns an offset and length where data is to be changed and the address of a replacement. IMS overwrites the actual record starting at the specified offset for the specified length using the data at the address indicated for replacement data.

The edit instruction area is cleared before each record edit call. IMS edits the record only if LGEXEDIT is set on return to IMS. If the user exit needs to make another change in the same record, it must also set LGEXHOLD to have the same record presented again. The previous edit does not appear in the record image. IMS changes only the actual record.

If the offset or length specified extends outside the data portion of the record, no editing occurs, and the exit is called again with LGEXFDBK set to LGEXEDER. The edit instruction area will not have been cleared, so the erroneous values are present. The exit can assess the situation, but no further editing of the record is allowed. After the exit returns, it is called for the next record.
Note: The data portion of the record is defined as everything between the record type field and the clock value and sequence number at the end of the record. The logger is unaware of the significance of any part of this area. Consequently, damage to the system segments in a type01 record would go undetected and cause unpredictable results when encountered during restart. Use caution to edit only the message data.

Contents of registers on exit

Before returning to IMS, the user exit must restore all registers except for register 15, which must contain the following:

Register Contents
15 0