InsertHeadline (char *, char *, int);
InsertHeadline (char *headkey, char *buf, int siz)
{
unsigned int Amount;
OCIBlobLocator *lobLoc;
unsigned int remainder, nbytes;
int last = 0;
unsigned int offset=1;
char errmsg[512];


long_varraw *lvr;

if ( buf == NULL || siz < 1 )
return 0;

lvr = (long_varraw *)calloc(1, (sizeof(int) + CHUNKSIZE));
if( lvr == NULL )
{
sprintf(errmsg,"Error allocating memory in InsertHeadline ... Exiting\n");
fprintf(logfile_G,"%s",errmsg);
exit(1);
}

memmove ((char *)lvr->arr, buf, siz);
Amount = siz;
lvr->len = siz;
nbytes = (Amount > CHUNKSIZE) ? CHUNKSIZE : Amount;
remainder = Amount - nbytes;

EXEC SQL ALLOCATE :lobLoc;

EXEC SQL SELECT headline INTO :lobLoc FROM story_data where HEADLINENUMBER=:headkey for UPDATE;
EXEC SQL LOB OPEN :lobLoc READ WRITE;

EXEC SQL LOB WRITE ONE :Amount FROM :lvr WITH LENGTH :nbytes INTO :lobLoc AT ffset;

EXEC SQL LOB CLOSE :lobLoc;
EXEC SQL FREE :lobLoc;

free(lvr);
return 0;

}