Skip to main content

ASSIGN

Assigns a value to the SYSTEM or STATUS functions.

Synopsis

ASSIGN value TO SYSTEM(code)

ASSIGN int TO STATUS()

Arguments

value An expression that evaluates to a value. This may be an integer value or a string value, depending on the SYSTEM() function.
int An expression that evaluates to an integer value. A non-integer values is truncated to an integer. A non-numeric value evaluates to 0.
code An integer code specifying which SYSTEM code information to modify. For a list of codes, refer to the SYSTEM function.

Description

The ASSIGN statement is used either to assign an integer return value to the STATUS function, or to assign a return value to one of the SYSTEM function options. Assignments apply to the current process.

When assigning a STATUS function value, value must be a literal, variable, or arithmetic expression that resolves to a positive or negative integer. A fractional number is truncated to its integer portion. A string is truncated at the first non-numeric character. A non-numeric string resolves to the numeric value 0. If you exit and re-enter the MV Shell, the STATUS function value is reset to 0.

Most SYSTEM functions cannot be assigned a value using this command. SYSTEM(2), SYSTEM(3), and SYSTEM(7) can be assigned a value. Only a valid terminal type can be assigned to SYSTEM(7). If you exit and re-enter the MV Shell, these SYSTEM function values persist until explicitly reset.

Examples

The following example reduces the terminal's page width setting by 10 characters:

pwidth=SYSTEM(2);   ! The old page width
PRINT pwidth
ASSIGN pwidth-10 TO SYSTEM(2)
PRINT SYSTEM(2);    ! The new page width

In the following example, the first ASSIGN sets the terminal (channel 0) page width to 20. The PRINTER ON statement changes channel 0 to the current printer. The second ASSIGN sets the printer (channel 0) page width to 40. The PRINTER OFF reverts channel 0 to the terminal, which now has a page width of 40:

EXECUTE "TERM"
ASSIGN 20 TO SYSTEM(2)
EXECUTE "TERM"
PRINTER ON
ASSIGN 40 TO SYSTEM(2)
PRINTER OFF
EXECUTE "TERM"

See Also

FeedbackOpens in a new tab