Difference: 530ReadPrev (4 vs. 5)

Revision 52015-02-04 - AlKalter

Line: 1 to 1
 
META TOPICPARENT name="Main.APPX530Features"

READPREV

A new ILF command 'READPREV' has been added.

Deleted:
<
<

 

Overview:

A new ILF command 'READPREV' has been added. This command is similar to READNEXT, except it reads the records in reverse order.

Line: 28 to 27
  When using this statement in conjunction with an RDBMS table, you can specify a field name instead of a file name to limit the volume of data being passed between APPX and the RDBMS. See the Partial-Record I/O section in Chapter 4-3: Specifying Statements for more information.
Changed:
<
<
If a END AT statement for this file is executed before the READPREV, the position in the file is modified before executing the READPREV, based on the value and relation specified in the END AT statement and the keypath identified by the READPREV statement.
>
>
If a END ATstatement for this file is executed before the READPREV, the position in the file is modified before executing the READPREV, based on the value and relation specified in the END AT statement and the keypath identified by the READPREV statement.
  The key path and position established by the process interpreter for the process control file has no effect on, and is not affected by, the READPREV position.
Line: 57 to 56
  Read what other users have said about this page or add your own comments.
Changed:
<
<

<--/commentPlugin-->
>
>
Note that READPREV acts differently than READNEXT when the BEG AT/END AT is less than the full key being used. For example, the following code will return the FIRST line item from the ORDER2 file instead of the LAST line item:

      SET      COE ORDER1 ORDER NO            =      12345
      BEG AT   COE ORDER2   IN COE ORDER1 ORDER NO
      END AT   COE ORDER2   IN COE ORDER1 ORDER NO
      READPREV COE ORDER2                 HOLD 0 FT 0 BY ORDER2 KEY

If there are 5 line items in ORDER2 for that order number, one would expect that READPREV would return the 5th one, but instead, it comes back with the first. The only solution, at this time, is to define all parts of the key:

      SET      COE ORDER2 ORDER NO            =      12345
      SET      COE ORDER2 LINE NO             =      0
      BEG AT   COE ORDER2   IN COE ORDER2 KEY
      SET      COE ORDER2 LINE NO             =      999
      END AT   COE ORDER2   IN COE ORDER2 KEY
      READPREV COE ORDER2                 HOLD 0 FT 0 BY ORDER2 KEY

This behavior is evident through APPX 5.4.0. A bug report has been submitted.

-- Al Kalter - 2015-02-04

<--/commentPlugin-->
  -- JeanNeron - 2013-10-04
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback