SMFEWTM — Writing SMF records

The SMFEWTM macro can be used to write records to the SMF data set. You can use this macro in any exit routine that is in supervisor state except IEFU83, IEFU84, IEFU85, and IEFU29 and in any application program that has APF authorization. The SMFEWTM macro verifies that SMF recording is active and allows the issuer to branch directly to SMF.

When you invoke the SMFEWTM macro, you must include the IEESMCA mapping macro, which maps the SMCA.

Note that you can also write SMF records without using a macro. See smf_record (BPX1SMF, BPX4SMF) -- Write an SMF record in z/OS UNIX System Services Programming: Assembler Callable Services Reference.

[label] SMFEWTM {record address}{,BRANCH=NO }[{,SUBSYS=name}{,WRKAREA=addr }[,MODE=XMEM]]
              {(r)} {,BRANCH=YES}[{,SUBSYS=(reg)}{,WRKAREA=(reg)}]
record address
is the symbolic address of the record to be written.
(r)
is the register number (2-12), that contains the address of the record to be written.
Note: SMF does not preserve register 0 when processing SMFEWTM.
BRANCH=NO
BRANCH=YES
Specifies a branch entry (YES) or an SVC entry (NO) to the requested SMF writer routine. The default is BRANCH=NO.

If you specify BRANCH=NO, before SMF writes the record to the SMF data set, the SMF record is given to installation exit IEFU83.

If you specify BRANCH=YES, before SMF writes the record to the SMF data set, the SMF record is given to installation exit IEFU84, or IEFU85 if MODE=XMEM. To use BRANCH=YES, the caller must be in supervisor state, have a protection key of zero, and set register 13 to point to a standard 72-byte save area.

You should note therefore that if you change from using the SMFWTM macro to write SMF records and use the SMFEWTM macro, BRANCH=YES, then the SMF records are given to installation exit IEFU84 (rather than installation exit IEFU83) or IEFU85 if MODE=XMEM.

SUBSYS=name
SUBSYS=(reg)
specifies the name (or address in register 2-12) of the 4-byte field containing the subsystem name. The macro looks for the subsystem name in SMFPRMxx and uses the options for that subsystem to determine if the record is written. The subsystem name must be left-justified and padded with blanks. If you use a register, it must be enclosed in parentheses. If the subsystem name is not found, then the macro uses the options specified for the entire system on the SYS option in SMFPRMxx to determine if the record is written.

If you do not specify SUBSYS, the macro will use the subsystem name for the current address space, for example, TSO for TSO/E users, STC for started tasks, ASCH for APPC/MVS transactions programs, or the name of the job entry subsystem (JES2 or JES3) for batch jobs. If the defaulted subsystem name is not found, then the macro uses the options specified for the entire system on the SYS option to determine if the record is written.

WRKAREA=addr
WRKAREA=(reg)
specifies the address or a register (2-12) that contains the address of a five-word work area that you must supply for SMF to use. If you specify a register, it must be enclosed in parentheses. You must specify WRKAREA when you specify MODE=XMEM.
MODE=XMEM
specifies that the caller is entered in cross-memory mode (the primary address space is not the home address space). The caller must be in primary ASC mode. If you specify MODE=XMEM, you must specify BRANCH=YES and WRKAREA.

Record types 0 through 127, which are SMF-formatted records, are reserved for IBM® products. For record types 0 through 127, you must supply the record descriptor word and the record type field in the standard SMF record header. The SMFEWTM macro supplies the remaining header information.

Record types 128 through 255 are available for user-written records. When using the SMFEWTM macro to write user records, you must provide the standard SMF record header, including the record descriptor word, the date, time, and system identifier. While the system identifier can be any four character identifier, specifying the value of the SID parameter is consistent with the system records SMF produces.