Dynamic File Allocation Services

The following table shows the LE dynamic file allocation services that are supported by this COBOL system.

Routine Description Supported?
PUTENV Dynamically allocate a missing DD Yes
SETENV Dynamically allocate a missing DD Yes

COBOL Syntax

CALL “PUTENV” USING
              BY VALUE ADDRESS OF PUTENV-PARMS
              RETURNING RC
END-CALL

PL/I Syntax

DCL PUTENV ENTRY(POINTER VALUE) OPTIONS(COBOL FETCHABLE) 
           RETURNS(FIXED BIN(31));
RC = PUTENV(ADDR(PUTENV_PARMS));

Where PUTENV-PARMS is a null-delimited character string or structure, and RC is a full word binary variable.

Usage

The contents of PUTENV-PARMS generally follows the syntax of the TSO ALLOCATE command parameters, except for the DDNAME. Note that there must be no embedded spaces between the parentheses of the DSN specification. DDname values must be unique within the context of a single job step, such that you cannot reuse the same DDname on multiple calls to PUTENV.

Example 1
 DDNAME1=DSN(MFI01.DYNALLOC.DATASET1) MOD CATALOG

This will allocate a sequential dataset to the DDname "DDNAME1", with default DCB attributes. If the dataset already exists, the existing attributes will be retained.

Example 2
DDNAME2=DSN(MFI01.DYNALLOC.DATASET2) NEW RECFM(VB) LRECL(133) CATALOG

This will allocate a new sequential dataset to the DDname "DDNAME2", using the specified record format and record length. If the dataset already exists, a non-zero RC value will be returned.

Example 3
DDNAME3=DSN(MFI01.DYNALLOC.DATASET3) NEW DSORG(PO) RECFM(FB) LRECL(80) CATALOG

This will allocate a new PDS dataset to the DDname "DDNAME3" using the specified DCB values.

Example 4
DDNAME4=DSN(MFI01.DYNALLOC.DATASET4) SHR

This will allocate an existing dataset to the DDname "DDNAME4". If the dataset does not already exist, a non-zero RC value will be returned.

Note:
  • The optional parameters (such as SHR, NEW, OLD. LRECL and DSORG) are supported to the same level they are supported for the TSO ALLOCATE command.
  • If you use PUTENV or SETENV with parameters that are not compatible with the TSO ALLOCATE command, the call is rejected and the return code is set to a non-zero value.
  • You must specify the entry point "SETENV" in uppercase characters on Unix platforms. This is to avoid a clash with the "setenv" OS API of the platform which is in lowercase.