gtpc2m21C/C++ Language Support User's Guide

FACE, FACS-Low-Level File Address Compute Functions

This function initializes a FARW with the data necessary to access a fixed file record.

Format

#include <tpfio.h>
void FACE(struct TPF_regs *regs);
void FACS(struct TPF_regs *regs);

regs
A pointer to a TPF_regs structure (as defined in <tpfregs.h>). Members r0, r6 and r7 of the regs structure must be set up as follows:

r0
Ordinal number of record.

r6
Record type value for FACE() function; address of 8-character FACE ID for FACS() function.

r7
Address of FARW for file address on output.

Normal Return

regs.r0 contains the maximum ordinal number for the requested record type. regs.r6 and regs.r7 are destroyed. The file address has been placed in the FARW specified on input by regs.r7.

Error Return

regs.r0 contains zero. regs.r7 contains a general error type indicator, and regs.r6 contains a specific error type indicator within the general type indicated by regs.r7:

regs.r7 == 1
The record type indicator is invalid.

regs.r6 == 1
The requested record type is not in use.

regs.r6 == 2
The record type is not defined or exceeds the limit.

regs.r6 == 3
There are no records defined for the record type for the associated SSU, processor and I-stream.

regs.r7 == 2
The input ordinal number is outside allowable range.

regs.r6 == 0
The ordinal number exceeds the record type limit.

regs.r6 != 0
The requested ordinal does not exist but does not exceed the maximum. regs.r6 contains the next valid ordinal following the requested one. (This return is valid for pools with PSON gaps).

Programming Considerations

Examples

The following example generates a SON address for '#PROG1' record number 235 and stores it in the FARW for data level D6.

#include <tpfio.h>

·
·
·
struct TPF_regs regs; regs.r0 = 235; regs.r6 = (long int)"#PROG1 "; regs.r7 = (long int)&ecbptr()->ce1fa6; FACS(&regs); if (regs.r0 != 0) { /* Success, regs.r0 contains the maximum record ordinal for */ /* for #PROG1 fixed file records, ce1fa6 contains the file */ /* address. */
·
·
·
} else /* Determine type of error */ { switch (regs.r7) { case 1: /* The record type indicator is invalid. */ switch (regs.r6) { case 1: /* The requested record type is not in use. */ break; case 2: /* The record type is not defined or exceeds the limit. */ break; case 3: /* There are no records defined for the record type for */ /* the associated SSU. */ break; } break; case 2: /* The input ordinal number is outside allowable range. */ if (regs.r6 == 0) { /* The ordinal number exceeds the record type limit. */ } else { /* The requested ordinal does not exist but does not */ /* exceed the maximum. regs.r6 contains the next valid */ /* ordinal following the requested one. (This return is */ /* valid for pools with PSON gaps). */ } } }

Related Information

face_facs-File Address Generation.