pjs.defineTable()

 

This API defines an physical file (table) or logical file (view) in the calling scope, defines the file's record formats and fields, and creates a file instance that can be used to perform record I/O operations on the file. This method serves the same purpose as an RPG disk file specification.

Parameters
  1. Internal name - A String containing the desired internal file name. A variable of this name will be defined in the calling script and will be populated with a record file instance. I/O operations are then performed by calling file-specific API.

  2. External name (optional) - A String specifying the external name of the file object. The name can optionally be qualified with a library. If the library is not specified, then the library list is used to resolve the file. If the external name is not specified, then the internal name is used instead. This parameter can be omitted; in this case, the file configuration is passed for parameter 2. This parameter can also be specified as an Object with the following properties in order to implement dynamic external file names:

    • field - The name of a declared character field that hold the external file object name

    • extDesc (optional) - The name of the file object to use for file discovery before the file is opened and before the field is declared. If omitted, the internal name is used. 

  3. File configuration (optional) - An Object that sets file options using the property names / values shown below. If the external file name parameter is omitted, then the configuration should be passed as parameter 2.

Element name

Element type

Description

Element name

Element type

Description

read

Boolean

Set to True to allow records to be retrieved

update

Boolean

Set to True to allow records to be updated

delete

Boolean

Set to True to allow records to be deleted

write

Boolean

Set to True to allow records to be inserted

keyed

Boolean

Set to True to enable keyed record access. Otherwise records will be accessed by relative record number

userOpen

Boolean

Set to True to enable user-controlled file open / close using the file.open() and file.close() methods. Otherwise the file will be opened automatically before this method returns and closed automatically when the calling function ends.

infDS

String

Name of a File Information data structure which will be populated with feedback information after each file method call. The data structure must be defined in the calling scope using pjs.define().

ds

String

The default data structure used for database operations. The data structure is automatically created by the pjs.defineTable() API in the current calling scope. It should not be defined explicitly in the program.

qualified

Boolean