Previous Topic: &FILEID

Next Topic: &FILERC


&FILEKEY

Indicates an NCL process's current position within a UDB.

This variable is set to the value of the full key of the last record read from the UDB identified by the last &FILEID statement issued by an NCL process. It can therefore be used to refer to the explicit key of each record read from a UDB when a file is being read using partial keys.

&FILEKEY reflects the private position of a process within its currently active file (which is the last file referenced on an &FILE statement).

Example: &FILEKEY

&FILE OPEN ID=HELPDESK FORMAT=DELIMITED -* open our file 
&FILE SET ID=HELPDESK KEY='&1' -* set required key
&FILE GET ID=HELPDESK OPT=KGT VARS=TXT -* read that record 
&IF &FILERC = 0 &THEN +
    &WRITE DATA=READ FOR RECORD &FILEKEY

Note: If the &FILEKEY variable can contain non-printable characters, it is recommended that it not be used directly as a parameter when invoking other procedures. In this case, use &HEXEXP to produce a character representation of the key, and pass this value.

More information:

&FILE