The following update subcommands are available.
The following update subcommands are available.
The following table illustrates the UPDATE subcommand syntax:
++C seq1 [,seq2]
Controls statements to be inserted, deleted, or replaced.
++C seq1 ,(beginning column, field)
Specifies beginning column and modification data of statement to be modified.
Invokes user-defined sequence field.
++D seq1 [,seq2]
Controls statements to be deleted.
++R seq1, [seq2] ,
/ scan field
/ replace field /
[,beginning col][,end col] col 72
Specifies a character string to be replaced.
The ++C subcommand changes a member named in an ++UPDATE command. You can use each ++C subcommand for adding or deleting one or more consecutive records, beginning at any designated point in the member, or you can modify specified columns within a single record. All ++C subcommands that apply to any single member must immediately follow the ++UPDATE command for that member.
The following are the parameters:
- seq1 [,seq2]These parameters control statements you want to insert, delete, or replace. The first sequence number (seq1) designates the exact point of change in the member. When you use seq1 alone, any records following the ++C are inserted into the member immediately following the point of change until a record is encountered with a ++, --, /*, or /& in positions one and two.Use of the second sequence number (seq2) is optional. It causes the deletion of all records in the current member from the first sequence number through and including the second sequence number. If specified, the second sequence number must be greater than or equal to the first sequence number. Any record following the ++C is inserted into the member at seq1.
- seq1 ,(beginning column,field)Columnar update allows modification to specific columns within a statement. The sequence number (seq1) designates the statement number you want to modify.The instructions for statement change are enclosed in parentheses. Specify the column at which the change is to start (beginning column), and the field to be inserted (,field) follows, separated from beginning column by a comma. For example, to place an X in column 72 of statement 101 code:++C 101,(72,X)To insert a close parenthesis into the update field, use a double close parenthesis. For example, to place the string 0(R2),0 into statement 223 beginning at column 16 code:++C 223,(16,0(R2)),0)
- SEQxxySpecify this parameter only on the first ++C following the ++UPDATE. This indicates that the update takes place based on sequence numbers contained in the records of the member. The xx specifies the left most starting position of the sequence field in the card-image, and y specifies the length of that field. ++C seq1,seq2 subcommands are used only to delete statements.To update member USERSEQ, change statement 10 and delete statements 11 and 12 as follows:++UPDATE USERSEQ,1 ++C SEQ015 00010 Data to be changed ++C 00011,00012The sequence field can contain only alphanumeric data and must be in ascending collating sequence. Data supplied with the input stream for insertion or replacement into the library member must be in ascending collating sequence based on the specific sequence field.You can only insert statements if the sequence number specified on the data input statement does not exist in the member. For example, inserting data between statements 10 and 11 is impossible unless the data is resequenced to create a gap between the existing sequence numbers. Subsequent ++C subcommands, which you can use in the same ++UPDATE to accomplish range deletes, must contain sequence numbers of length y.
- Seq1 of ++C must be in ascending sequence.
- Only one column update is allowed on a single statement.
- Data are placed in the record in overlay mode. Attempts to update beyond the data field for the format terminate the entire update. For example, a reference or overflow into columns 73 through 80 of a formatted COBOL member is flagged as an error and the ++UPDATE for this member terminates.
- The statements before and after column update are printed on the report.
- Data that follows a column update ++C are inserted after the column update statement.
The ++D seq1 [,seq2] delete subcommand deletes statements from a member. If you use only one operand, only that sequence number is deleted. If you use two sequence numbers, the range of statements from the first sequence number through and including the second sequence number is deleted. In either case, all records (if any) that follow this subcommand are inserted into the member in place of the deleted statements.
The replacement update scans on the member for the scan field specified and, if found, replaces the scan field with the replace field. If you specify only seq1, only that record is scanned. If you specify both sequence numbers, that range of records is scanned.
- ++R seq1 ,[seq2] ,/scan field /replace field /[,beginning col][,end col] col 72 [S]You can limit the scan and replace to a portion of all records in the sequence range specified. If you specify beginning column, the scan betgins with that column and ignores all columns before that. If you specify end column, all columns after that are ignored. You can specify either or both.When you specify end column, you also have to specify the column 72 option. If you do not, it can result in invalid truncation messages or a failure to move to the left any data to the right of the specified ending column.
- / scan field /replace field /The scan and replace fields need not be the same length. If the scan field is longer than the replace field, all data within the language type column delimiters and located to the right of the scan field are shifted left to be immediately to the right of the replace field. Blanks are inserted to the right side column delimiter. If you specify end column, data to the right of the end column remains the same and is not shifted.If the scan field is shorter than the replace field, all data within the language type column delimiters and located to the right of the scan field are shifted right as far as necessary to allow the insertion of the replace field. However, if the right shift results in loss of non-blank characters at the right side column delimiter, an error condition occurs and the entire update is suppressed. Truncation, therefore, is not allowed.If you do not specify the scan field, the replace field overlays the beginning of the records specified (or as limited by beginning column). This is in effect a fill of a specific character string into the desired columns. No right adjustment occurs; the overlaid characters are lost.If you do not specify the replace field, all occurrences of that scan field are deleted. Adjustment to the left occurs.If no occurrences of the scan field are found, an error condition exists and the entire update is suppressed.
- Column 72 OptionThe R subcommand also has a column 72 option. Placing an S in column 72 indicates that the columns specified are used for the scan only, and the replace is to use the entire record.If column 72 is blank, the scan and replace fields are used as described in the previous paragraphs.
- Data following the ++R is inserted following seq2 (or seq1 if seq2 is not specified).
- Seq1 must be greater than the highest sequence number specified in any previous ++C, ++D, or ++R.
- Seq1 must be less than the lowest sequence number specified in any following ++C, ++D, or ++R.
- The slash (/) delimiter in the scan and replace fields can be substituted with any other character not found in either the scan or replace fields.
- If you do not specify seq2, a comma is still required in that position.
Special Notes on UPDATE Subcommands
It is common practice to change a string of consecutive records in a member by using a ++C or ++D subcommand to both add and delete records. To clarify the situation:
- The presence of two sequence numbers following the ++C or ++D deletes the records as specified, along with all intervening records.
- The presence of records in the input file between the subcommand and the following ++, --, /*, or /& record causes these records to be added to the member in place of the deleted records.
- The number of records added does not have to equal the number of records deleted. In fact, no additions are required when deleting; and no deletions are required when adding.
When processing more than one subcommand for the same member, the first sequence number of each statement must be greater than the first sequence number (and second sequence number, if any) of the preceding statement.
You can code a ++C subcommand with zero in the first parameter (you must omit the second parameter) in which case any following records are inserted in front of the first record in the member. If used, this ++C subcommand must immediately follow the ++UPDATE command or the ++C SEQxxy, if any.
All sequence numbers must be numeric (0 through 9) except when you specify SEQxxy.
A sequence number greater than the highest number in the member is not allowed.
A ++UPDATE is not considered complete unless all subcommands are valid. One error suppresses the entire update; a partial update is not possible.
(TSO users) You must update TSO members by using the stored sequence numbers (which are incremented by ten).
If you place a comment on a
Panvaletstatement, and the comment extends into column 72, you can force an option into effect.