gtpc2m14C/C++ Language Support User's Guide

creec, __CREEC-Create a New ECB with an Attached Block

This macro creates an independent ECB for immediate or deferred processing.

A core block is placed on data level zero of the newly created ECB and a variable number of bytes is passed to the created ECB's work area starting at EBW000. The core block to be passed is the one specified by the level or decb parameter. The TPF system moves the parameters from the area specified by the parm parameter into an interim block of storage. If the priority parameter is CREEC_IMMEDIATE, the block is placed on the ready list. If CREEC_DEFERRED, it is placed on the deferred list. Operational program zero (OPZERO) initializes an ECB with the parameters in the work area, releases the interim block, places the passed block (if any) on data level zero, and activates the specified program.

Format

#include   <tpfapi.h>
void creec(int length, const void *parm, void (*segname)(),
           enum t_lvl level, int priority);
void __CREEC(int length, const void *parm, const char *segname,
             enum t_lvl level, int priority);

or

#include   <tpfapi.h>
void creec(int length, const void *parm, void (*segname)(),
           TPF_DECB *decb, int priority);
void __CREEC(int length, const void *parm, const char *segname,
             TPF_DECB *decb, int priority);                     

length
An integer containing the number of bytes to be passed to the created ECB. A value of zero indicates that no parameters will be passed. A maximum of 104 bytes may be passed.

parm
A pointer of type void to the parameters to be passed.

segname
For creec, a pointer to the external function to be called. For __CREEC, a pointer to the name of the segment to be called. segname must map to an assembler segment name, a TARGET(TPF) segment name (or transfer vector), or a TPF ISO-C dynamic load module (DLM) name.
Migration to ISO-C consideration

The TARGET(TPF) creec function can handle segment names that are #pragma mapped. The ISO-C creec function only handles #pragma mapped names if the first 4 characters are the same as the program name.

TARGET(TPF) restriction

Only calls to certain TPF API functions permit the use of function pointers. Pointers to functions are not supported in TARGET(TPF); their use normally results in a compiler error.

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 CBRW level is the block to be passed to the newly created ECB.

decb
A pointer to a data event control block (DECB). The working storage block on this DECB is the block to be passed to the newly created ECB.

priority
Use defined terms CREEC_DEFERRED to indicate placement on the deferred list and CREEC_IMMEDIATE to indicate placement on the ready list.

Normal Return

Void.

Error Return

Not applicable.

Programming Considerations

Examples

The following example creates an ECB dispatched from the ready list for program OMA0, passing string 755/15AUG and the working storage block on level D0 as input to the program.

#include <tpfapi.h>
void OMA0();
char   *parmstring = "755/15AUG";

  ·
  ·
  ·
creec(strlen(parmstring),parmstring,OMA0,D0,CREEC_IMMEDIATE);

The following example creates an ECB dispatched from the ready list for program OMA0, passing string 755/15AUG and the working storage block on the DECB pointed to by decb_ptr as input to the program.

#include <tpfapi.h>
void OMA0();
char   *parmstring = "755/15AUG";
TPF_DECB *decb_ptr;
DECBC_RC rc;
 
decb_ptr = tpf_decb_create( NULL, &rc );

  ·
  ·
  ·
creec(strlen(parmstring),parmstring,OMA0,decb_ptr,CREEC_IMMEDIATE);

Related Information

For more information about DECBs, see TPF Application Programming.