Currind

currind is a numeric variable in the [G] class associated with a table declared by the File instruction. It contains the key number used during the last access to the table. When the table is declared but no read operation has been done, the default value of currind is 1.

If the table is declared with a syntax such as File XXXX order By key YYY=..., currind is set to 1.

currind can also be assigned to set up the order by the default if a Read or a For instruction without index is given.

Syntax

[G:ABV]currind

Example

# The BPCUSTOMER table has 2 indexes:# The first one is BPC0 which contains BPCNUM (customer id)# The second one is BPC1 which contains BPCNAM (customer name)Local File BPCUSTOMERRead [BPC]BPC0="DIS001"# Here, message will contain 'Read performed on key #1 : BPC0'MESSAGE="Read performed on key #"+num$([G:BPC]currind)+" : "+[G:BPC]keyname([G:BPC]currind-1)Read [BPC]BPC1="MARTIN and sons"# Here, message will contain 'Read performed on key #2 : BPC1'MESSAGE="Read performed on key #"+num$([G:BPC]currind)+" : "+[G:BPC]keyname([G:BPC]currind-1)Local Char KEYS(20)(1..5), names(30)(1..5)Local Integer NBREAD[G:BPC]currind=1Gosub FIRST_KEYS : # KEYS and NAMES contains the contents of the first lines in ascending order of BPCNUM[G:BPC]currind=2Gosub FIRST_KEYS : # KEYS and NAMES contains the contents of the first lines in ascending order of BPCNAMEnd$FIRST_KEYSNBREAD=0For [BPC]NBREAD+=1KEYS(NBREAD)=[BPC]BPCNUMNAMES(NBREAD)=[BPC]BPCNAMBreak (NBREAD=dim(KEYS)NextReturn

See also

File, Read, For, currlen.