Previous Topic: &NDBRC

Next Topic: &NEWSAUTH


&NDBRID

Provides the record ID of the current or new record.

The &NDBRID system variable is set by some NDB NCL statements to indicate the Record ID of a record. It is set as follows:

&NDBADD

The RID of the new record.

&NDBCLOSE

Set to 0.

&NDBCTL

Set to 0.

&NDBDEF

Set to 0.

&NDBDEL

Set to 0.

&NDBGET

The RID of the current record or 0 if retrieving key field statistics.

&NDBINFO

Set to 0.

&NDBOPEN

Set to 0.

&NDBSCAN

Set to the RID of the first record returned by the scan, or zero if no records were selected. If the &NDBSCAN parameter RECLIMIT=1 was specified, &NDBRID will remain set to zero even if one record passes the scan.

&NDBSEQ

Set to 0.

&NDBUPD

The RID of the updated record.

If a non-zero response is returned in &NDBRC, most statements set &NDBRID to 0. &NDBSCAN is the only exception to this rule.

Example: &NDBRID

&NDBGET MYDB FIELD=SURNAME VALUE=SMITH 
&NDBDEL MYDB RID=&NDBRID

This example deletes the first record (lowest RID) on database MYDB, with the field SURNAME = SMITH.

Notes:

If no NDB statements have been issued by the executing NCL process, &NDBRID is always null. Once any &NDBxxx statements have been issued, &NDBRID is always numeric.

&NDBRID is always cleared when the next &NDBxxx statement is executed. For this reason, the value should be saved in a user variable if other &NDBxxx statements must be executed before using the saved value.

Returns the relative position in an &NDBSCAN-built sequence on &NDBGET and &NDBSEQ statements.

More information:

&NDBADD

&NDBGET

&NDBSCAN

&NDBUPD