#include "cbltypes.h" /* Includes cbltypes.h and cobgetput.h */ cobuns8_t cobget_x1_compx(const cbl_x1_compx_t *cbldata); cobuns16_t cobget_x2_compx(const cbl_x2_compx_t *cbldata); cobuns32_t cobget_x4_compx(const cbl_x4_compx_t *cbldata); cobuns64_t cobget_x8_compx(const cbl_x8_compx_t *cbldata); cobuns8_t cobget_x1_comp5(const cbl_x1_comp5_t *cbldata); cobuns16_t cobget_x2_comp5(const cbl_x2_comp5_t *cbldata); cobuns32_t cobget_x4_comp5(const cbl_x4_comp5_t *cbldata); cobuns64_t cobget_x8_comp5(const cbl_x8_comp5_t *cbldata); cobs8_t cobget_sx1_comp5(const cbl_sx1_comp5_t *cbldata); cobs16_t cobget_sx2_comp5(const cbl_sx2_comp5_t *cbldata); cobs32_t cobget_sx4_comp5(const cbl_sx4_comp5_t *cbldata); cobs64_t cobget_sx8_comp5(const cbl_sx8_comp5_t *cbldata); cobuns64_t cobget_xn_comp5(const cbl_x1_t *cbldata, cobuns8_t n); cobuns64_t cobget_xn_compx(const cbl_x1_t *cbldata, cobuns8_t n); cobs64_t cobget_sxn_comp5(const cbl_x1_t *cbldata, cobuns8_t n); void *cobget_pointer(const cbl_pointer_t *cbldata); PFR cobget_ppointer(const cbl_ppointer_t *cbldata);
cbldata | Pointer to the COBOL data item and data description as indicated by the cobget function name. |
n | For cobget_xn_ functions. Describes the number of COBOL character positions cbldata occupies. |
None.
COBOL program:
program-id. mycblprog. copy "cbltypes.cpy". 01 myrec. 05 myrec-key cblt-x4-compx value 10. procedure division. call 'mycprog' using myrec-key if myrec-key = 20 display "First call to 'mycblprog'" else display "Subsequent call to 'mycblprog'" end-if exit program end program mycblprog.
C program:
#include "cbltypes.h" void mycprog(cbl_x4_compx_t *cbldata) { cobput_x4_compx(cbldata, cobget_x4_compx(cbldata) + 10); }
Comments:
The cobget_xn_compx functions enable you to extract data from data items with descriptions such as PIC X(3).