Home » Developer & Programmer » Precompilers, OCI & OCCI » Cobol calling PRO*C (OPEN VMS)
Cobol calling PRO*C [message #491067] |
Fri, 28 January 2011 15:52 |
|
idiazr
Messages: 4 Registered: October 2010 Location: Colombia
|
Junior Member |
|
|
Hi people,
I have a Cobol programm that call C program above
#include stdlib
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
char *uid = "puntos/puntos@cmrdesar";
int status;
char ptipod[1]=tipod;
int pdocu=docu;
int pprod;
int pcuen;
int ptrxn;
int pcaut;
int paori;
int pfech;
int pcome;
int plocl;
int pterm;
int psecu;
int pprod;
float pmonto;
float pptos;
int porig;
int pfect;
char phora[8];
char pprim[3];
int pcupo;
int pbolt;
varchar presp[200];
float ppant;
float pptrx;
float ppvig;
EXEC SQL END DECLARE SECTION;
void connect_error()
{
char msg_buffer[512];
int msg_length;
int buffer_size = 512;
EXEC SQL WHENEVER SQLERROR CONTINUE;
sqlglm(msg_buffer, &buffer_size, &msg_length);
printf("Puntos error while connecting:\n");
printf("%.*s\n", msg_length, msg_buffer);
printf("Puntos quitting.\n");
exit(1);
}
void sql_error()
{
char msg_buffer[512];
int msg_length;
int buffer_size = 512;
EXEC SQL WHENEVER SQLERROR CONTINUE;
sqlglm(msg_buffer, &buffer_size, &msg_length);
printf("Puntos error while executing:\n");
printf("%.*s\n", msg_length, msg_buffer);
printf("Puntos continuing.\n");
}
main(int argc, char *argv[])
{
/*initialize length components*/
presp.len = 200;
ptipod[1]=argv[1];
pdocu=argv[2];
pprod=argv[3];
pcuen=argv[4];
ptrxn=argv[5];
pcaut=argv[6];
paori=argv[7];
pfech=argv[8];
pcome=argv[9];
plocl=argv[10];
pterm=argv[11];
psecu=argv[12];
pprod=argv[13];
pmonto=argv[14];
pptos=argv[15];
porig=argv[16];
pfect=argv[17];
phora[8]=argv[18];
pprim[3]=argv[19];
pcupo=argv[20];
pbolt=argv[21];
EXEC SQL WHENEVER SQLERROR DO connect_error();
EXEC SQL CONNECT :uid;
printf("Puntos connected.\n");
EXEC SQL WHENEVER SQLERROR DO sql_error();
printf("Puntos waiting...\n");
EXEC SQL EXECUTE
BEGIN
PKG_PUNTOS.calculate
(:ptipod,
:pdocu,
:pprod,
:pcuen,
:ptrxn,
:pcaut,
:paori,
:pfech,
:pcome,
:plocl,
:pterm,
:psecu,
:pprod,
:pmonto,
:pptos,
:porig,
:pfect,
:phora,
:pprim,
:pcupo,
:pbolt,
:presp,
:ppant,
:pptrx,
:ppvig);
END;
END-EXEC;
EXEC SQL WHENEVER SQLERROR DO sql_error();
resp=presp.arr;
pant=ppant;
ptrx=pptrx;
pvig=ppvig;
EXEC SQL COMMIT WORK RELEASE;
return ppresp, ppant, pptrx, ppvig;
}
exit();
Cobol programm instruction is
Call "RoutineP" using var1 var2 var3 var4 ....... var21
givinh var22 var23 ....
Are something wrong in C programm ??????
Pro*C code from vouters.dyndns.org/tima/OpenVMS-Cobol-C-Cobol_passing_variable_number_of_arguments_to_C.html
Modify by me.
[Updated on: Fri, 28 January 2011 16:25] Report message to a moderator
|
|
|
Re: Cobol calling PRO*C [message #491083 is a reply to message #491067] |
Sat, 29 January 2011 00:52 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:Are something wrong in C programm ??????
Does it give an error?
Does it not execute properly and give the expected result?
Regards
Michel
|
|
|
Goto Forum:
Current Time: Sat Nov 23 18:21:49 CST 2024
|