6.53 LceSelect
Select and retrieve specified fields from the file using the key list specified.
BOOL |
LceSelect |
(int |
iSession, |
|
|
char far * |
strFieldList, |
|
|
char far * |
strFileName, |
|
|
char far * |
strKeyList, |
|
|
BOOL |
fGeneric, |
|
|
int far * |
piRecordCount ) |
Parameters
iSession |
The session identifier as returned by LceGetSessionId. |
strFieldList |
A list of fields to be retrieved from the file. Each of these fields must have been declared using an LceUseField function. |
strFileName |
The name of the file. This must have been declared using an LceUseFile function. |
strKeyList |
A list of key field names. These key fields must have been declared using the LceUseField function. The values for the keys are set using the LceSetFieldValue/ LceSetFieldValueU function. Refer to the notes for key and generic search considerations. |
fGeneric |
Refer to the notes for further information. True = apply a generic search. False = do not apply a generic search. |
piRecordCount |
The number of records returned by the select. |
Return Values
TRUE is returned if the session has selected records.
FALSE is returned if an error occurs.
Notes
Portability Considerations |
An error will occur if you attempt to use a generic key which is numeric if you are using a Windows, Linux or other non-IBM i host system. |
The characteristic of this LceSelect search can be specified using the LceSetSelectOptions function.
Note: You cannot use the *RECEIVEIMMED option with LceSelect.
This function is a simplified version of these functions:
- LceRequestSelect
- LceReceiveSelect
- LceGetRecordCount.
Instead of calling these three functions, all the records are returned after the one LceSelect call.
In some circumstances the use of LceSelect may not be the best option. If the Host is slow or there are many records to return, then it may be better to use the LceRequestSelect, LceReceiveSelect and LceGetRecordCount functions, as LceRequestSelect returns control to the caller while the host prepares the data. While this is happening, your application can perform other tasks locally.
Key and Generic search considerations:
- You must know the specific key fields to the file. The key fields listed can be a subset of the actual keys to the file, but the sequence in which the keys are listed must match the sequence of the keys in the file. This is very important. The sequence of the keys must match the file. If you need the keys in a different sequence you must use a logical file.
- The fGeneric flag determines whether the keys must match exactly or whether a generic key search should apply. If a generic search is used on a file with more than one key field, then the search will apply only to the last non-blank key field specified. Any blank key field will be considered generic.
- You do not have to use the complete key list. You could use the first two fields in a file with three key fields. If you use a subset of the key fields, you are implicitly using a generic search on the unspecified keys, i.e. match key1 and key2 while key3 can have any value. In this case, you do not use the fGeneric search. If you did use the generic search in this situation, you will get a generic search based on key2 and key3.
- This function can only be executed once a session has been opened.
Related Functions