View Full Version : Retrieving parm from C into CL
Guest.Visitor
07-31-2002, 06:39 AM
I have a CL pgm that calls a C pgm passing in a filename as a parameter. The C pgm then runs some embedded SQL and returns. What's the best way of checking whether I had any errors in the C pgm? I could return the SQLCODE, but how do I receive it in the CL pgm
B.Morris
07-31-2002, 02:22 PM
stephyb wrote: > > I have a CL pgm that calls a C pgm passing in a filename as a parameter. The C pgm then runs some embedded SQL and returns. What's the best way of checking whether I had any errors in the C pgm? I could return the SQLCODE, but how do I receive it in the CL pgm You could send an exception from the C program if it failed. Or, how about passing a second parameter? I'm not sure what type SQLCODE is, but assuming it's an int, try something like this (untested): CL: dcl &filename type(*char) len(10) dcl &sqlcode type(*dec) len(11 0) call cpgm (&filename &sqlcode) C: #include <decimal.h> main (int argc, void *argv[]) { char *filename = (char *)argv[1]; decimal(11,0) *pRetSqlcode = (decimal(11,0) *)argv[2]; ... *pRetSqlcode = sqlcode; return;
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.