A structure is defined for an object (such as a file: SHOW-FILE-ATTRIBUTES FILE-NAME=name
) specified in the SHOW command. If a number of objects are specified (using a wildcard, for example: SHOW-FILE-ATTRIBUTES FILE-NAME=nam*
), or if a number of command outputs are written to a single S variable (see ASSIGN-STREAM
, "Assigning S variable streams"), a list of structures is created. For each item of information relating to the object (e.g. catalog ID, file size), an S variable is defined as an element of the structure and assigned the information item as its contents.
Example 1
/declare-var var-name=out(type=*structure),multiple-elements=*list /execute-cmd cmd=(show-file-attr file-name=job*,inf=*name-and-space), text-output=*none,structure-output=out /show-var out,inf=*par(list-index-number=*yes) OUT#1.F-NAME = :2OSG:$USER1.JOBA OUT#1.CAT-ID = 2OSG OUT#1.USER-ID = USER1 OUT#1.SHORT-F-NAME = JOBA OUT#1.F-SIZE = 3 OUT#2.F-NAME = :2OSG:$USER1.JOBB OUT#2.CAT-ID = 2OSG OUT#2.USER-ID = USER1 OUT#2.SHORT-F-NAME = JOBB OUT#2.F-SIZE = 3 OUT#3.F-NAME = :2OSG:$USER1.JOBC OUT#3.CAT-ID = 2OSG OUT#3.USER-ID = USER1 OUT#3.SHORT-F-NAME = JOBC OUT#3.F-SIZE = 3
Key to Example 1
The user-defined S variable OUT
contains the entire output. The string (#i)
indicates that OUT
is a list variable that may contain many elements. In this example there are three elements (i = 1 to 3).
A structure composed of various separate items of information is generated for each object selected by FILE-NAME=JOB*
. Each item is stored in a separate S variable, such that the S variable OUT(#i).CAT-ID
, for example, contains the catalog ID.
Example 2
/execute-cmd cmd=(show-file-attr file-name=job*,inf=*par(alloc=*yes)), text-output=*none,structure-output=out /show-var out,inf=*par(list-index-number=*yes) OUT#1.F-NAME = :2OSG:$USER1.JOBA OUT#1.CAT-ID = 2OSG OUT#1.USER-ID = USER1 OUT#1.SHORT-F-NAME = JOBA OUT#1.F-SIZE = 3 OUT#1.SUP = *PUB OUT#1.HIGHEST-USED-PAGES = 1 OUT#1.SEC-ALLOC = 24 OUT#1.BLOCK-COUNT = 0 OUT#1.EXT#1.VOL = GVS2.2 OUT#1.EXT#1.DEV = D3435 OUT#1.EXT#1.NUM-OF-EXT = 1 OUT#1.NUM-OF-EXT = 1 OUT#2.F-NAME = :2OSG:$USER1.JOBB OUT#2.CAT-ID = 2OSG OUT#2.USER-ID = USER1 OUT#2.SHORT-F-NAME = JOBB OUT#2.F-SIZE = 3 OUT#2.SUP = *PUB OUT#2.HIGHEST-USED-PAGES = 1 OUT#2.SEC-ALLOC = 24 OUT#2.BLOCK-COUNT = 0 OUT#2.EXT#1.VOL = GVS2.3 OUT#2.EXT#1.DEV = D3435 OUT#2.EXT#1.NUM-OF-EXT = 1 OUT#2.NUM-OF-EXT = 1 OUT#3.F-NAME = :2OSG:$USER1.JOBC OUT#3.CAT-ID = 2OSG OUT#3.USER-ID = USER1 OUT#3.SHORT-F-NAME = JOBC OUT#3.F-SIZE = 3 OUT#3.SUP = *PUB OUT#3.HIGHEST-USED-PAGES = 1 OUT#3.SEC-ALLOC = 24 OUT#3.BLOCK-COUNT = 0 OUT#3.EXT#1.VOL = GVS2.0 OUT#3.EXT#1.DEV = D3435 OUT#3.EXT#1.NUM-OF-EXT = 1 OUT#3.NUM-OF-EXT = 1
Key to Example 2
The user-defined list variable OUT
from Example 1 again holds three elements in Example 2. The argument INF=*PAR(ALLOC=*YES)
causes all file attributes relating to space allocation to be output for the selected files. The attributes F-NAME, CAT-ID, USER-ID,....,EXT
form the elements of the structure. The EXT
element is in turn a list composed of the elements VOL
, DEV
and NUM-OF-EXT
.
If information for an object can be further subdivided hierarchically (see the EXT
element), a compound S variable is defined as an element of the higher-ranking structure for each hierarchy. A hierarchically lower-ranking S variable may be a simple S variable (see VOL
, DEV
, NUM-OF-EXT
), a structure or a list of simple S variables and/or structures.
S variable name components
The names of the list elements (e.g. F-NAME, F-SIZE
) are preset for each SHOW command. They are appended to the S variable name declared by the user. The names match the corresponding operand names as closely as possible. If the information on this level is further subdivided hierarchically, further names are appended, preceded by a dot as separator.
S variable contents
The contents of S variables match the corresponding operand values as closely as possible. The data type and thus the character set that BS2000 uses to output the values is specified for each variable in the manual: String, Integer or Boolean.
S variable data types
The type of the S variable is always *ANY.