6.48.2 C Examples
C Example 1
BOOL fOK;
BOOL fNext;
int iSession;
int iCount;
long lFlags;
fOK = LceSetSelectOptions(iSession, "*RECEIVEIMMED");
fOK = LceRequestSelect(iSession, "SURNAME, SALARY", "PSLMST", "", FALSE);
fNext = TRUE;
iCount = 0;
while (fNext)
{
/* process records as they are received */
fNext = LceReceiveNextX(iSession, "", 0, NULL, 0);
if (fNext)
{
fOK = LceGetFieldValueX(iSession, "SURNAME", strSurname, &lFlags);
fOK = LceGetFieldValueX(iSession, "SALARY", strSalary, &lFlags);
}
/* count number of records received */
iCount = iCount + 1;
}
C Example 2
#define TOTAL_FIELDS 2
BOOL fOK;
int iSession;
int iCount;
long lFlags;
FIELD_DETAILS fldDetails[ TOTAL_FIELDS ];
char szBuff[ 256 ];
fOK = LceSetSelectOptions(iSession, "*RECEIVEIMMED");
fOK = LceRequestSelect(iSession, "SURNAME, SALARY", "PSLMST", "", FALSE);
iCount = 0;
while (LceReceiveNextX(iSession, sBuff, 256, &fldDetails, TOTAL_FIELDS))
{
if (fldDetails[0].fldLength = 1)
{
/* Display error as a Surname must exist */
}
else
{
strcpy( szSurname, sBuff );
strcpy( szSalary, sBuff + fldDetails[0].fldLength );
}
/* count number of records received */
iCount = iCount + 1;
}