gtpc2m0g | C/C++ Language Support User's Guide |
The attac function reattaches a working storage block to an
ECB. The ECB must not be holding a storage block on the specified level
-- it must have been previously released using the detac
functions.
Format
#include <tpfapi.h>
void *attac(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
working storage block on this core block reference word (CBRW) level is the
block to be attached.
Normal Return
The pointer of type void representing the address of the start
of the newly attached block.
Error Return
Not applicable.
Programming Considerations
- A system error with exit results if an incorrect data level is specified,
if no storage block was previously detached on the referenced level, or when
there is already a block on the specified level.
- Excessive use of this function can cause a depletion of working
storage; therefore, its use should be carefully monitored.
- The detach functions (detac, detac_ext, and
detac_id) and the attach functions (attac,
attac_ext, and attac_id) push and pop working storage
blocks to and from a list chained from the ECB. The attac
function always attaches the block most recently detached from the specified
data level. The attac_ext function attaches different blocks
depending on how it is coded. The attac_id function attaches
a working storage block with a matching FARW field to an ECB.
When coding attach and detach function calls, use the attac and
detac function calls together, or the attac_ext and
detac_ext function calls together, or the attac_id and
detac_id function calls together.
- The specified data level CBRW, FARW, and FARW extension are restored to
the contents at the time the most recent detac function was called
for that data level.
Examples
The following example reattaches a previously detached IM0IM record to
level D6.
#include <tpfapi.h>
struct im0im *inm;
·
·
·
inm = (struct im0im *)attac(D6);
Related Information