Validating a console name or ID and obtaining the active system name

Before issuing a message to a specific console, you might want to validate if it has been defined. An active console is one that is defined and running. An application can use the CnzConv or CONVCON macro to obtain the console status (active or inactive) and the active system name, with an input console name or ID.

Using CnzConv: To obtain the console status and active system name of an input console name or ID, do the following steps:
  1. Clear the CnzConv parameter list by setting it to zeros.
  2. Specify the following parameters:
    • CnzConv InConsoleName=MyConsoleName or CnzConv InConsoleId=MyConsoleId, depending on what information you currently have
    • ConsoleStatus=OutConsoleStatus
    • SysName=OutSysName
    • Rtncode=CnzConvReturnCode
    • Rsncode=CnzConvReasonCode
  3. Issue the CONVCON macro.
When CnzConvReturnCode is equal to CnzConvRc0_Ok, the input console name or id is defined. If OutConsoleStatus is equal to CnzConv_kStatus_Active, OutSysName contains the system on which the console is active.

Using CONVCON: To obtain the console status and active system name of an input console name or ID, do the following steps:
  1. Clear the CONVCON parameter list by setting it to zeros.
  2. Initialize the following fields in the parameter list:
    • The version ID (CONVVRSN)
    • The acronym (CONVACRO)
    • Either the console name (CONVFLD) or the console ID (CONVID) depending on what information you currently have. The installation defines console names at initialization time in the CONSOLxx member of Parmlib. You can use the DISPLAY CONSOLES command to receive a list of defined names.
    • The appropriate flag in CONVFLGS indicating whether you are specifying the console name (CONVPFLD) or the ID (CONVPID) as input.
  3. Issue the CONVCON macro.
When CONVCON completes, CONVSYSN contains the name of the system to which the console is attached, if the console you specified is active. Register 15 contains a return code. If you receive the following return codes, check the reason code in CONVRSN for an explanation.

See z/OS MVS Programming: Assembler Services Reference ABE-HSP for an explanation of all return codes.