0

Dear All
please read below my test C code. The ins_inv() picks Value of :cds but did not pick :xyz value though it is populated in find_sp_inv() function.

varchar cds 11;
varchar xyz 30;
varchar fxo 11
main(argc, argv)
int argc;
char **argv;
 {
    find_sp_inv ();
    ins_inv();
 }
find_sp_inv()
 {
EXEC SQL SELECT inv_no into :cds
FROM sup_inv
WHERE REF_NO = 12 ;
cds.arr[cds.len] = '\0';
EXEC SQL DECLARE cinvno CURSOR for select inv_type from inv_types
where ref_no = 12;
EXEC SQL OPEN cinvno;
for (i=0;i<3;i++) /* max three inv_type needed only against one reference */
 {
    EXEC SQL WHENEVER NOT FOUND GOTO notfoundd;
    EXEC SQL FETCH cinvno into :fxo; 
    fxo.arr[fxo.len]= '\0';
    strcat((char*)xyz.arr,(char*)fxo.arr); 
   }
    notfoundd:
   printf("%-30sn\", xyz.arr) /* prints the value .. printing fine */
    return; 
 }
ins_inv()
{
EXEC SQL
INSERT INTO inv_reference (ref_NO, ref_types)
SELECT :cds, :xyz from dual; 
return;
} /* end my program */

Please guide me.

Kind regards

Saeed

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Narue
0

This appears to be some sort of 4GL SQL code that's written in original K&R style. Other than that, I don't really know what the code is doing.

0

What you've posted is not C. Please elaborate on any special libraries or preprocessors you're using.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.