Reviewing Attributes of Allocated Files Under MVS


You can check on existing file allocations using the command ? TSO DDNAME. This can be done in the following ways:




Lists allocated files. Produces a listing on file SYSPRINT even if you issue the OFFLINE command.

? TSO DDNAME ddname

Lists file attributes. Produces a listing on file SYSPRINT even if you issue the OFFLINE command.

-? TSO DDNAME ddname

Places file attribute information into Dialogue Manager variables. Attributes are returned as values for Dialogue Manager variables.

Displaying Allocated Files With ? TSO DDNAME Under MVS

How to:

The ? TSO DDNAME command lists all the currently allocated files by ddname, shows the number of occurrences for each and lists their corresponding data set names. It displays currently allocated files.

Syntax: How to Display Allocated Files With ? TSO DDNAME


Example: Displaying Allocated Files With ? TSO DDNAME

The following is sample output from a ? TSO DDNAME command.

STEPLIB                2        EDA.V3R2M01.EDALIB.LOAD
MASTER                 1        EDA.V3R2M01.EDAMFD.DATA
FOCEXEC                1        EDA.V3R2M01.EDAMFD.DATA
ERRORS                 1        EDA.V3R2M01.EDAMSG.DATA
FOCSORT                1        SYS88229.TO95540.RA000.INPDQ.R0000002
SYSUT1                 1        SYS88229.TO95058.RA000.INPDQ.SYSUT1
SYSEDIT                1        SYS88229.T095058.RA000.INPDO.EDIT
HOLD                   1        SYS88229.TO95058.RA000.INPDQ.R0000003
HOLDMAST               1        SYS88229.T095044.RA000.INPDQ.R0000004
CAR                    1        EDA.V3R2M01.CAR.FOCUS

The DDNAME column lists all allocated file names (ddnames). The OCCURRENCES column shows how many data sets are allocated to the corresponding ddname. This number will be one unless two or more data sets are concatenated under the ddname. The DSNAME column shows the fully qualified data set name (DSN) corresponding to the ddname. For concatenated data sets, all the data set names are shown.

Displaying File Attributes With ? TSO DDNAME ddname Under MVS

How to:

The ? TSO DDNAME ddname command displays attributes of the queried file name (ddname). If the specified ddname was not allocated, the command displays the attributes as either blanks or zeroes.

Syntax: How to Display File Attributes With ? TSO DDNAME ddname

? TSO DDNAME ddname



Is the ddname whose attributes you want to display. You may specify up to eight characters. You may also create a general list of allocated files by ddname by specifying a wildcard character (* or ?) with part of the ddname.

Displaying File Attributes With ? TSO DDNAME ddname

The following is sample output from a ? TSO DDNAME ddname command.

DDNAME               =              CAR
DSNAME               =              EDA.VSR2M00.CAR.FOCUS
DISP                 =              OLD
DEVICE               =              DISK
VOLSER               =              TSOPAK
DSORG                =              PS
RECFM                =              F
SECONDARY            =                1
ALLOCATION           =              TRACKS
BLKSIZE              =              4096
LRECL                =              4096
TRKTOT               =                2
EXTENTSUSED          =                1
BLKSPERTRK           =               10
TRKSPERCYL           =               15
CYLSPERDISK          =              886
BLKSWRITTEN          =               20
FOCUSPAGES           =                8

Placing File Attributes in Dialogue Manager Commands


The -? TSO DDNAME ddname command places file attribute information in Dialogue Manager variables instead of displaying the information on the terminal. These Dialogue Manager TSO system variables have the same names as the attributes returned by the ? TSO DDNAME ddname command. For a complete list of these variables, see Dialogue Manager TSO System Variables.

If there is no information for a variable, the variable will contain blanks if it is an alphanumeric variable. If it is a numeric variable, the variable will contain zeroes.

Reference: Dialogue Manager TSO System Variables

TSO System Variable



Queried file name (ddname).


Fully qualified data set name. For concatenated data sets, only the first data set name is returned.


Disposition: OLD, NEW, MOD, or SHR.




Disk or tape volume serial number.


