ENTER

PURPOSE:  The ENTER command creates new records in the current Data Set (DS) from free-form entry at the terminal or from an unformatted System File (SF).  The SF can be created in the ACCENT R editor or outside ACCENT R and can be checked for errors before being loaded into the DS.  Many options are available to streamline data entry.

Syntax

ENTER [NEW]

[WITH [&] PROMPTS] [FIELDS THRU NAME; FIELDS \names\]

[DUP/LICATE/] [CHECK; /NO CHECK/]

[SET clause] [FROM sf_name.ext [TEST; ERRORS TO sf_name [ONLY]]

[VIA clause [ONLY]]

ENTER

(with no options at all) allows the values for every field of a record to be entered on one line.  The values are entered in the same order in which the fields appear in the Schema Definition (SD), separated by the value in @DELIM (comma by default) and terminated by a carriage return.  If a carriage return is typed before values have been entered for all fields, ACCENT R prompts for the next value by displaying the field name and a space.  If a field is to be left blank, enter only a comma.

When a field has multiple occurrences (an array) and some values (but not all) are to be entered, type the value in @END_OCCURS (* by default) after the last value to signify that the rest of the occurrences are to be left blank.  ACCENT R prompts for each record with a double colon (::).  If too many values have been entered, ACCENT R displays an error message.  The values  can then be re-entered for all the fields of the record, or invoke the SLIM editor by typing <ESC>, to edit the line just entered.

NEW

removes all records from the current DS.  The default, if NEW is not expressed, is to append new records to any already in the current DS.  NEW can be used with all other clauses of the ENTER command.

WITH[&]PROMPTS

causes ACCENT R to prompt for the data for each field.  If PROMPTS is used, ACCENT R prompts with the field name.  If &PROMPTS is used, ACCENT R prompts with the field title for any field that has a title; otherwise, the name is used.

When the DS has an array of fields, ACCENT R follows the field name or title with the subscript number(s) of the occurrence in parentheses.  If values are not to be entered for each occurrence, enter values for as many as desired, then signal that the rest of the occurrences are to be left blank by typing the value in @END_OCCURS (* by default).

WITH [&]PROMPTS can be used with the following other ENTER clauses; NEW, FIELDS \\names\\, DUP/LICATE/, CHECK, SET, and VIA pm_name.

FIELDS THRU NAME

allows the creation of new records by entering values for only some of the fields listed in the SD.  Before starting a new record, ACCENT R clears the record build area to all blanks if the DS is ASCII or all null if the DS is binary.

FIELDS THRU NAME tells ACCENT R that the user will supply both fieldname and value for each field.  ACCENT R then prompts with double colons (::) at the beginning of each new record.  Enter all fieldnames and values for a given record on one line, or enter each on a separate line.  The fieldname is separated from its value with a space.  In either case, input must be terminated for a given record, by entering the value in @END_RECORD.  (** by default).  The forms are:

::fieldname value

::fieldname value

::**

::fieldname value

::**

or

::fieldname value, fieldname value, fieldname value,…,**

To end the input session, type the value in @END_INPUT *** by default.

If the field has multiple occurrences, the field name must be identified with its subscript numbers in parentheses, separated by commas; i.e., fieldname (m, n, o).

FIELDS THRU NAME can be used with the following other ENTER clauses; NEW, WITH [&]PROMPTS, DUP/LICATE/, CHECK, SET, and VIA pm_name.

FIELDS \\names\\

specifies the list of fields for which data will be supplied.  If WITH [&]PROMPTS is not specified, ACCENT R then prompts with double colons (::).  Enter values for the specified fields, separating them with commas.  All field values for a given record can be entered on one line.  If a carriage return is typed before all the specified fields are entered, ACCENT R prompts for the next field by displaying its name.  If WITH [&]PROMPTS is specified, ACCENT R prompts for each field value with the field name or title, and each value entered must be followed by a carriage return.  Only a carriage return is recognized as the field delimiter using the WITH PROMPTS options allows commas to be entered into character fields.

For records with multiple record types, the record key field does not have to be included in the field list in the command, but during entry of field values, ACCENT R will expect the first value entered for each record to be the value for the record key field.

FIELDS \\names\\ can be used with all other ENTER clauses except FIELDS THRU NAME and VIA pm_name ONLY.

DUP/LICATE/

enables the value last entered for a given field of the previous record to be duplicated and entered in the same field of the record currently being created.  Instead of entering the value again, type the value in @DUPLICATE (= by default), and ACCENT R automatically enters the value from the previous record.  The DUPLICATE feature can also be invoked with the ENABLE DUPLICATE command.

DUPLICATE can be used with all other ENTER clauses except VIA pm_name ONLY.

CHECK;/NO CHECK/

allows the choice whether or not to enter the new records after all expected values have been entered.  NO CHECK is the default.  If CHECK is specified, ACCENT R performs a confirmation check for each record.  ACCENT R prompts with OK?, and expects one of the following responses:

?  -  causes a brief explanation of the possible responses to be displayed at the terminal.

Y <CR>  -  causes ACCENT R to accept the new record and prompt for the next.

T, S or E  -  causes the new record to be accepted and terminates the command.

N  -  cancels the entered record and prompts for a new record.

M  -  holds current entry and allows additional fields to be entered.

After entering M, further data entry must be in the format of the FIELDS THRU NAME option and must be terminated with the value in @END_RECORD (** by default).  ACCENT R again prompts for confirmation.  This response overrides the FIELDS \\fields\\ option and makes it possible to enter data for any field.

CHECK can be used with all other ENTER clauses except FROM sf_name.

SET clause

described in detail in Chapter 7.

SET can be used with all other ENTER clauses except FROM sf_name and VIA pm_name ONLY.

FROM sf_name.ext

takes the data for new records from a previously created System File (SF).  The SF must contain the data in the format in which it would be entered at the terminal without prompts or with the FIELDS \\names\\ option; i.e., all field values for a given record must be on the same logical line, separated by the value in @DELIM (comma by default).  Each record must be terminated with a carriage return.  The file can contain the values for @END_OCCURS, @END_RECORD, @END_INPUT, and @DUPLICATE.  If the value for @DUPLICATE is present in the System File, the clause DUPLICATE must be included in the command.  The data in the system file can be created with an editor or by a program.`

TEST

screens all data in a SF for errors, but does not enter it into the DS.  Errors can then be corrected before entering 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, enters all valid records into the DS, writes invalid records to the specified System File preceded by an error message, and displays error messages for any invalid records at the terminal.  The option O122222NLY 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.

FROM sf_name can be used with the following other ENTER clauses:

NEW, FIELDS \\names\\, DUP/LICATE/, and VIA pm_name.

VIA clause

declares a Process Module (PM) for data manipulation or validation.  With this form of the VIA clause, normal prompting occurs, and all other ENTER clauses are allowed.

VIA clause [ONLY]

suspends normal field prompting, and does not allow WITH [&]PROMPTS, FIELDS THRU NAME or FIELDS \\names\\.  Therefore, all new records must be entered through ACCEPT statements in the PM.  However, this option can be combined with the CHECK clause.

EXAMPLES

In the first example, the option NEW removes all records in the DS before new records are entered.  ACCENT R prompts with a double colon, and the user enters the first field, followed by a carriage return.  ACCENT R then prompts for each subsequent field with its name.  All fields are entered for the second record on one line, then terminates entry by typing ***, the default value of @END_INPUT.  Responses to prompts are in bold print.

*USE DS PUBLISHERS_DBM2
*ENTER NEW
::1030
PUB_NAME: Royal Empire
CITY: London
STATE: xx
COUNTRY: UK
::2020, Eagle Pub, Los Angeles, CA, USA
::***

The clause FIELDS THRU NAME in the next example specifies that the user will supply the name of each field to be entered, followed by a space and the field value.  The default value of @END_RECORD (**) signals the end of each record.  ACCENT R supplies  spaces or zeros, as appropriate, for the fields not entered.

*ENTER FIELDS THRU NAME
::PUB_NAME East Meets West, CITY Frankfurt, COUNTRY Germany,**
::PUB_NAME Comp & Ling.**
::PUB_NAME WATSON/WILSON, STATE, CA,**
::***

In the next example, ENTER WITH PROMPTS causes ACCENT R to prompt for each field value with the field name.  The user signals "no value" for several fields by typing a carriage return as the first entry on the line.

*ENTER WITH PROMPTS
PUB_CODE: 1330
PUB_NAME: Purple Paper Pub.
CITY: Paris
STATE:
COUNTRY: France
PUB_CODE: ***

The next two examples show entry from SF’s for the ROYALTIES_DBM2 DS.  The clause TEST in the first command causes ACCENT R to examine all data for errors, but no data is entered to the DS.  It displays an error message when an error is found in the third line of the SF.

*LIST SF NEWROY.DAT
00100  CP1101, 0, 5000, 10
00110  CP1101, 501, 700, 12
00120  CP1101, 701, 1000, A1
*ENTER FROM NEWROY.DAT TEST
!! DATA TYPE ERROR(A1) FOR ROYALTY IN LINE 00120

After fixing the SF, enter the ENTER command, without TEST.  This time, all records are entered to the DS.

*ENTER FROM NEWROY.DAT

The next command tells ACCENT R to enter valid records to the DS and to save any invalid records on the SF ROYERR.  The word ONLY causes error messages to be saved on the error file but suppressed at the terminal.  The error file is listed to see if it contains any records.  (ACCENT R supplies the default extension .ERR to the file, and that extension must be used in the LIST command).

*ENTER FROM NEWROY.DAT ERRORS TO ROYERR ONLY
*LIST SF ROYERR.ERR
!! DATA TYPE ERROR(A1) FOR ROYALTY IN LINE 00120
00120 CP1101,701,1000,A1

After editing the error file, the user enters it to the DS with the command.

*ENTER FROM ROYERR.ERR

In the next example, the user plans to enter only two fields to the DS, and wants to use the DUPLICATE feature.  Each time an equal sign (the default value of @DUPLICATE) is entered for the field invoice, ACCENT R duplicates the preceding invoice number.  The EXTRACT command shows the records entered.

*USE DS STORES_DBM2
*ENTER FIELDS CITY, ZIP DUPLICATE
::SAN JOSE,95111
::=,95107
::=,95121
::AUSTIN,74707
::=,74701
::BOSTON,07531
::=,07533
::=,07530
::***
*EXTRACT SHOW CITY,1B,ZIP
SAN JOSE  95111
SAN JOSE  95107
SAN JOSE  95121
AUSTIN  74707
AUSTIN  74701
BOSTON  07531
BOSTON  07533
BOSTON  07530

NOTES:  To duplicate values for occurrences within an OCCURS field, use the <ESC> key.  Hence, typing <ESC> to field SALES(3) will copy the value from SALES(2) of the current record.  This feature is independent of the DUPLICATE option and will work even if the DUPLICATE option is not enabled.  This feature is invoked by typing Control-V twice.

If a Data Index (DI) is declared, all domains of that DI are automatically updated during ENTER.

Default values of controlling characters used in ENTER can be changed by the user.

The ENTER command allows system fields and Global Storage (GS) fields to be used for entering values.  When a system field name or GS field name is entered, its current value is stored as the value of the field being entered.  If it is subscript, the subscript values must be literals or constants: @INTEGER (5) is permitted, but @INTEGER (%FS_FIELD) is not.  If entering the name of a system field or GS field as a value, it must be preceded with the value in @LIT (\ by default).

The LOAD command is used to copy data to a DS from a fixed-format ASCII SF.

Within the ENTER command, any line that begins with two exclamation points and a space is treated as a comment and is not entered in the DS.  A comment can only be entered between records.

When all the values for a record are entered on the same line and if an error is made and discovered before the carriage return is typed, it can be corrected by one of the following methods:

  1. Invoke SLIM (Single Line Image Editor).

  2. Type a Control-U and copy all values from the beginning of the line up to the error.

  3. Back up any number of characters by pressing the DEL key.

With the [&]PROMPTS option, where field values are entered on succeeding lines, it is also possible to back up and correct preceding fields within a given record by entering an up arrow record followed by a carriage return for each field to be reviewed.  ACCENT R then re-prompts for the previous field’s value.  It is not possible to go back beyond the first field of the current record.  Backing up does not erase the data in the fields backed over; it simply allows data to be reentered for those fields that need changing.

After the changes have been made, advance through fields that have correct data by simply typing a carriage return for each field.  To erase a field, type space, carriage return.  Type two asterisks when data entry is complete for the record.

With the FIELDS THRU NAME option, if entering each field on a separate line, it is not possible to back up to a preceding line, but field_name value can be re-entered for any field to be changed in the current record.

SEE ALSO:  SLIM, ENABLE DUPLICATE, ACCEPT, ENTER, @END_INPUT, @DELIM, @END_RECORD, @END_OCCURS