COBOL Manual for TNS and TNS/R Programs

Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
28-15
Unstructured Files
An HP COBOL program can use the FILE_CREATE_ procedure to create an entry-
sequenced file that has alternate keys. An HP COBOL program cannot create an
entry-sequenced file that has alternate keys directly, because the operating
environment maintains the alternate keys in one or more separate files, whose names
are recorded with the operating environment information about the entry-sequenced
file (see Alternate Record Keys).
Outside an HP COBOL program, you can use the TACL command FUP CREATE to
create an entry-sequenced file that has alternate keys.
Unstructured Files
An HP COBOL program cannot create an unstructured file directly because the
HP COBOL language cannot describe a file as unstructured. To create an unstructured
file indirectly, an HP COBOL program calls the FILE_CREATE_ procedure.
An easier way to create an unstructured disk file is to use FUP outside of any
HP COBOL program. You can use the routine COBOL_ASSIGN_ to set file-code
to 101 (for an EDIT file) or to set file-type to 0 (for a non-EDIT file).
Suppose that your HP COBOL program needs an unstructured disk file named
MYTEMP on volume $MYVOL that accommodates 5K eighty-byte records in one
extent. Suppose that your HP COBOL program includes this data description:
01 WS-TEMP-NAME.
03 WS-VOL-NAME PIC X(8).
03 WS-SUBVOL-NAME PIC X(8).
03 WS-FILE-NAME PIC X(8).
This HP COBOL code creates MYTEMP:
ENTER "COBOL_ASSIGN_" USING MYTEMP, OMITTED, 0
The value zero in the third parameter causes the file to be unstructured. The omitted
parameter is for the file code (which defaults to zero).
The FUP command that is equivalent to the preceding HP COBOL code that created
MYTEMP is:
FUP CREATE $MYVOL.MYTEMP, TYPE U
Additional FUP parameters enable you to specify these attributes:
File code
Primary extent size
Secondary extent size
Whether the file is audited by TMF
Whether the file’s label is to be copied to the disk every time the file’s EOF value
changes
For more information about FUP, see the Guardian Programmer’s Guide.