Problems with ESQL/C function rgetmsg
Posted in 1996
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
I have several questions concerning the ESQL/C function rgetmsg. I am using UNIX System V, Release 4.2, UnixWare version 1.1.2 on a 386, and I am using version 5.02.UC6 of Informix-SE and Informix ESQL/C. For several "error message numbers" between -200 and -999, rgetmsg returns strings that contain a "%s". For an "error message number" of -533, rgetmsg returns a string with a "%d". A coworker of mine discovered that for a -217 error, the value that would belong in the "%s" was in "sqlca.sqlerrm". (By the way, in "sqlca.h" the comment "/* error message parameters */" is next to sqlerrm.) The following are some questions about these messages with "%s" or "%d". Is rgetmsg working correctly when, in some cases, rgetmsg returns a string that can be used as an sprintf format string with a conversion specification such as "%s" or "%d"? Will the argument that should replace the "%s" or "%d" always be in "sqlca.sqlerrm"? What is in "sqlca.sqlerrm" when no "%s" or "%d" is in the rgetmsg message string? When the rgetmsg message string contains a "%d", is the number stored in "sqlca.sqlerrm" as a string or as an int? Can an rgetmsg message string have more than one conversion specification, and if so, how are the arguments separated in "sqlca.sqlerrm"? Does any value in the sqlca structure indicate whether or not an rgetmsg message string contains a conversion specification? When 100 (SQLNOTFOUND) is the error message number passed into rgetmsg, the message for -100 is returned. For 1 <= error_message_number <= 199, the error message for -error_message_number is returned. Is this an rgetmsg problem, or something else? Is it correct that, when using ESQL/C, if the error message number passed into rgetmsg is only either (1) sqlca.sqlcode or (2) sqlca.sqlerrd[1] when sqlca.sqlcode != 0, and is cast as a short, that rgetmsg will only be called with an error message number in the range (-999) - 100? Is it correct that when sqlca.sqlcode != 0, and no ISAM error occurred, that "sqlca.sqlerrd[1]" is always 0? The description of rgetmsg mentions the function rgetlmsg. Is rgetlmsg the same as rgetmsg, except for msgnum being of type long instead of short? Is rgetlmsg available? Would it ever be appropriate to use rgetlmsg in an ESQL/C program? Thanks for any help you can give. Tim Maloney <tmaloney@ftc.nrcs.usda.gov>