gtpc2m2uC/C++ Language Support User's Guide

find_record-Find a Record

This function retrieves a record from VFA or DASD. The CBRW specified by level must be unoccupied when find_record is called. If the operation is successful, the CBRW is occupied with a working storage block containing the record image at completion.

This function makes the equivalent of a waitc call.

For HOLD-type calls, the record address is placed in the record hold table and is available only to the issuing ECB.

Format

#include   <tpfio.h>
void       *find_record(enum t_lvl level, const unsigned int *address,
                        const char *id, unsigned char rcc, enum t_act type);

level
One of 16 possible values representing a valid data level from the enumeration type t_lvl, expressed as Dx, where x represents the hexadecimal number of the level (0-F). This parameter specifies an available FARW and CBRW for use by the system.

address
A pointer to a file address from which the record will be retrieved.

id
A pointer to a 2-character ID string that must match the ID characters in the record to be retrieved.

rcc
An unsigned character that matches the record control check byte in the record to be retrieved.

type
The record's intended hold status. This argument must belong to the enumeration type t_act, defined in tpfio.h.

NOHOLD
The record address is not placed in the record hold table following I/O completion.

HOLD
The record address is placed in the record hold table following I/O completion. The programmer is responsible for ensuring that the record is removed from the record hold table before calling the exit function.

Normal Return

Pointer to the working storage block containing the record image following I/O completion.

Error Return

Integer value of zero. Detailed error information can be found in the detail error byte (ecbptr()->ce1sud[x]), where x corresponds to the indicated data level.

Programming Considerations

Examples

The following example retrieves a forward chain IM record (rcc = 0) on D6 with hold.

#include <tpfio.h>
 
struct im0im
   {
      char              im0bid[2];         /* record ID             */
      unsigned char     im0rcc;            /* record code check     */
      unsigned char     im0ctl;            /* control byte          */
      char              im0pgm[4];         /* program stamp         */
      unsigned long int im0fch;            /* forward chain         */
      unsigned long int im0bch;            /* backward chain        */
      short int         im0cct;            /* byte count            */
      .
      (data fields)
      .
   } *inm, *inm_chain;
     .
     .
     .
inm = ecbptr()->ce1cr5;             /* Base first in chain          */
if(!(inm_chain = find_record(D6,
                            (const unsigned int *)&(inm->im0fch),
                            "IM",
                            '\0',
                             HOLD)))
{
   exit(0x12345);                   /* Issue dump & exit if error   */
}
else
{
      .                             /* Normal processing path       */
      .
      .
}

Related Information