Data set organization: PS (sequential), IS (indexed sequential), PO (partitioned), U (undefined), or DA (direct).


Record format, for example, F, FB, V, VB.


Quantity specified for secondary allocations.


Unit of secondary allocation: TRACKS, BLOCKS, or CYLINDER.




Record length, in bytes.


Total number of currently allocated tracks, spanning both primary and secondary allocation.


Total number of currently allocated extents (max 16).


The number of blocks (of BLKSIZE bytes) that can be written onto 1 track of the device.


The number of tracks per cylinder for the device.


The number of cylinders per disk for the device.


The total number of blocks in the data set, assuming that all blocks are BLKSIZE long.


Posted only for FOCUS data sources. This number is the total number of 4096-byte pages in the data source. This is the same as the total number of pages shown by the ? FILE file name command. It is also the same as the highest page number shown by the ? FDT file name command. It does not include SHADOW pages and directory.

Example: Using TSO ddname Variables


The process is as follows:

  1. The command prompts you for the ddname. The information that is entered from the terminal is then placed in the variable &DD. Depending on the value of &DD, the system supplies the information for the variable &DSNAME. If no data set is allocated to the ddname that was supplied, the variable &DSNAME will contain a blank since it is alphanumeric.
  2. The command tests if the variable &DSNAME is a blank. If it is blank (that is, no data set was found for the ddname entered by the operator), the procedure jumps to the label -ALLOCATE and continues. If it is not blank (that is, a data set was found for the ddname entered by the operator), the procedure prints a message stating the name of the data set and exits.

For detailed information on Dialogue Manager commands and variables, see Managing Flow of Control in an Application.

Reference: Issuing the -? TSO DDNAME Command From a Windows Server

If you attempt to issue the -? TSO DDNAME command remotely on MVS EDA from a WebFOCUS Windows Server, the following error message is generated:


When sending the -? TSO DDNAME command from a Windows Server to MVS, you must place -? TSO DDNAME and a -TYPE command (to display the results in Windows), in a procedure (FOCEXEC) between -REMOTE BEGIN and -REMOTE END, as follows:

ex Remote.fex

The Remote.fex procedure, which will execute on MVS and send the results back to windows, must contain the following:


You can run Remote.fex from another procedure, or the Command Console.

Determining If a Data Source Exists Under MVS

How to:

Since you can logically erase an existing data set by issuing a CREATE command against it, it is necessary to have a means of testing for the existence of an Operating System data set before issuing the CREATE command.

Syntax: How to Test for a Data Set

? {MVS|TSO} DSNAME datasetname



Is the data set name. If you supply only the unqualified data set name, the prefix from the profile is taken to create a fully qualified data set name. Do not specify member names.

Syntax: How to Test for a Data Set in Dialogue Manager

-? TSO DSNAME dsname



Is the data set name.

In this case, there is no output message. The system variable &RETCODE is set and must be tested for the outcome. The possible results follow:


Equivalent FOCUS Code/Message


(FOC488) Dataset is in catalog:


(FOC489) Dataset is in catalog, but not on volume indicated:


(FOC490) Dataset is not in catalog:

Estimating Data Set Sizes to Determine Available Space Under MVS

You can use the file attribute information returned by the ? TSO ddname command to determine the number of records in the data set and to estimate how much available space is left on the currently allocated tracks.

Note: The estimates obtained from the following formulas are approximations and do not take into account space reused after it was logically vacated by deleted segments.

  • FOCUS data source formulas:
    Available pages (without additional extents) = BLKSWRITTEN - 
  • Fixed-block data set formulas:
    No. of records = BLKSWRITTEN x RECSPERBLK
    No. of free blocks = (TRKTOT x BLKSPERTRK) - BLKSWRITTEN
  • Variable-length blocked data sets:

    The formulas for fixed-block data sets (that is, SAVE files) usually apply to variable-length blocked (VB) data sets as well. This is true because VB data sets usually have the same length blocks even though the description implies otherwise.

  • If SET SHADOW=ON, use the following formula:
    (FOCUSPAGES x 2) + 3