Updating Files; Updating A Sequential Or Line Sequential File - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Processing Files and Records
6.4 Reading Files
Table 6–7 (Cont.) Indexed File—ISAM Mapping
COBOL Data Type
signed quadword
PIC S9(18) COMP
unsigned quadword
PIC 9(18) COMP
packed decimal
PIC S9(n) COMP-3
Note that any data type not directly supported by ISAM is translated to a
character string, which will sort as a character string in the correct order.

6.5 Updating Files

Updating sequential, line sequential, relative, and indexed files includes the
following tasks:
1. Opening the file
2. Executing a READ or START statement
3. Executing a REWRITE and a DELETE statement
Sections 6.5.1, 6.5.2, and 6.5.3 describe how to update sequential, relative, and
indexed files.

6.5.1 Updating a Sequential or Line Sequential File

Updating a record in a sequential file involves the following:
1. Opening the file for I/O
2. Reading the target record
3. Rewriting the target record
The REWRITE statement places the record just read back into the file. The
REWRITE statement completely replaces the contents of the target record with
new data. You can use the REWRITE statement for files on mass storage devices
only (for example, disk units). There are two ways of rewriting records:
REWRITE record-name FROM source-area
REWRITE record-name
6–48 Processing Files and Records
Maps To
Transformation Method
CHARTYPE
Reverse the bytes (integers: most
significant byte (msb) last; character
strings: msb first).
If the data type is not _UNSIGNED, then
complement the sign bit. This causes
negative values to sort correctly with
respect to each other, and precede positive
values.
CHARTYPE
Same as signed quadword.
CHARTYPE
(Note that sign nibble after is the only case
allowed in COBOL.) If the sign nibble is
minus, complement all bits. This will give
a sign nibble of 1 for a minus, which will
come before the plus.
Copy the nibbles so the sign nibble is
placed on the left and all the other nibbles
are shifted one to the right.

Advertisement

Table of Contents
loading

Table of Contents