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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.