Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 - Asset Console Creating an Access Definition File Guide


[SUB] (subroutine)

[SUB] defines processing that is reused as a single process block. Subroutines are not executed, even if they go through the processing path; subroutines are executed using the $GOSUB embedded function. This means that the subroutine must be defined before the $GOSUB embedded function is specified.

Organization of this page

Syntax

[SUB]
  subroutine-name
  . . .
[SUB_END]
[BEGIN]
  . . .
  [SET_VALUE]
    $GOSUB(subroutine-name)
[END]

Values

Example

The following example defines a subroutine that outputs data to a Command Prompt window.

In this example, by specifying -s MSG=1 as an option in the jamscript command, the text set for ECHOMSG is output to a Command Prompt window:

[SUB]
  ECHO
  [IF]
    MSG = '1'
  [THEN]
    [SET_VALUE]
      $ECHO(ECHOMSG)
  [IF_END]
[SUB_END]
 
[BEGIN]
  [SET_VALUE]
    MSG = $GETSESSION('MSG')
 
    ECHOMSG = 'Hello world'
    $GOSUB(ECHO)
[END]
Executed command:

jamscript -f Example.txt -s MSG=1

Execution result:

Hello world