BBjFileInfo::dropKey

Description

In BBj 6.0 and higher, this BBjFileInfo method drops a key chain from a VKEYED file.

Syntax

Return Value

Method

void

dropKey(int keynum)

void

dropKey(string keyname)

Parameters

Variable

Description

keynum

Specifies the key number to be dropped.

keyname

Specifies the key name to be dropped.

Return Value

None.

Remarks

This method will fail, reporting an !ERROR=13 if any of the following conditions is true:

  •  The file is not VKEYED

  •  Attempt to drop key number zero when there are no other key chains

  •  Attempt to drop key number zero when the key chain that will replace it is not unique

This method will fail, reporting an ERROR=0, if the file is not locked.

This method will fail, reporting an !ERROR=11 on an attempt to drop a named key chain that does not exist.

Example

rem ' Drop a key

filename$ = "Sample.dat"
erase filename$,err=*next
vkeyed filename$,[1:1:6]+[2:1:3],[3:1:2],0,64
channel = unt
open (channel)filename$
BBjFileInfo! = BBjAPI().getFileSystem().getFileInfo(channel)
BBjFileInfo!.lock()
BBjFileInfo!.setKeyName(0,"OrderNumber")
BBjFileInfo!.setKeyName(1,"Salesperson")
print "getKeyInfo: ",BBjFileInfo!.getKeyInfo()
print "Drop the 'Salesperson' key chain"
BBjFileInfo!.dropKey("Salesperson")
BBjFileInfo!.unlock()
print "getKeyInfo: ",BBjFileInfo!.getKeyInfo()
end

See Also

BBjAPI

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.