Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

7.107.1 SELECT Parameters

END_FILE

FIELDS

FROM_FILE

GENERIC

...

RETURN_RRN

VAL_ERROR

WHERE

WITH_KEY

RET_UPDID

FIELDS

Specifies either the field(s) that are to be selected from the record in the file or the name of a group that specifies the field(s) to be selected. Alternatively, an expandable group expression can be entered in this parameter.

...

then it would select all names in NSW with a post code that starts with 2 (ie: 2000 to 2999). This is an example of generic searching on a numeric field where trailing zeroes (0's) are ignored.

Portability Considerations

When native I/O is used, there is an implied *ENDWHERE when a key is encountered that does not match the search key generically. You must test the application to confirm that it is functioning as required.

IO_STATUS

Specifies the name of a field that is to receive the "return code" that results from the I/O operation.

...

Note: LOCK(*YES) performs a record level lock. It may exhibit intra and inter operating system behavioral variations (e.g. commitment control locking multiple records; default wait times). User's are advised to investigate the development of proper and complete "user object" locking protocol by using the LOCK_OBJECT Built-In Function.

Portability Considerations

Not supported and should not be used in portable applications. A build warning will be generated when used in Visual LANSA.

RETURN_RRN

Specifies the name of a field in which the relative record number of the record just selected should be returned.

...

Normally a SELECT loop only terminates when all records that could match the selection criteria have been read and examined for possible selection and processing by the SELECT loop. When the *ENDWHERE option is used, the first time a record is read (or some other condition occurs) that causes the WHERE condition to be false, the SELECT loop is terminated.

Portability Considerations

Use of the SELECT options *STARTKEY and *ENDWHERE are not recommended for portable applications as they may have performance implications when using SQL requests.
The *STARTKEY option emulates the positioning of a "file cursor".
The *ENDWHERE option tests the condition inside the select loop and is not placed in the WHERE clause when using SQL.

*ENDWHERESQL: allows you to handle SELECT commands in the most appropriate manner according to the WHERE condition.

...

This new value is applied by selecting the force *ENDWHERESQL option in the Partition definition tab. This partition option signals to LANSA that ALL *ENDWHERE options in SELECT commands are to be interpreted as though *ENDWHERESQL had been coded. As code is updated, or new code is written, it is recommended that the SELECT commands are changed to use this new option where it is appropriate.

Portability Considerations

This value flags the runtime to interpret SELECT operation differently:

- If the code is generated to use SQL, then this *ENDWHERESQL option will effectively be ignored and the WHERE condition will be placed in the WHERE clause of the SQL request (when all real columns are specified).

- If the code is generated to use native I/O access, then the *ENDWHERESQL option will be interpreted to be the same as the *ENDWHERE option.


* BLOCKnnn: Specifies that the records selected from the file are to be read in blocks to reduce the number of real database I/O operations being performed.

...

  • The 'nnn' component of the *BLOCKnnn parameter value specifies the number of records read in each block. The allowable values for 'nnn' are 010, 020, 030, 040, 050, 060, 070, 080, 090, 100, 150, 200, 250, 300, 400 or 500. The IBM recommended value is as many records as will fit into a 32K block.

  • The use of *BLOCKnnn implies the use of *DBOPTIMISE, regardless of whether or not *DBOPTIMISE is actually specified in a FUNCTION command.

  • The SELECT command must not have a WITH_KEY parameter. The use of the WITH_KEY parameter causes file cursor positioning operations that disable the blocking logic.

  • No other I/O operations must be performed on the file specified in the FROM_FILE parameter anywhere else in the function.

  • The SELECT/ENDSELECT loop must be executed once and only once in the programs invocation. Subsequent attempts to (re)execute the SELECT/ENDSELECT loop will cause unpredictable results because the file cursor will not be (re)positioned to the start of the file. If this feature is required, CLOSE the file before attempting to (re)execute the SELECT/ENDSELECT loop.

  • The file must not be left open by option *KEEPOPEN or have been opened (or left open) by some other function / program, including this one. If the file is already open the current location of the file cursor is unpredictable. If in doubt, use the CLOSE command to close the file first.

  • The relative record number returned by the RETURN_RRN parameter is meaningless when OPTIONS(*BLOCKnnn) is used as it represents the number of the last record read in the current block, which may not be the record being processed by the SELECT/ENDSELECT loop.

Portability Considerations

Not supported and should not be used in portable applications. A Full Function Check fatal error will be issued when used in Visual LANSA. *BLOCKnnn options are ignored with no known effect to the application.

RET_UPDID

Specifies the name of a field in which the update id column of the row just selected should be returned.

Any field nominated in this parameter must be defined within the RDML or the LANSA data dictionary and must be numeric.

Only valid where the table contains a LANSA update id column.

Only valid in RDMLX code.