Structure variable in C routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
s_porkalai
Participant
Posts: 38
Joined: Sun Mar 25, 2007 11:05 pm
Location: chennai

Structure variable in C routine

Post by s_porkalai »

Hi,
In the attached C Routine, how to pass the values from DS to a C structure which has 2 variables (length, bytes[66000]).

Code: Select all

#define SQL_TEXT Latin_Text
#include "/ds/data/sqltypes_td.h"
#include <string.h>
#include <stdlib.h>
struct VARBYTE_D
{
   long length;
   BYTE bytes[66000];
};
void vbtovc(struct VARBYTE_D *inputvarbytes, BYTE *result, char sqlstate[6])
{
strcpy(sqlstate, "0000");
for(long idx=inputvarbytes->length-1;idx>=0;idx--)
{
   BYTE b= *((BYTE *)(inputvarbytes->bytes)+ idx);
    *(result+idx) = b?b:' ';
}
 *(result + inputvarbytes->length) = 0x00;
return
}
Thanks in advance
thanks & Regards
A.S.Porkalai Lakshmi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no mechanism for passing structures. I invite you to consider, however, that every structure is a string of characters (or, perhaps, a Raw data type in Orchestrate terminology) so, if you were to pass one of these, and set up your structure as a pointer to the same address, then you ought to be able to achieve what you desire.

But, indeed, what you are doing could as readily be done with ordinary character strings, could it not?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply