gtpc2m11C/C++ Language Support User's Guide

cratc-Search CRAS Status Table

This function searches the CRAS status table.

Format

#include   <tpfapi.h>
long int   cratc(unsigned long type, struct cratc_iparms *cratc_input,
                 struct cratc_slot **addr_crat_slot_ptr);

type
One of the following values that identify the type of search being requested:

CRATC_VERIFY
Verifies that a terminal address is in the CRAS status table.

CRATC_LOCATE
Obtains the LNIATA/CPU ID and CRAS table slot address of a terminal. The slot address is returned for either 1) a functional support console (FSC) when given a routing code indicator and a CPU ID or 2) an alternate CRAS slot (printer or terminal index).

CRATC_FSC
Obtains the LNIATA/CPU ID and CRAS table slot address of a terminal. The CRAS slot address is returned when given an FSC routing index located at the beginning of the CRAS table.

cratc_input
A pointer to the cratc_iparms structure.
  • If CRATC_VERIFY is the specified type, the cratc_iparms structure must contain the LNIATA and, optionally, CPU ID of the terminal. If the CPU ID is omitted, you must zero out the CPU ID field in the input structure and the CPU ID will default to that of the ECB (CE1CPD).
  • If CRATC_LOCATE is the specified type, the cratc_iparms structure must contain one of the following:
    • The FSC slot address and, optionally, the CPU ID. For this, the following routing codes can be specified in the cratc_iparms structure:

      WTOPC_AUDT

      WTOPC_COMM

      WTOPC_DASD

      WTOPC_PRC

      WTOPC_RDBS

      WTOPC_RO

      WTOPC_TAPE

    • An alternate CRAS slot index (terminal or printer index).

    If the CPU ID is omitted, you must zero out the CPU ID field in the input structure and the CPU ID will default to that of the ECB (CE1CPD).

  • If CRATC_FSC is the specified type, the cratc_iparms structure must contain the CRAS table index.

addr_crat_slot_ptr
A pointer to a 4-byte field in which the CRAS table slot address will be placed on a normal return from the cratc function call.

Normal Return

A nonzero long integer. When this value is converted to hexadecimal format, it is equivalent to the concatenation of the 3 bytes of the LNIATA number (also in hex) with the last byte of the EBCDIC CPU ID (converted to hex) of the located CRAS terminal. The return code integer can also be equated to the integer value in the cratc_oparms structure. Because this structure is a union, the integer can then be addressed in character format.

The CRAS table slot address will be stored in the location pointed to by the addr_crat_slot_ptr parameter.

Error Return

A value of 0. This indicates that the requested information could not be located in the CRAS table.

Programming Considerations

None.

Examples

The following example does a CRATC_VERIFY on LNIATA 010000 for CPU B.

#include <tpfeq.h>
#include <tpfio.h>
#include <tpfapi.h>
#include <string.h>
#include <stdio.h>

  ·
  ·
  ·
struct cratc_slot * crat_slot_ptr; struct cratc_iparms cratc_input; struct cratc_oparms cratc_output; unsigned long int rc; unsigned char lniata[3] = {01,00,00}; unsigned char cpuid = 'B';
  ·
  ·
  ·
memset(&cratc_input,0x00,sizeof(struct cratc_iparms)); memcpy(cratc_input.cr_in.cratc_i_lniata,lniata,3); memcpy(&cratc_input.cratc_i_cpuid,&cpuid,1); rc = cratc(CRATC_VERIFY, &cratc_input, &crat_slot_ptr); if (rc) { cratc_output.cr_out.cratc_o_return = rc; }
  ·
  ·
  ·
exit(0); }

The following example does a CRATC_LOCATE for the PRC routing code for CPU B.

#include <tpfeq.h>
#include <tpfio.h>
#include <tpfapi.h>
#include <string.h>
#include <stdio.h>

  ·
  ·
  ·
struct cratc_slot * crat_slot_ptr; struct cratc_iparms cratc_input; struct cratc_oparms cratc_output; unsigned long int rc; unsigned char cpuid = 'B'; short int routecd = WTOPC_PRC;
  ·
  ·
  ·
memset(&cratc_input,0x00,sizeof(struct cratc_iparms)); memcpy(&cratc_input.cr_in.cratc_i_rtcd[1],&routecd,2); memcpy(&cratc_input.cratc_i_cpuid,&cpuid,1); rc = cratc(CRATC_LOCATE, &cratc_input, &crat_slot_ptr); if (rc) { cratc_output.cr_out.cratc_o_return = rc; }
  ·
  ·
  ·
exit(0); }

The following example does a CRATC_FSC with the CRAS table index 3.

#include <tpfeq.h>
#include <tpfio.h>
#include <tpfapi.h>
#include <string.h>
#include <stdio.h>

  ·
  ·
  ·
struct cratc_slot * crat_slot_ptr; struct cratc_iparms cratc_input; struct cratc_oparms cratc_output; unsigned long int rc; unsigned char index = 3;
  ·
  ·
  ·
memset(&cratc_input,0x00,sizeof(struct cratc_iparms)); memcpy(&cratc_input.cr_in.cratc_i_rtcd[0],&index,1); rc = cratc(CRATC_FSC, &cratc_input, &crat_slot_ptr); if (rc) { cratc_output.cr_out.cratc_o_return = rc; }
  ·
  ·
  ·
exit(0); }

Related Information

wgtac-Locate Terminal Entry.