Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


typeset command (declares explicitly the attributes and values of variables and functions)

Organization of this page

Format

typeset  [{-L|+L}  [n]]  [{-R|+R}  [n]]  [{-Z|+Z}  [n]]
         [-l|+l|-u|+u] [{-i|+i} [n]] [-r|+r|-x|+x]
         [{-f|+f} [-t|+t] [-u]]
         [-p|+p]
         [--] [name  [=value]...]

Description

This command declares explicitly the attributes and values of variables and functions. You can use this command to define specified variables and functions (specified in name), as well as to declare explicitly attributes and values for them.

When this command is executed within a function, it defines local variables that are valid within that function only. Those values and attributes revert when the function terminates.

The options for this command are organized into the four categories of character string formatting options, attribute and type options, function options, and display options.

Arguments

You prefix each option specification with a minus sign (-) to enable the option (attribute) or a plus sign (+) to disable it.

[{-L|+L} [n]] [{-R|+R} [n]] [{-Z|+Z} [n]]
  • -L|+L

    These are character string formatting options. The -L option left-justifies the contents of the variables. The +L option removes any left-justification that has been set.

    When a value is set in a variable and the length of the area is greater that the length of the specified value, this option pads the trailing remainder of the area with spaces. If the length of the specified value is greater than the length of the area, the trailing portion of the value is truncated to fit in the region

    If the -Z option is also specified, leading zeros are stripped. If the -R option is also specified, the one specified last takes effect.

    If the item whose name is specified in name is already defined with the -R option, its right-justification setting is disabled.

  • -R|+R

    This is a character string formatting option. The -R option right-justifies the contents of the variables. The +R option removes any right-justification that has been set.

    When a value is set in a variable and the length of the area is greater than the length of the specified value, this option pads the beginning of the area with spaces. If the length of the specified value is greater than the length of the area, the beginning portion of the value is truncated to fit in the region. If -L and -R are both specified, the one specified last takes effect.

    If the item whose name is specified in name is already defined with the -L option, its left-justification setting is disabled.

  • -Z|+Z

    This is a character string formatting option. The -Z option pads the contents of the variables with zeros. The +Z option removes any zeros-padding that has been set.

    Unless the -L option is set, the contents will be right-justified. If the first character of the value specified in value is a numeric, the beginning of value is padded with zeros. If the first character of the value specified in value is a non-numeric, the beginning of value is padded with spaces.

  • n

    Specifies the length of the area for value. If 0 is specified or n is omitted, the length of the area will be the length of the value specified in value. An error results if you specify a value for n that exceeds 16,385.

[-l|+l|-u|+u]
  • -l|+l

    These are character string formatting options. The -l option converts the letters assigned to a variable specified in name from uppercase to lowercase. If the character string assigned to the variable contains a mixture of uppercase and lowercase, this option converts only the uppercase letters to lowercase letters. If the -u option is also specified, the option specified last takes effect.

    The +l option removes any uppercase-to-lowercase conversion that has been set.

  • -u|+u

    This is a character string formatting option. The -u option converts the letters assigned to a variable specified in name from lowercase to uppercase. If the character string assigned to the variable contains a mixture of uppercase and lowercase, it converts only the lowercase letters to uppercase letters. If the -l option is also specified, the option specified last takes effect.

    The +u option removes any lowercase-to-uppercase-conversion attribute that has been set.

[ {-i|+i} [n]] [-r|+r|-x|+x]
  • -i|+i

    These are attribute and type options. The -i option declares that the type of a variable specified in name is integer. When this option is specified, the value assigned to value must be in decimal. If you use -i to specify a base other than 10, 'base#' will be prefixed at the beginning of the contents of the variable specified in name. If you also specify the -Z option to set zero-padding, the area up to the beginning of 'base#' will be padded with leading zeros.

    The +i option removes any integer type attribute for a variable specified in name.

  • n

    Specifies the base in which name is to be displayed when it is output. If 0 is specified or n is omitted, and name is an undefined variable, the name item will be treated as a decimal number. If 0 is specified or n is omitted, and name is a defined variable, the name item will use the base that has already been defined for it. An error results if you specify a base of 1 or a base greater than 16.

  • -r|+r

    These are attribute and type options. The -r option sets the read-only attribute for a variable specified in name. Once the read-only attribute is set for a variable, neither the variable's value nor any of its attributes can be changed.

    The +r option removes any read-only attribute that has been set.

  • -x|+x

    These are attribute and type options. The -x option exports a variable specified in name. The +x option cancels exporting of a variable specified in name.

    When you export variables in Windows, the supported variable names are handled as follows:

When DISABLE is specified in the VAR_ENV_NAME_LOWERCASE parameter

All letters contained in variable names must be in uppercase because shell variables whose names contain lowercase letters cannot be exported.

If a variable containing a lowercase letter is specified for name, an error message is output and the batch job terminates.

When ENABLE is specified in the VAR_ENV_NAME_LOWERCASE parameter

Shell variables whose names contain lowercase letters can be exported.

Note that environment variables are not case sensitive. The last shell variable with the same spelling that was exported becomes the final environment variable value.

{-f|+f} [-t|+t] [-u]
  • -f|+f

    These are function options. The -f option declares that the processing targets specified in name are to be treated as functions, not variables. When the command is executed with the -f option specified, functions specified in name are also output to the standard output. Functions are not displayed when the command is executed with the +f option.

    When the command is executed with only -f specified, and with no name specification, all currently defined functions are output to the standard output.

  • -t|+t

    These are function options. When specified together with the -f option, the -t option enables the trace mode for a function specified in name.

    The +t option disables the trace mode for a function specified in name.

  • -u

    This is a function option. When specified together with the -f option, the -u option enables the auto-load functionality for a function specified in name.

-p|+p

These are display options. The -p option outputs all defined variables to the standard output in the format typeset variable-name=value. If you specify the -p option and name at the same time, the declaration of attributes for the variable specified in name takes precedence.

The +p option outputs all defined variables to the standard output in the format typeset variable-name.

No options specified

This is a display option. When this command is executed with no options specified, all the defined variables are output to the standard output. Each variable name is preceded by the values of the attribute and type options declared in typeset. When no attribute and type options have been declared, the variable name is displayed left-justified.

Option only specified without a name specification

This is a display option. All the variables and functions with the specified property are output. If the option is prefixed with a hyphen (-), what is output to the standard output is variable-name=value or the contents of each function. If the option is prefixed with a plus sign (+), only the names of the variables or functions are output to the standard output.

--

Specifies the end of the option specifications. Any options specified after this option are interpreted as part of a variable name.

name

Specifies a variable name, array name, or function name whose attributes and values are to be declared. You can specify multiple variable names, array names, and function names.

When you specify an array name, the declaration applies to all the elements that constitute the array, even if you specify only one element of the array.

You can specify = after name to assign a value to name and declare its attributes at the same time.

If the read-only attribute is set for the variable specified in name and you attempt to set a value for it, the command will terminate with an error.

value

Specifies a value to be assign to the paired name. If value is omitted, the linefeed character is assigned, and then the attribute changes are made.

Return codes

Return code

Meaning

0

Normal termination

1

Error termination

Notes

Usage examples