6 43 2 C Example

LANSA Open Guide

6.43.2 C Example

Insert a record into the file.

BOOL fOK;

int  iSession;

 

fOK = LceSetFieldValue(iSession, "EMPNO", "12345");

fOK = LceSetFieldValue(iSession, "SURNAME", "Buckley");

 

fOK = LceInsert(iSession, "EMPNO, SURNAME", "PSLMST", FALSE);

 

Psuedocode Example

Checks if a record can be inserted.

strName = "PSLMST"

strList  = "EMPNO, SURNAME"

 

IF NOT LceSetFieldValue(iSession, "EMPNO" , "12345")

         /* return error */

ENDIF

IF NOT LceSetFieldValue(iSession, "SURNAME" , "Buckley")

         /* return error */

ENDIF

IF LceInsert(iSession, strList, strName, TRUE )

         /* insert the new record can be performed */

ELSE

         /* cannot insert the new record */

         /* display error messages */

ENDIF