A client encountered RTS error code 163 in a program after writing an Indexed (VSAM/CISAM) record. The program was writing the record and then immediately trying to write a subsequent record, with the only change being a partial increment of the record key. The remainder of the data was to remain the same. However, they found that the data from previous record was not stored in the record buffer after the first WRITE operation of the record, even though they had not specified for the record buffer to be cleared. Based on their description of the problem it would be expected that setting the NOFDCLEAR compiler directive would fix problem.
The FDCLEAR directive ensures that the record buffer will be cleared after a WRITE operaqtion has been completed.
But when they checked their compiler directives file, FDCLEAR was not specified.
They then checked the documentation and found that NOFDCLEAR was the default, and so assumed the record buffer would not have been cleared.
The reason for the problem is that NOFDCLEAR is the default for most dialects. But they had used the DIALECT(ENTCOBOL) compiler directive in their cobol.dir file.
And with DIALECT(ENTCOBOL) set, FDCLEAR becomes the default – and so the record buffer will be cleared.
A description of FDCLEAR is as follows. The important element in this instance was the DIALECT setting, which they did not realize changed the default.
Specifies that the record buffer for a file should be cleared after every write operation.
integer Must be one of:
1 Specifies that the record buffer for a file should be cleared after every write operation. The buffer is cleared to the value specified by the DEFAULTBYTE directive.
2 As for 1, but the record buffer is also cleared after the initial OPEN statement.
Default: NOFDCLEAR (Dialect )
Phase: Syntax check
The FDCLEAR directive is effective while the SELECT clauses are being processed. Use $SET statements before and after each SELECT clause to apply this feature to selected files. Alternatively, use it once before processing any SELECT statements to apply it to all files in a program.
The FDCLEAR directive is ignored for files subject to a SAME RECORD AREA clause in the I-O-Control paragraph.
Specifying FDCLEAR with no parameter has the same effect as specifying FDCLEAR "1".
In the following code, FDCLEAR is applied only to file-2: