gtpc2m4gC/C++ Language Support User's Guide

levtest-Test Core Level for Occupied Condition

This function tests the indicated core block reference word (CBRW) data level or data event control block (DECB) for the existence of a working storage block.

Format

#include   <tpfapi.h>
int        levtest(enum t_lvl level);

or

#include   <tpfapi.h>
int	     levtest(TPF_DECB *decb);
 

level
One of 16 possible values representing a valid entry control block (ECB) data level from the enumeration type t_lvl, expressed as Dx, where x represents the hexadecimal number of the level (0-F). This parameter identifies the CBRW to be tested for the presence of a working storage block.

decb
A pointer to a DECB. This parameter identifies the DECB to be tested for the presence of a working storage block.

Normal Return

An integer value representing the size of the working storage block in bytes if the ECB data level or DECB is occupied, or zero if the ECB data level or DECB is unoccupied.

Error Return

Not applicable.

Programming Considerations

Examples

The following example obtains and addresses a working storage block on ECB data level DC if it is unoccupied, or simply addresses the existing block if occupied.

#include <tpfapi.h>
char *work;

  ·
  ·
  ·
if(!levtest(DC)) work = getcc(DC, TYPE, L2); else work = ecbptr()->ce1crc;

The following example obtains the address of a working storage block on an unoccupied DECB.

#include <tpfapi.h>
char     *work;
TPF_DECB	*decb

·
·
·
if(!levtest(decb)) work = (char *)getcc(decb, GETCC_TYPE, L2);

Related Information

See TPF Application Programming for more information about DECBs.