cat > script.cc <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
#include	<mscc.h>
#include <stdlib.h>
void	error	(int	i);
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION ;
typedef	char	string;
	string			v_char[32];
typedef	char	*stringpoint;
	stringpoint		v_charp;
struct	structure	{
	char			v_shortint;
	long int		v_longint;
	float			v_real;
	double			v_double;
};
typedef	struct	structure	*structpoint;
		structpoint	v_sp;
EXEC SQL END DECLARE SECTION ;

int	main (int argc, char** argv)
{
EXEC SQL INIT;
EXEC SQL DATABASE IS "TEST_DATABASE";

v_sp = (struct structure *) malloc (sizeof(struct structure));

EXEC SQL SELECT a_char,a_text,a_smallint,a_longint,a_real,a_double FROM type 
	INTO :v_char,:v_charp,:v_sp->v_shortint,:v_sp->v_longint,
	:v_sp->v_real,:v_sp->v_double
	WHERE a_char = "char";
if(SQLCODE != 0) error(1);
printf("%s %s %d %ld %f %f\n",v_char,v_charp,
	v_sp->v_shortint,v_sp->v_longint,v_sp->v_real,v_sp->v_double);
strcpy(v_char,"char2");
EXEC SQL INSERT INTO type
	(a_char,a_text,a_smallint,a_longint,a_real,a_double)
	VALUES ( :v_char,"text2",:v_sp->v_shortint,:v_sp->v_longint,
		:v_sp->v_real,:v_sp->v_double);
if(SQLCODE != 0) error(2);
EXEC SQL SELECT a_char,a_text,a_smallint,a_longint,a_real,a_double FROM type 
	INTO :v_char,:v_charp,:v_sp->v_shortint,:v_sp->v_longint,
	:v_sp->v_real,:v_sp->v_double
	WHERE a_char = "char2";
if(SQLCODE != 0) error(3);
printf("%s %s %d %ld %f %f\n",v_char,v_charp,
	v_sp->v_shortint,v_sp->v_longint,v_sp->v_real,v_sp->v_double);
EXEC SQL EXIT ;
	return 0;
}
void	error (int	i)
{
	printf("error number %d\n",i);
	printf("SQLCODE number %ld\n",SQLCODE);
	exit(1);
}
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 script.cc
cat > stdout <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
char text 20 20000 321.000000 98765432.100000
char2 text2 20 20000 321.000000 98765432.100000
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout
cat > tag <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
use of typedef
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 tag
