Data editing > Data correction > Correcting data from a corrections file
 
Correcting data from a corrections file
Quick reference
To correct data using a corrections file, create a file called corrfile containing statements of the form:
serial_number [/trailer_read_number]; correction1 [;correction2; ...]
correction is a statement of the form:
command column = codes
command is s (set), e (emit) and d or de (delete).
The last method of correcting errors is to create a file of corrections which will be merged with the original data when it is read by a Quantum program. The correction file must exist in the directory or partition in which you will be running your job.
Corrections are made by comparing the serial number of the record currently in the C array with the serial number given with each correction in corrfile. Consequently, all serial numbers in corrfile must be in the same order as those in the data file. The format for a correction record is:
serial ; corrections
for non-trailer card records, and
serial /n ; corrections
for records containing trailer cards. In both cases, serial is the record serial number and corrections are the corrections to be made. The /n in the trailer card format is the read number defining the trailer card to be corrected; it can be found from the error listing. For example, if the data contains a card 1, three card 2s and a card 3, and you want to correct an error on the third card 2, the read number would be /3 because the third card 2 is read into the C array during the third read. If /n is omitted, the read number is assumed to be 1.
Corrections are entered as follows:
s cn = 'p'
Overwrite a column.
e cn = 'p'
Add a code into a column.
d cn = 'p'
Delete a code from a column.
de cn = 'p'
Delete a code from a column.
The s and the equals signs may be omitted. If the correction refers to a field of columns, you can define a string of codes in place of a single code.
Any number of corrections may be specified for a record as long as each correction is separated by a semicolon. The data to be corrected may be a single column or a field, and the corrections may be single-codes or multicodes enclosed in single quotes or strings enclosed in dollar signs. If the data variable is larger than the string it is to contain, the string will be right-justified and padded with blanks. If the string is longer than the data variable, a warning message is issued.
Here is part of a sample corrections file:
0010; s c112'1'; e c212'3' ; c314='34' ; de c115'3'
0123 /4; c224'3' ; c212'4'
0246 c(316,318)=$123$
0555; c(140,180)=' '
The first record to be corrected is that with serial number 10. Column 112 is to be overwritten with a ‘1’, a ‘3’ is to be added into column 212, column 314 is to be overwritten with the multicode ‘34’ and the ‘3’ in column 115 is to be deleted.
The second correction is to the cards in the C array after the fourth read for serial number 123. Both corrections involve overwriting the original data with new codes.
Note Correcting data with a corrections file is considerably faster than using a forced edit of the form:
if (c(101,103)=$123$) c109'2'
Corrections in corrfile are made before the statements in the edit section of your program are executed. If you are rerunning your previous job to correct errors and you have not altered the edit in any way, you can save more time by telling Quantum to read the data but not to recompile and load your program. This is done with the option –r on the Quantum command line. For more information about options for Quantum runs, see Running Quantum on UNIX and Microsoft Windows.
See also
Data correction