A COBOL program developed and executed in BS2000 can, in certain circumstances, access files from the POSIX file system as well as cataloged (BS2000) files.
Requirements
When compiling, the compiler option ENABLE-UFS-ACCESS=YES or the SDF option RUNTIME-OPTIONS=PAR(ENABLE-UFS-ACCESS=YES) must be specified.
When linking, the POSIX link option module contained in the CRTE library SYSLNK.CRTE.POSIX must be linked with higher priority ahead of the modules in the library SYSLNK.CRTE or SYSLNK.CRTE.PARTIAL-BIND.
When linking using TSOSLNK or BINDER, this library should be linked using an INCLUDE or INCLUDE-MODULES statement (without specifying the module name).
When linking dynamically using the DBL, the library must be assigned a BLSLIBnn with a lower nn than the CRTE libraries to be linked with lower priority.
When developing programs in the POSIX shell using the cobol command, the CRTE library is automatically linked.
Restrictions
The processing of a POSIX file is subject to the following restrictions:
no label processing
no checkpointing for restart
no shared updating
no support of pseudo files (see ADD-FILE-LINK in BS2000/OSD “Commands” manual [3].
The file attributes are finally defined when the file is opened for the first time and cannot be modified later.
Relative files which use the BS2000 access method UPAM cannot be processed.
The STANDARD-2 character set (International Reference Version of the ISO 7-Bit Code) specified in the ALPHABET clause is not supported in the CODE-SET clause. Any OPEN of this type will be currently rejected with FILE STATUS 30.
The messages COB9151 and COB9175 for errors on accessing POSIX files do not contain the DMS codes, but the corresponding SIS message numbers. This also applies to the “extended” file status returned to the COBOL object. Even the returned file status could deviate from the usually expected value (see section "I-O status").
The use of dummy files is not supported.
Files larger than 32 Gbytes can be processed without the need to activate this in the /ADD-FILE-LINK command.
Assigning a POSIX file
A POSIX file is assigned using an S variable named SYSIOL-external-name, where SYSIOL is a fixed component of the name and external-name must contain the link name from the program’s ASSIGN clause.
The S variable is set up with the command DECLARE-VARIABLE, which has the following format:
/[SET-VAR] SYSIOL-external-name= {
’*POSIX(filename)‘
| ’*POSIX(relative-pathname)’
| ’*POSIX(absolute-pathname)’
}
filename
identifies the requested file if it resides in the home directory of the POSIX file system.
relative-pathname
is the file name with the directory components as of the home directory.
absolute-pathname
is the file name with all directory components including the root directory (beginning with /).
Example 14-7
mixed file processing
COBOL compilation unit: ... FILE-CONTROL. SELECT POSFILE ASSIGN TO "CUST1" SELECT BS2FILE ASSIGN TO "CUST2" ... Linkage with the POSIX file before calling the program: /SET-VAR SYSIOL-CUST1=‘*POSIX(/USERIDXY/customers/cust1)’ Linkage with the BS2000 file before calling the program: /ADD-FILE-LINK CUST2,CUST.FILE |