BBjFileInfo::changeKey

Description

In BBj 6.0 and higher, this BBjFileInfo method changes an existing key chain in a VKEYED file.

Syntax

Return Value

Method

void

changeKey(int keynum, BBjKeyInfo keyinfo)

void

changeKey(string keyname, BBjKeyInfo keyinfo)

Parameters

Variable

Description

keynum

Specifies the key number to be changed.

keyname

Specifies the key name to be changed.

BBjKeyInfo

The new key structure.

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

  •  The file is not locked

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

Example

rem ' Change a VKEYED key chain

filename$ = "Sample.dat"
erase filename$,err=*next
vkeyed filename$,[1:1:6]+[2:1:3],[3:1:2:"U"],0,64
channel = unt
open (channel)filename$
BBjFileSystem! = BBjAPI().getFileSystem()
BBjFileInfo! = BBjFileSystem!.getFileInfo(channel)
BBjFileInfo!.setKeyName(0,"OrderNumber")
BBjFileInfo!.setKeyName(1,"Salesperson")
print "getKeyInfo('Salesperson') was: ",
print BBjFileInfo!.getKeyInfo("Salesperson")
print "Change the 'Salesperson' key chain"
BBjKeySegment! = BBjFileSystem!.makeKeySegment(3,0,3,0,0)
BBjKeyInfo! = BBjFileSystem!.makeKeyInfo(BBjKeySegment!,1)
BBjFileInfo!.lock()
BBjFileInfo!.changeKey("Salesperson",BBjKeyInfo!)
BBjFileInfo!.unlock()
print "getKeyInfo('Salesperson') is now: ",
print BBjFileInfo!.getKeyInfo("Salesperson")
end

See Also

BBjAPI

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