gtpc2m2sC/C++ Language Support User's Guide

findc-Find a Record

This function reads a record and attaches the block of working storage containing it to the specified data level of the ECB. The ECB must not be holding a storage block on the specified level.

This service finds a record that resides either in VFA or DASD.

Format

#include   <tpfio.h>
void       findc(enum t_lvl level);

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). The data record being retrieved is attached to this level.

Normal Return

Void.

Error Return

Not applicable.

Programming Considerations

Examples

The following example retrieves a data record from file on level D2 after making a call to FACS to calculate the file address.

#define VD1RI "#VD1RI  "
#pragma map(get_file_addr,"FACS")     /* map FACS to a function name   */
#pragma linkage(get_file_addr,TPF,N)  /* define appropriate linkage    */
#include  <tpfapi.h>
#include <tpfio.h>
 
/* set up storage */
struct TPF_regs *regs = (struct TPF_regs *) &(ecbptr()->ebx000);

  ·
  ·
  ·
regs->r6 = (long int) VD1R1 /* record ID */ regs->r7 = (long int) &(ecbptr()->ce1fa2); /* lvl where file addr is */ regs->r0 = 10; /* ordinal number */ get_file_addr(regs); /* calculate fixed file address */ if (!regs->r0) /* FACS error? */ if (regs->r7 == 1) /* invalid record ID */ exit(0x12345); else { /* invalid ordinal number */ serrc_op(SERRC_EXIT,0x12345,"INVALID ORDINAL NUMBER",NULL); } findc(D2); /* find the record */ if (waitc()) /* abort on any errors */ { serrc_op(SERRC_EXIT,0x12345,"I/O ERROR OCCURRED",NULL); /* In TARGET(TPF) this used to be done with: errno = 0x1234; perror("I/O ERROR OCCURRED"); abort(); */ }

Related Information