Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Panel
Table of Contents

Anchor
1154173
1154173
Syntax

Wiki Markup
*diskspace* _logical-name_\[=_path_\] \[_qty_=_nnn_\{*b*\|*k*\|*m*\|*g*\}\] \[_cond_=\{*GT*\|*LT*\}\]

Anchor
1154175
1154175
Description

The diskspace command retrieves the amount of space available on a volume or file system.

UDM executes the command on the system identified by the logical-name parameter. This parameter must match a logical name specified in the open command. Use "local" to refer to the primary server session in a two-party transfer.

To retrieve the available space for an entire volume or file system, simply specify any directory path that exists there. If no path is specified, UDM uses the current working directory to determine which device to check.

Whenever UDM executes the diskspace command, it stores the number of available bytes in the _diskspace built-in variable. The .kb, .mb, and .gb attributes provide access to the available quantity in kilobytes, megabytes, or gigabytes. For example, the amount of available space in megabytes is accessed using $(_diskspace.mb).

While the $(_diskspace) variable may be used in calculations and evaluations, the diskspace command provides the optional qty and cond parameters to quickly test whether the amount of available space is more or less than a specified quantity. UDM sets the _lastrc built-in variable to 0 (zero) if the result of the test evaluates to true. UDM sets $(_lastrc.result) to a non-zero value when the test evaluates to false.

The amount of space that the diskspace command will check for is specified with the qty parameter. The quantity can be expressed in terms of bytes, kilobytes, megabytes and gigabytes. If no unit is specified, the default is bytes.

The optional cond parameter specifies whether the diskspace command will test for available space that is greater than (GT, the default) or less than (LT) the specified quantity (qty).

If the test succeeds, diskspace sets $(_lastrc.result) to 0 (zero) and $(_lastrc.message) to "SUCCESS". If the test fails, diskspace sets $(_lastrc.result) to non-zero and $(_lastrc.message) to "ERROR".

For example, given a diskspace command where qty=100m and cond=GT, UDM sets $(_lastrc.result) to 0 (zero) if more than 100 megabtyes (MB) of space is available. If exactly 100MB or less is available, then $(_lastrc.result) is set to a non-zero value. Conversely, if qty=100m and cond=LT, UDM sets $(_lastrc.result) to 0 only when there is less than 100MB space available.

Anchor
1154185
1154185
Parameters

HTML Table
cellspacing0
styletext-align: left; width: 100%;
classTable_with_Header
Table Row (tr)
Table Cell (td)
stylebackground-color: #F0F0F0; border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: middle; width: 144pt;

Anchor
1154189
1154189
Parameter

Table Cell (td)
stylebackground-color: #F0F0F0; border-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: middle; width: 360pt;

Anchor
1154191
1154191
Description

Table Row (tr)
Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Anchor
1154193
1154193
logical_name

Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Name of the system where UDM checks available space.

If path is specified, diskspace checks the volume or file system where that directory resides. Otherwise, the current working directory is used.

Note
titleNote

On z/OS and IBM i, the current file system must be set to HFS (see the filesys command).

Table Row (tr)
Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Anchor
1154198
1154198
qty

Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Anchor
1154200
1154200
Amount of space that diskspace should look for.

Anchor
1154201
1154201
To specify a unit for the quantity, add one of the following letters to the quantity amount:

  • b - bytes
  • k - kilobytes (1,024 bytes)
  • m - megabytes (1,048,576 bytes)
  • g - gigabytes (1,073,741,824 bytes)

Anchor
1154206
1154206
If no unit is specified, the default (b - bytes) is used.

Anchor
1154207
1154207
If no quantity is specified, diskspace displays the available space.

Table Row (tr)
Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Anchor
1154209
1154209
cond

Table Cell (td)
styleborder-bottom-color: #E8E8E8; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #E8E8E8; border-left-style: solid; border-left-width: 1px; border-right-color: #E8E8E8; border-right-style: solid; border-right-width: 1px; border-top-color: #E8E8E8; border-top-style: solid; border-top-width: 1px; padding-bottom: 3pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; vertical-align: top;

Anchor
1154211
1154211
Instructs diskspace to check for an amount that is greater than (GT) or less than (LT) the specified quantity.

Anchor
1154212
1154212
This parameter is optional. If no condition is specified, GT is used.

Anchor
1154214
1154214
Examples


Anchor
1154215
1154215
The following example displays the amount of space available on the volume or file system that contains the directory c:\somedir.

Panel


Anchor
1154219
1154219
The following example verifies that the available space for the volume or file system that contains the current working directory is greater than 10GB.

Panel


Anchor
1154228
1154228
The statements below repeat the previous example using the $(_diskspace) built-in variable with the .gb attribute.

Panel


Anchor
1154240
1154240
The following example uses diskspace in the context of a forfiles statement, using the file's size in the comparison.

Panel


Anchor
1154258
1154258
The statements below repeat the previous example using the $(_diskspace) built-in variable. The if statement only allows the file copy if the number of bytes available on c: is greater than the size of the input file.

Panel


Anchor
1154258
1154258
The following example uses diskspace in the context of a forfiles loop, using the total size of several files to determine the quantity of space needed.

Panel


Anchor
1154258
1154258
The statements below repeat the previous example using the $(_diskspace) built-in variable.

Panel


Anchor
1154258
1154258
The following example would prevent a copy if the available space for the volume or file system that contains the specified directory is less than 20MB.

Panel

Anchor
1124154
1124154