Hitachi

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


VAR_SHELL_FUNCINFO parameter (selects whether function information arrays are used)

Organization of this page

Format

#-adsh_conf VAR_SHELL_FUNCINFO {TYPE_A|TYPE_B|NONE}

Description

This parameter defines whether function information arrays are used. Arrays of function information are single-dimensional arrays for storing information about the function being executed by the adshexec command.

There are three types of function information arrays, as listed below. For details about the function information arrays, see 5.5.3 Arrays of function information.

Operands

TYPE_A

Specifies that function information arrays whose names begin with ADSH_ are to be used, as shown in the following:

Array type

Array name

Called function name array

ADSH_FUNCNAME

Function call line number array

ADSH_LINENO

Function definition script file name array

ADSH_SOURCE

TYPE_B

Specifies that function information arrays whose names are the same as the following are to be used:

Array type

Array name

Called function name array

FUNCNAME

Function call line number array

BASH_LINENO

Function definition script file name array

BASH_SOURCE

NONE

Specifies that function information arrays are not to be created.

This operand enables you to use the arrays that are created when TYPE_A or TYPE_B is specified as normal arrays.

Notes

Examples

This example runs the following job definition script in an environment where TYPE_A is specified in the VAR_SHELL_FUNCINFO parameter:

/home/user/script/adsh_func.ash
0001 : func1(){               # Define function func1
0002 :  function func1_2 {    # Define function func1_2
0003 :    echo "in func1_2"
0004 :    func2               # Call function func2 from function func1_2
0005 :  }
0006 :  echo "in func1"
0007 :  . ./func2.ash    # Load the external script that defines function func2 by using the . (dot) command
0008 :  func1_2           # Call function func1_2 from function func1
0009 : }
0010 :
0011 : echo "main_script start"
0012 : export FPATH=`pwd`    # Store the current work directory in shell variable FPATH
0013 : #-adsh_script ./func3.ash # Load the external script that defines function func3 by using #-adsh_script
0014 : autoload func4        # Enable the function preload functionality for function func4
0015 :
0016 : func1                 # Call function func1
0017 : echo "main_script end"
/home/user/script/func2.ash
0001 : func2(){
0002 :   echo "in func2"
0003 :   func3
0004 : }
/home/user/script/func3.ash
0001 : func3(){
0002 :   echo "in func3"
0003 :   func4
0004 : }
/home/user/script/func4
0001 : func4(){
0002 :   echo "in func4"
0003 :   cnt=0
0004 :   for cnt in 0 1 2 3 4 5
0005 :   do
0006 :     echo "ADSH_FUNCNAME[$cnt] = ${ADSH_FUNCNAME[$cnt]}"
0007 :     echo "ADSH_LINENO[$cnt]   = ${ADSH_LINENO[$cnt]}"
0008 :     echo "ADSH_SOURCE[$cnt]   = ${ADSH_SOURCE[$cnt]}"
0009 :   done
0010 : }

Stack information for one function is output on each echo command line.

The following table lists the values in the function information arrays when function func4() is executing:

Element no.

Array name

ADSH_FUNCNAME

ADSH_LINENO

ADSH_SOURCE

0

func4

3

/home/user/script/func4

1

func3

3

/home/user/script/func3.ash

2

func2

4

/home/user/script/func2.ash

3

func1_2

8

/home/user/script/adsh_func.ash

4

func1

16

/home/user/script/adsh_func.ash

5

main

0

/home/user/script/adsh_func.ash

If you use an environment where TYPE_B is specified in the VAR_SHELL_FUNCINFO parameter, change the contents of job definition script /home/user/script/func4 as follows:

0001 : func4(){
0002 :   echo "in func4"
0003 :   cnt=0
0004 :   for cnt in 0 1 2 3 4 5
0005 :   do
0006 :     echo "FUNCNAME[$cnt]      = ${FUNCNAME[$cnt]}"
0007 :     echo "BASH_LINENO[$cnt]   = ${BASH_LINENO[$cnt]}"
0008 :     echo "BASH_SOURCE[$cnt]   = ${BASH_SOURCE[$cnt]}"
0009 :   done
0010 : }