Informix - Problem description
Problem IC61409 | Status: Closed |
CHANGE DATA CAPTURE API PROGRAMMER'S GUIDE - THE SAMPLE PROGRAM IS OBSOLETE AND NEEDS TO BE UPDATED | |
product: | |
IBM IDS ENTRP E / 5724L2304 / B15 - IDS 11.50 | |
Problem description: | |
The CDC API sample program which is included in the CDC API Programmer's Guide works with an obsolete identifier for 'PacketScheme' member of CDC record common header ('LGRC'): mint process_databuf(char *databuf, int bytesread) { int logrectype; char recsymb[17], recdesc[128]; if (reminderBytes <= 0) { /* Get the common header information from the CDC packet*/ cur_log_header.ch_size_hdr = ldlong(databuf); cur_log_header.ch_size_payload = ldlong(databuf+4); memcpy((char*)(&cur_log_header.ch_payload_type), (databuf+8),4); /* Check what we got is a correct CDC packet */ if (memcmp((char*)&(cur_log_header.ch_payload_type), "LGRC", 4)!= 0) { fprintf(stderr, "Unknow packet type.\n"); return -1; } ..... } However, the correct value of this identifier is 66 (0x42; CDC_PKTSCHEME_LRECBINARY), so the sample program ends prematurely with "Unknow packet type" error message. The sample program should be modified to use the correct value, for example: 1. define the CDC_PKTSCHEME_LRECBINARY somewhere at the beginning: #define CDC_PKTSCHEME_LRECBINARY ((int4) 66) 2. modify the process_databuf() function to: mint process_databuf(char *databuf, int bytesread) { int logrectype, size; char recsymb[17], recdesc[128]; if (reminderBytes <= 0) { /* Get the common header information from the CDC packet*/ cur_log_header.ch_size_hdr = ldlong(databuf); cur_log_header.ch_size_payload = ldlong(databuf+4); cur_log_header.ch_payload_type = ldlong(databuf+8); /* Check what we got is a correct CDC packet */ if (cur_log_header.ch_payload_type != CDC_PKTSCHEME_LRECBINARY) { fprintf(stderr, "Unknown packet type.\n"); return -1; } ..... } | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All users of documentation for IDS v11.50.xC4 and earlier. * **************************************************************** * PROBLEM DESCRIPTION: * * The identifier for the Packet Scheme member of the CDC * * record common header is incorrect. This error occurs in the * * Change Data Capture sample program of the Change Data * * Capture API Programmer's Guide. * * * * The incorrect information in the sample program is: * * * * mint * * process_databuf(char *databuf, int bytesread) * * { * * int logrectype; * * char recsymb[17], recdesc[128]; * * * * if (reminderBytes <= 0) * * { * * /* Get the common header information from the CDC packet*/ * * cur_log_header.ch_size_hdr = ldlong(databuf); * * cur_log_header.ch_size_payload = ldlong(databuf+4); * * memcpy((char*)(&cur_log_header.ch_payload_type), * * (databuf+8),4); * * * * /* Check what we got is a correct CDC packet */ * * if (memcmp((char*)&(cur_log_header.ch_payload_type), * * "LGRC", 4) != 0) * * { * * fprintf(stderr, "Unknow packet type.\n"); * * return -1; * * } * * ..... * * } * **************************************************************** * RECOMMENDATION: * * Upgrade to IDS v11.50.xC5 documentation and above. * **************************************************************** | |
Local Fix: | |
Modify the CDC API sample program as described in Error Description. | |
Solution | |
To correct the sample program, do the following: 1. Define the CDC_PKTSCHEME_LRECBINARY early in the sample program: #define CDC_PKTSCHEME_LRECBINARY ((int4) 66) 2. Modify the process_databuf() function to the following: mint process_databuf(char *databuf, int bytesread) { int logrectype, size; char recsymb[17], recdesc[128]; if (reminderBytes <= 0) { /* Get the common header information from the CDC packet*/ cur_log_header.ch_size_hdr = ldlong(databuf); cur_log_header.ch_size_payload = ldlong(databuf+4); cur_log_header.ch_payload_type = ldlong(databuf+8); /* Check what we got is a correct CDC packet */ if (cur_log_header.ch_payload_type != CDC_PKTSCHEME_LRECBINARY) { fprintf(stderr, "Unknown packet type.\n"); return -1; } ..... } | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 08.06.2009 19.01.2010 19.01.2010 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) | |
11.50.xC5 |