Load

PURPOSE:  The LOAD command copies data from a formatted ASCII System File into a Data Set (DS).  Options make it possible to take data from a table whose form does not match the Schema Definition (SD).  LOAD can be used when the field definition includes OVERPUNCH.  LOAD cannot be used for a System File (SF) that contains binary data.  ASCII source data is converted to binary as required.

Syntax

LOAD FROM sf_name.ext

[FIELDS field/skip list]

[VIA clause]

[APPEND]

[TEST; ERRORS TO sf_name [only]]

sf_name.ext

is the name and extension of the SF that contains the data.  The extension "CMD" is the default.

FIELDS field/skip list

is used to select data from each line when the form of the SF does not exactly match the SD of the DS.  Items in the list can be:

field_name [width], where the optional width is needed only when the width differs from that of the SD.  Width can be greater or less than that given for the field in the SD.  For DS’s having secondary fields, use only the primary field names.

skip is the number of characters that are not to be incorporated in the DS.  Items in the field/skip list are separated by commas.

If no field/skip list is given, ACCENT R assumes that the data in the SF is the correct width and type for each field in the SD.  Each line must be one complete record, terminated by a carriage return-line feed, and any data beyond the last field is ignored.  Line numbers are also ignored.

VIA clause

a Process Module (PM) can be used with LOAD to perform data validation or to modify or manipulate the records in other ways.  The field/skip list is applied to the record before it enters the DETAIL section.

APPEND

causes new data to be added to any currently in the DS.  The default, if APPEND is not expressed, is to clear the DS before new records are loaded.

TEST

screens all data in the SF for errors, but does not load the data into the DS.  Errors can then be corrected before loading the data to the DS.  This option is particularly useful if the sequence of the data is to be maintained.

ERRORS TO sf_name [ONLY]

checks the data, loads all valid records as records into the DS, writes invalid records to the specified SF preceded by an error message, and displays error messages for any invalid records at the terminal.  The option ONLY writes error messages to the output file but suppresses them at the terminal.  The error file has the default extension .ERR if one is not supplied.

EXAMPLE

The SF DAT.CMD contains the following data.

*LIST SF DAT.CMD
CP0001  000000050010  CA
CP0001  005010070012  NY
CP0001  007010100015  TX

The user wants to select data from SF DAT.CMD and enter it to a DS that has the following SD.

*LIST SD ROYALTIES_DBM2
00100  TITLE_CODE, CHAR, 4
00110  LO_RANGE, INT, 5
00120  HI_RANGE, INT, 5
00130  ROYALTY,  INT, 3

After creating and declaring the DS ROYALTIES, the user loads selected data to ROYALTIES with the LOAD command.  The first field, TITLE_CODE, has the same width in the SF as the SD so its width is not expressed.  The next two characters on each line of the SF are skipped.  The next five characters are loaded into LO_RANGE.  HI_RANGE and ROYALTY are the same number of characters specified in the SD (5 and 3, respectively), and the last three characters in the SF are ignored.

*CREATE DS ROYALTIES SD IS ROYALTIES_DBM2
*USE DS ROYALTIES
*LOAD FROM DAT FIELDS TITLE_CODE, 2, LO_RANGE, HI_RANGE, ROYALTY

The EXTRACT command shows the data now in DS ROYALTIES.

*EXTRACT
CP0001   0  500 10
CP0001 501  700 12
CP0001 701 1000 15

NOTES:  If a Data Index (DI) is declared, all domains of that DI are automatically updated during LOAD.  However, on the initial load of the DS, it is more efficient to load the DS sequentially and then form the DI.

SEE ALSO:  ENTER