__smf_record2() — Record an SMF record with exit control

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both z/OS V1.12

Format

#include <unistd.h>

int __smf_record2 (int smf_record_type,
                   int smf_record_subtype,
                   int smf_record_length,
                   char *smf_record
                   unsigned int smf_exit );

General description

The __smf_record2() function writes an SMF record pointed to by smf_record of length smf_record_length for SMF record type smf_record_type and subtype smf_record_subtype to the SMF data set.

The smf_exit argument defines which user exit is to take control when the SMF record is written. Acceptable values for this argument are as follows:

_SMF_IEFU83     Cause SMF exit IEFU83 to gain control.
_SMF_IEFU84     Cause SMF exit IEFU84 to gain control.

and are defined in <unistd.h>

The service can also be used to determine if a particular type or subtype of SMF record is being recorded to avoid the overhead of data collection if the SMF record is not going to be recorded. See z/OS MVS System Management Facilities (SMF) for more information on SMF record types and layout.

Start of changeThe caller of this service must be APF-authorized or permitted to either the BPX.SMF facility class profile or the BPX.SMF.type.subtype resource profile in the FACILITY class where type is the SMF record type to be written and subtype is the SMF record subtype to be written. For more information about creating and using these profiles and the restrictions on their use, see z/OS UNIX System Services Planning.End of change

This function is supported under CICS® Transaction Server for z/OS only when run in an open transaction environment (OTE).

Note: To determine if a particular SMF record type or subtype is being recorded, specify NULL for the smf_record argument. If the return value is 0, the type or subtype is being recorded. If the return value is -1 and errno is EMVSERR with a reason code of JRSMFNotAccepting, SMF is not recording this type or subtype.

Returned value

If successful, __smf_record2() returns 0.

If unsuccessful, __smf_record2() returns -1 and sets errno to one of the following values:
Error Code
Description
EINVAL
The value that was specified for an argument was incorrect. Start of changeUse __errno2() to retrieve the reason code that is associated with the error. The following reason codes can accompany the return code: JRSMFBadRecordLength, JrSMFTypeSubtypeMismatch, or JrSMFRecordLenMismatch.End of change
EMVSERR
The SMF service returned a nonzero return code. Use __errno2() to retrieve the reason code associated with the error. The following reason codes can accompany the return code: JRSMFNotAccepting, JRSMFError, JRBadAddress, or JRInternalError.
ENOMEM
Not enough storage is available.
EPERM
Start of changeThe calling process is not permitted to the BPX.SMF resource in the FACILITY class and the calling processes are not APF-authorized, or the calling process is permitted to the BPX.SMF.xxx.yyy FACILITY class resource but the environment is dirty. The following reason codes can accompany the return code:
JRSMFNotAuthorized, JREnvDirty
End of change