I am trying to change a single byte(pos.59) within a 100 byte field(group_formactions). The following code produces an error when it is compiled. I know the syntax is not right on the lines within the sql portion where I am trying to do the update. How can I fix it? Thanks in advance!!
#pragma symbols
#pragma inspect
#pragma sql
#include <stdio.h> nolist
#include <string.h> nolist
#include "=cshellh" nolist
#include "ossf089.h"
#include "=ossclib( srv , oss_req_089 , oss_msg_089 )"
static oss_msg_089_def msg;
short ossf089(char* request, char* response, short * reply_err)
{
exec sql begin declare section;
short sqlcode;
exec sql invoke =SECGROUP as secgroup_struct;
struct secgroup_struct hSecGroup;
exec sql invoke =TRANGRP as trangrp_struct;
struct trangrp_struct hTranGrp;
exec sql end declare section;
memcpy(&msg.srv, request, sizeof( msg.srv ));
memcpy(&msg.oss_req_089, &request[sizeof(msg.srv)], sizeof(msg.oss_req_089));
msg.srv.row_count = 0;
memcpy(hSecGroup.group_id,
msg.oss_req_089.group_id,
sizeof(msg.oss_req_089.group_id));
hSecGroup.group_id[sizeof(hSecGroup.group_id)-1] = NULL;
exec sql declare F089_cursor cursor for
select * from =TRANGRP
where group_id = :hSecGroup.group_id
and transaction_group = 8
browse access;
if (!sqlcode)
{
exec sql update =SECGROUP
set group_formactions[59] = '1'
where group_id = :hSecGroup.group_id;
if (!sqlcode)
{
msg.srv.row_count++;
}
else
{
msg.srv.tmf_abort_flag = TRUE;
fprintf(stderr, "Error Updating Security Group Information: OSSF089\n"
fprintf(stderr, "SQL code(%d)\n",sqlcode);
}
}
else
{
exec sql update =SECGROUP
set group_formactions[59] = '0'
where group_id = :hSecGroup.group_id;
if (!sqlcode)
{
msg.srv.row_count++;
}
else
{
msg.srv.tmf_abort_flag = TRUE;
fprintf(stderr, "Error Updating Security Group Information: OSSF089\n"
fprintf(stderr, "SQL code(%d)\n",sqlcode);
}
}
exec sql free resources;
memcpy(response, &msg, sizeof(msg) );
return (sizeof(msg));
} /* end ossf089 */
#pragma symbols
#pragma inspect
#pragma sql
#include <stdio.h> nolist
#include <string.h> nolist
#include "=cshellh" nolist
#include "ossf089.h"
#include "=ossclib( srv , oss_req_089 , oss_msg_089 )"
static oss_msg_089_def msg;
short ossf089(char* request, char* response, short * reply_err)
{
exec sql begin declare section;
short sqlcode;
exec sql invoke =SECGROUP as secgroup_struct;
struct secgroup_struct hSecGroup;
exec sql invoke =TRANGRP as trangrp_struct;
struct trangrp_struct hTranGrp;
exec sql end declare section;
memcpy(&msg.srv, request, sizeof( msg.srv ));
memcpy(&msg.oss_req_089, &request[sizeof(msg.srv)], sizeof(msg.oss_req_089));
msg.srv.row_count = 0;
memcpy(hSecGroup.group_id,
msg.oss_req_089.group_id,
sizeof(msg.oss_req_089.group_id));
hSecGroup.group_id[sizeof(hSecGroup.group_id)-1] = NULL;
exec sql declare F089_cursor cursor for
select * from =TRANGRP
where group_id = :hSecGroup.group_id
and transaction_group = 8
browse access;
if (!sqlcode)
{
exec sql update =SECGROUP
set group_formactions[59] = '1'
where group_id = :hSecGroup.group_id;
if (!sqlcode)
{
msg.srv.row_count++;
}
else
{
msg.srv.tmf_abort_flag = TRUE;
fprintf(stderr, "Error Updating Security Group Information: OSSF089\n"
fprintf(stderr, "SQL code(%d)\n",sqlcode);
}
}
else
{
exec sql update =SECGROUP
set group_formactions[59] = '0'
where group_id = :hSecGroup.group_id;
if (!sqlcode)
{
msg.srv.row_count++;
}
else
{
msg.srv.tmf_abort_flag = TRUE;
fprintf(stderr, "Error Updating Security Group Information: OSSF089\n"
fprintf(stderr, "SQL code(%d)\n",sqlcode);
}
}
exec sql free resources;
memcpy(response, &msg, sizeof(msg) );
return (sizeof(msg));
} /* end ossf089 */