Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Opening a SAM file (OPEN modes)

The following table provides an overview of the OPEN modes.

OPEN mode

Brief description

INPUT

Read the file towards the end of file; the file must exist.

OUTPUT

Create a new file sequentially or overwrite an existing file.

EXTEND

Add records to the end of an existing file.

UPDATE

Only for disk files in locate mode: update records; the record to be updated must first be retrieved by means of GET; the record length may not be modified during processing; the updated record is written back to the disk by means of PUTX.

REVERSE

Read the file sequentially toward the end of file; the file must exist;Tape files which extend over more than one volume can be read only section by section using the VSEQ operand (FILE macro) or using the START-POSITION operand (ADD-FILE-LINK command); no automatic tape swap.

Table 63: Open modes when opening a SAM file

The table below provides information on which action macros are permitted in conjunction with the above-mentioned open modes.

Action macro

OPEN type

INPUT

OUTPUT

EXTEND

UPDATE

REVERSE

GET

x



x

x

PUT


x

x



PUTX




x


RELSE

x

x

x

x

x

SETL

x

x

x

x

x

Table 64: SAM action macros and OPEN modes

An application processing SAM node files must set the SAM_NODE_FILE_ENABLE indicator in the file control block when it opens the file, to indicate that it knows the special aspects of processing SAM node files (see note in the section "FCB retrieval address").

Primary and secondary allocations (disk files)

When a SAM file is created or overwritten (OPEN OUTPUT) or extended (OPEN EXTEND), both the primary and secondary allocations must be at least the same as the block size.

If a SAM file for which RECFORM=F or RECFORM=V is specified is to be created or extended in move mode (OPEN OUTPUT/EXTEND) and is to have more than one record per data block, then the following conditions apply:

  • The primary allocation must be at least twice as long as the data block (primary allocation >= 2 * BLKSIZE). Otherwise control will be passed to the EXLST exit NOSPACE (insufficient storage space).

  • The secondary allocation defined by SAM is implemented as of the first record of the last block that can still be written in the assigned area. If the secondary allocation cannot be implemented, control passes to the EXLST exit NOSPACE (provided it is available in the program). This is giving the user the opportunity to write the remaining records of the last block.

Effects of the LABEL operand (tape files)

The table below indicates the effect of specifying the LABEL operand of the FILE command or the LABEL-TYPE operand of the ADD-FILE-LINK command when a SAM file is opened.

FILE macro:
Operand LABEL=

ADD-FILE-LINK command:
Operand LABEL-TYPE=

Effect

NO / NSTD

*NO / *NON-STD

Specification of the BUFOFF operand will lead to an OPEN error with CODE=ISO/OWN and BLKSIZE=STD.

(STD,0)

*STD(DIN-REVISION-NUMBER=0)

Specification of the BUFOFF operand and CODE=ISO/OWN will lead to an OPEN error.

(STD,1)

*STD(DIN-REVISION-NUMBER=1)

Specification of the BUFOFF operand and the entry CODE=ISO/OWN will lead to an OPEN error.

(STD,2)

*STD(DIN-REVISION-NUMBER=2)

Standard blocks are converted into nonstandard blocks (BLKCTRL=DATA/NO) and V-records are converted to D-records; RECSIZE > 9999 together with RECFORM=V will lead to an OPEN error.

(STD,3)

*STD(DIN-REVISION-NUMBER=3)

Standard blocks are converted into nonstandard blocks (BLKCTRL=DATA/NO) and V-records are converted to D-records; RECSIZE > 9999 together with RECFORM=V will lead to an OPEN error.

STD or no LABEL operand specified

*STD

Specification of the BUFOFF operand will lead to an OPEN error.


The combination of the specifications for the operands CODE, RECSIZE and RECFORM (FILE macro) or CODE, RECORD-SIZE and RECORD-FORMAT (ADD-FILE-LINK command) result in the following values for LABEL if the file to be created is the first file on a tape:

CODE

Block format

REFORM

LABEL value (implicit)

EBCDIC

PAMKEY

-

(STD,1)

EBCDIC

DATA/NO

I

(STD,2)

EBCDIC

DATA/NO

F/V

(STD,3), V records --> D records

ISO/OWN

PAMKEY

-

OPEN error

ISO/OWN

DATA/NO

I

(STD,2)

ISO/OWN

DATA/NO

F

(STD,3)

ISO/OWN

DATA/NO

V

V records --> D records (STD,3)
OPEN error if BLKSIZE > 9999

Table 66: Effects of the CODE, BLKSIZE and RECFORM specifications on the LABEL operand

The combination BUFOFF and RECFORM=U or BLKCTRL=DATA in the FILE macro is not permitted. The combination RECORD-FORMAT=*UNDEFINED and BLOCK-CONTROL-INFO=*WITHIN-DATA-BLOCK is also not permitted.

In the case of LABEL=(STD,1) or LABEL-TYPE=*STD(DIN-REVISION=1), it is not possible to write a file with CODE=EBCDIC, with nonstandard blocks and D-records. However, it is possible to read such a file.

An OPEN error will occur if the standard label level requested via the LABEL operand does not match that specified in the VOL1 label.

If LABEL=STD or LABEL-TYPE=*STD is specified or the operand is omitted, the label level is determined as shown in table 66. If the resulting label level is higher than that in the VOL1 label, the label level defined in the VOL1 label is used. If the resulting label level is lower than that in the VOL1 label, or if the VOL1 label specifies LABEL=(STD,0), and if CODE=ISO/OWN is specified, an OPEN error will result.