Guides/Keyed Files
< Guides
Jump to navigation
Jump to search
Keyed Files (keyfiles)
A keyed file is a J component file in which the components are accessed using keywords. A keyword may be any character string.
Load the keyed file system with:
load 'keyfiles'
This defines the main functions:
name | description |
---|---|
keycreate | create file |
keydir | keyword directory |
keyerase | erase file |
keyread | read data for keyword |
keywrite | write date for keyword |
When reading: if keyword not found, return '' else return value.
When writing: if data='' then the keyword is deleted
For example:
keycreate 'mydata' 1 'Peter Rabbit' keywrite 'mydata';'name' 'Lake District' keywrite 'mydata';'loc' keydir 'mydata' loc name keyread 'mydata';'loc' Lake District