C and C++

In the following example, the symbolic feedback code file CEEEDCCT is included and a call is made to CEEGTST. After the call, a test is made for the condition token representing an invalid heap ID. The fc returned from CEEGTST is tested against the symbolic feedback code CEE0P3 listed in the CEEGTST feedback code table (see z/OS Language Environment Programming Reference). If the heap ID specified is not valid, another call is made to CEEGTST to try again.

_FBCHECK (IBM-supplied) is used to compare only the first 8 bytes of the fc against the symbolic feedback code.

Figure 1. C/C++ example testing for CEEGTST symbolic feedback code CEE0P3
/*Module/File Name:  EDCSFC   */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <leawi.h>
#include <ceeedcct.h>

main(void)
{
  _FEEDBACK fc;
  _POINTER address;
  _INT4 heapid, size;

  size = 1000;
  heapid = 999;

  CEEGTST(&heapid, &size, &address, &fc);
  if ((_FBCHECK (fc, CEE0P3)) == 0){
     printf("You specified a Heap Id that does not exist!\n\n");
     }
  printf("Try again:\n");
  heapid = 0;

  CEEGTST(&heapid, &size, &address, &fc);
  if ((_FBCHECK (fc, CEE000)) == 0){
     printf("Now it worked!\n");
     }
  else {
     printf("CEEGTST failed with message number%d \n", fc.tok_msgno);
     exit(99);
     }

  return 0;
}