Previous Topic: &NDBSEQ RESET

Next Topic: Read by Sparse Keys

&NDBGET DIR= and SKIP=

When reading sequentially, the &NDBGET verb lets you specify the direction of retrieval, FWD or BWD, and a skip amount.

The default is DIR=FWD and SKIP=+1, which causes the next-higher key record to be read.

SKIP=0 causes a re-read of the last record read in that sequence. This is useful where you are retrieving only a subset of fields, and sometimes need to obtain extra fields. You need not specify a direct get by RID.

A skip amount (n) greater than 1 will allow you to skip n-1 records on each &NDBGET. This is extremely useful when extracting samples from a database, and especially useful when scrolling in selection lists (see the following examples).

A negative skip amount causes the specified or defaulted direction to be inverted. For example, SKIP=-5 is equivalent to SKIP=5 with DIR=BWD.

Specifying DIR=BWD allows a backward read to be performed. Thus, when you need to retrieve records in descending key sequence, DIR=BWD can be used.