ADD
FUNCTION
This command is used to add new data records to a file. It cannot be used to change or overwrite existing
SYNTAX ADD link-name [USING KEY IS string-value] [DUPLICATE KEY PROCESS IS procedure] [ERROR PROCESS IS procedure] [PROCESSING [IS] procedure]
ADD link-name USING RECORD NUMBER IS numeric-value [ERROR PROCESS IS procedure]- link-name
- the link where the data file is specified.
- string-value
- data-name, variable, constant, or expression that results in a string value.
- numeric-value
- a data-name, variable, constant or expression that results in an integer.
- procedure
- the name of a procedure to perform.
NOTES
- Links to appropriate files must be declared and opened prior to any file input or output procedures.
- If you attempt to add a duplicate key to a key access file, the DUPLICATE KEY procedure is performed. If this procedure is not specified, script execution continues with the next command.
- If an error occurs, other than the duplicate key condition, during the processing of this command, the ERROR procedure is performed. If ERROR is not specified, script execution continues with the next command.
- The string-value does not have to be a data name. However, an error occurs if the value is larger than the defined key and the command terminates or the ERROR procedure is performed. A value smaller than the defined key, will not produce an error.
- This command automatically updates the sort or secondary key file when the record is added to the data file.
- The ADD command cannot be used to add a text field. You must first add a record and then use the CHANGE command with the TEXT option to add a text field. All text field data must be maintained by using the text editor associated with the CHANGE command.
- The processing procedure will be executed AFTER the ADD.
- The processing procedure will not be executed if an error occurs.
EXAMPLES
ADD 4SCUST
ADD 4SCUST USING KEY CUST-CODE
ADD 4SSALDT USING KEY REFERENCE-NUMBER + STR(LINE-NUMBER :"00") DUPLICATE KEY PROCESS IS 20-INC-REF-NUMSEE ALSO
CHANGE, DELETE, RETRY, KEY-NAME
From the Script-IV Language Reference, version 8.9.1. Open this page in the PDF