Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Line-sequential files

The line-sequential organization used in COBOL files is a language element defined by the X/Open standard. The corresponding language format is as follows:

FILE-CONTROL.
...
[ORGANIZATION IS] LINE SEQUENTIAL
...

In BS2000, a line-sequential file can be stored

  • as a cataloged SAM file

  • or as an element in a PLAM library.

This provides the option of processing both cataloged files and files in the form of library elements in a COBOL program.
Restrictions by comparison with record-sequential files:

  • Only variable-length records are permissible (RECORD-FORMAT=V).
    Does not apply to ENABLE-UFS-ACCESS=YES.

  • These files can only be opened with OPEN INPUT and OPEN OUTPUT, without the specifications REVERSED and NO REWIND.

  • The only permissible input/output statements are READ (for OPEN INPUT) and WRITE (for OPEN OUTPUT).

  • The only specification that can be made in the CLOSE statement is WITH LOCK.

As with record-sequential files, a line-sequential file can be linked to a current SAM file using the ADD-FILE-LINK command (see section "Assignment of cataloged files").
They can be linked to a library element with the SDF-P command SET-VARIABLE, which must have the following structure:


/SET-VAR SYSIOL-name=’*LIBRARY-ELEMENT(library,element[version],type)’


SYSIOL-name

S variable. name must be the external name of the file in the ASSIGN clause.

library

Name of the PLAM library

element

Name of the element

version

Version indicator. Permissible values are:
<alphanum-name 1..24> / *UPPER[-LIMIT] / *HIGH[EST-EXISTING] / *INCR[EMENT] (only for write accesses)
If no version is specified, the highest possible version is generated during write accesses; read operations access the highest available version.

type

Element type. Permissible values: S, M, J, H, P, U, F, X, R, D.

Line-sequential COBOL files can only be processed in library elements if the LMSLIB library exists under the TSOS ID.
When linking the program that is to process the line-sequential files, the $LMSLIB library must be specified in addition to CRTE in order to satisfy the requirements of external references.

Example 9-6

Generating a line-sequential file in a library element

Entries in the COBOL compilation unit:

...
FILE-CONTROL.
SELECT AFILE ASSIGN TO "LIBELEM"
    ORGANIZATION IS LINE SEQUENTIAL
...
PROCEDURE DIVISION.
...
    OPEN OUTPUT AFILE.
...

Assignment of library and element before the program is called:

/SET-VAR SYSIOL-LIBELEM=’*LIBRARY-ELEMENT(CUST.LIB,MEYER,S)’

  1. The SET-VARIABLE command can be inserted in a BS2000 procedure if it is a structured SDF-P procedure. This kind of structured procedure is described in the “SDF-P” manual [28].

  2. The phrases within the quotes in the SET-VARIABLE command must all be written in uppercase.