HFZALLOC command

The HFZALLOC command can be used to perform dynamic allocation and concatenation of data sets to DDnames.

Read syntax diagramSkip visual syntax diagram
Syntax

>>-HFZALLOC--DD--(--ddname--)--+-----------------------+-------->
                               |         .-,------.    |   
                               |         V        |    |   
                               '-DSN--(----dsname-+--)-'   

>--+-----+--+-----------+--------------------------------------->
   +-MOD-+  +-CATALOG---+   
   +-NEW-+  +-DELETE----+   
   +-OLD-+  +-KEEP------+   
   '-SHR-'  '-UNCATALOG-'   

>--+------------------------------------------------+----------->
   '-SPACE--(--primary_cyls--+-----------------+--)-'   
                             '-,secondary_cyls-'        

>--+-----------------------------+------------------------------>
   '-DIR--(--directory_blocks--)-'   

>--+----------------------------+------------------------------->
   |           .-----------.    |   
   |           V  (1)      |    |   
   '-RECFM--(--------+-A-+-+--)-'   
                     +-B-+          
                     +-D-+          
                     +-F-+          
                     +-M-+          
                     +-S-+          
                     +-T-+          
                     +-U-+          
                     '-V-'          

>--+------------------------------------+--+---------+---------->
   '-LRECL--(--logical_record_length--)-'  '-LIBRARY-'   

>--+--------------------------------+--------------------------->
   '-UNIT--(--unit_specification--)-'   

>--+----------------------------+------------------------------->
   '-SYSOUT--+----------------+-'   
             '-(sysout_class)-'     

>--+--------------------------------+--------------------------->
   '-PGM--(--sysout_program_name--)-'   

>--+-------------------------+--+-------+----------------------->
   '-DEST--(--node.userid--)-'  '-DUMMY-'   

>--+-----------------------+-----------------------------------><
   |          .-END---.    |   
   '-FREE--(--+-CLOSE-+--)-'   

Notes:
  1. No commas or blank characters can delimit repeated values. For example, to specify fixed-blocked record format, use RECFM(FB) - not RECFM(F B).
Operands:
DD
DDname to be associated with data set. This DDname is always required.
DSN
Names of data sets to be allocated. If more than one data set name is specified, all data sets following the first are expected to already exist and will be concatenated to the specified DDname. HFS path names are not permitted.
MOD
Additions are to be made to data set.
NEW
Data set is to be created.
OLD
Data set exists and exclusive control is required.
SHR
Data set exists but exclusive control is not required.
CATALOG
Data set is to be cataloged.
DELETE
Data set is to be deleted when freed.
KEEP
Data set is to be kept when freed.
UNCATALOG
Data set is to be uncataloged.
SPACE
Primary space and increment as number of cylinders.
DIR
Number of directory blocks required.
RECFM
Record format:
A
ASA printer characters
B
Blocked
D
Variable length ASCII records
F
Fixed
M
Machine control character
S
Standard blocks or spanned
T
Track overflow
U
Undefined
V
Variable
LRECL
Logical record length (0 to 32760 value).
LIBRARY
Allocate a PDSE (partitioned data set extended) data set.
UNIT
Device type to which a file or data set is to be allocated.
SYSOUT
Data set is to be system output data set. The class can optionally be specified as a single character.
PGM
SYSOUT program name.
DEST
DEST node and user ID.

Just the user ID can be used for local destinations.

DUMMY
Allocate dummy data set.
FREE
Deallocation specification:
CLOSE
Requests that the system deallocate the data set when it is closed.
END
Requests that the system deallocate the data set at the end of the last step that references the data set. This value is the default.
The following syntax rules apply:
  • DSN is mutually exclusive with the following parameters:
    • PGM
    • DEST
  • DEST is mutually exclusive with the PGM parameter.
  • SYSOUT is mutually exclusive with the following parameters:
    • OLD
    • MOD
    • SHR
    • NEW
  • The following parameters require that the DSN parameter is also specified:
    • SPACE
    • DIR
    • UNIT
  • The following parameters require that the SYSOUT parameter is also specified:
    • PGM
    • DEST
Note: No automatic prefixing of user ID to data set names are performed by Z Abend Investigator for this command. All data set names must be fully qualified and specified without quotes.

Return codes

The HFZALLOC command provides the following return codes:
0
The allocation was successful. If a member of a PDS or PDSE was allocated, the member exists and can be opened for read.
1
The allocation was successful. However, a non-existing member of a PDS or PDSE was allocated which cannot be opened for read. If the member is opened for read, a system abend S013 occurs.
4
Allocation failed. An explanation of the error is written to the HFZTRACE DDname. Allocation or concatenation errors relating to data sets, other than the first data set name specified, will not terminate the HFZALLOC command; processing continues.
8
Command syntax error. An explanation of the error is written to the HFZTRACE DDname.

Example

Figure 1. HFZALLOC command example
/* REXX */

/* Allocate an existing data set to DDname DD1 */
"HFZALLOC DD(DD1) DSN(FRED.LISTING) SHR"
if RC = 0 then say 'Success!'

/* Allocate a temporary sequential work data set to DDname DD2 */
"HFZALLOC DD(DD2) DSN(FRED.SEQ) NEW DELETE SPACE(2,3) UNIT(SYSALLDA) ",
         "RECFM(FB) LRECL(80)"

/* Allocate a new partitioned data set to DDname DD3 */
"HFZALLOC DD(DD3) DSN(FRED.PDS) NEW CATALOG SPACE(2) UNIT(SYSALLDA) ",
         "DIR(5) RECFM(VBA) LRECL(137)"

/* Allocate default JES spool data set to DDname DD4 */
"HFZALLOC DD(DD4) SYSOUT"

/* Allocate internal reader for submission of job to DDname DD5 */
"HFZALLOC DD(DD5) SYSOUT PGM(INTRDR)"
if rc = 0 then do /* Check rdr allocation */
----processing----
end
else "HFZWTO INTRDR FAILED ALLOCATION"

/* Allocate a list of load libraries to the HFZRLOAD DDname */
"HFZALLOC DD(HFZRLOAD) DSN(MY.LOADLIB1 MY.LOADLIB2 MY.LOADLIB3) SHR"

/* Allocate a new PDSE history file data set named MY.HIST */
"HFZALLOC DD(DD6) DSN(MY.HIST) NEW CATALOG LIBRARY,
          RECFM(VB) LRECL(10000) SPACE(20,20)"