KEYR() - BBj Key Requested Function

Syntax

KEYR(channelno{,ERR=lineref}{,DOM=lineref})

Description

In BBj 15.00 and higher, the KEYR() function returns the most recent value passed in a KEY= option for any I/O verb on the specified file channel.

Parameter

Description

channelno

Valid channel number.

ERR=lineref

Branch to be taken if an error occurs during execution.

DOM=lineref

Branch to be taken if no KEY= option has been used with the specified channel. (!ERROR=11). If both DOM= and ERR= are specified, DOM= takes precedence for !ERROR=11.

Example

rem ' keyr.txt

keyr$ = "./keyr.dat"
erase keyr$,err=create

create:
    mkeyed keyr$,6,0,128
    keyr = unt
    open (keyr)keyr$
    write (keyr,key="blert")
    print "write ",; gosub keyr
    read (keyr,key="blert")
    print "read ",; gosub keyr
    remove (keyr,key="blert")
    print "remove ",; gosub keyr
    print "read ",; read (keyr,key="R",dom=*proceed); gosub keyr
    print "read record ",; read record (keyr,key="RR",dom=*proceed); gosub keyr
    print "input ",; input (keyr,key="I",dom=*proceed); gosub keyr
    print "input record ",; inputrecord (keyr,key="IR",dom=*proceed); gosub keyr
    print "find ",; find (keyr,key="F",dom=*proceed); gosub keyr
    print "find record ",; find record (keyr,key="FR",dom=*proceed); gosub keyr
    print "extract ",; extract (keyr,key="E",dom=*proceed); gosub keyr
    print "extract record ",; extract record (keyr,key="ER",dom=*proceed); gosub keyr
    print "write ",; write (keyr,key="W",dom=*proceed); gosub keyr
    print "write record ",; write record (keyr,key="WR",dom=*proceed); gosub keyr
    print "print ",; print (keyr,key="P",dom=*proceed); gosub keyr
    print "print record ",; print record (keyr,key="PR",dom=*proceed); gosub keyr
    stop

keyr:
    print "keyr=",
    print keyr(keyr,err=*next); return
    print errmes(-1)
return

See Also

Functions - Alphabetical Listing