Step Next Extended (38)
The Step Next Extended operation (B_STEP_NEXT_EXT) examines one or more records, starting at the next physical position and proceeding toward the end of the file. It checks to see if the examined record or records satisfy a filtering condition, and it retrieves the ones that do. The filtering condition is a logic expression and is not limited to key fields only.
Step Next Extended can also extract specified fields from existing records and return a new set of records that contain only the extracted fields.
Parameters
 
Prerequisites
Procedure
1
For more information about locking, refer to the PSQL Programmer's Guide.
2
3
4
The MicroKernel Engine sets up a buffer as a workspace for extended operations. You configure the size of this buffer using the Extended Operation Buffer Size option. The sum of the data buffer structure, plus the longest record to be retrieved, plus 355 bytes of requester overhead, cannot exceed the configured buffer size. (Requester overhead is not applicable in DOS workstation engines.)
Details
The Step Next Extended operation shares the same “Details” as the Get Next Extended operation. Refer to Details for more information.
Result
If the Step Next Extended operation is successful, the MicroKernel Engine returns one or more fields from one or more records to the data buffer (as shown in Table 23). The MicroKernel Engine also sets the data buffer length parameter to the number of bytes it returned to the data buffer.
If the Step Next Extended operation is unsuccessful, the MicroKernel Engine returns one of the following status codes:
It is possible for the MicroKernel Engine to return a nonzero status code and also return valid data in the data buffer. In this case, the last record returned may be incomplete. If the data buffer length parameter returned is greater than 0, check the data buffer for extracted data.
If a field can only be partially filled because the record is too short, then the MicroKernel Engine returns what it can of the record to and including the partial field. If the partial field is the last field to be extracted, then the MicroKernel Engine continues the operation. Otherwise, the MicroKernel Engine aborts the operation and returns a Status Code 22.
For example, consider a Step Next Extended operation that retrieves three fields from two variable-length records. The first record is 55 bytes long, and the second is 50 bytes. The fields to be retrieved are defined as follows:
When the MicroKernel Engine performs the Step Next Extended operation, it returns the first record without any problem. However, when attempting to extract 10 bytes from field 2 of the second record, the MicroKernel Engine finds that only 5 bytes are available (between offset 45 and the end of the record, at offset 49). At this point, the MicroKernel Engine does not pad the missing 5 bytes of field 2, and thus cannot extract field 3. Instead, the MicroKernel Engine returns Status Code 22 and places all of field 1 and first 5 bytes of field 2 in the return data buffer.
Positioning
The Step Next Extended operation does not establish any logical currency, but the last record examined (not necessarily retrieved) becomes the current physical record. This record can be either a record that satisfies the filtering condition and is retrieved, or a record that does not satisfy the filtering condition and is rejected.
*Note: The MicroKernel Engine does not allow Delete or Update operations after a Step Next Extended operation. Because the current record is the last record examined, there is no way to ensure that your application would delete or update the intended record.