Hitachi

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


5.8.5 Defining shell variables that handle path names

The #-adsh_path_var command enables you to define shell variables that handle path names. When you use shell variables that handle path names, you can convert the path and directory separators in character strings containing path names according to the environment being used, such as between Windows and UNIX.

JP1/Advanced Shell converts the path and directory separators in character strings that satisfy all the conditions listed below. For details about path conversion settings 1 and 2, see PATH_CONV_RULE parameter (defines a rule for converting file paths) (Windows only).

You can use the #-adsh_path_var command only in either of the following cases:

You can specify a continuation line as shown below. Note that no shell variable name can be specified after the #-adsh_path_var command on the first line.

  Line 1: #-adsh_path_var
  Line 2: #-adsh  var001,var002,var003,var004
Organization of this subsection

(1) Examples

This example defines shell variables PATH, DIR, and DIR3 that handle path names in the #-adsh_path_var command.

(a) In Windows

  • Specification of the environment file

    #-adsh_conf PATH_CONV_ENABLE / :    <--Enable path conversion.
    #-adsh_conf PATH_CONV_RULE 1                       <--Select path conversion setting 1.
    #-adsh_conf PATH_CONV /home/hitachi "C:\\hitachi"  <--Path string substitution 1.
    #-adsh_conf PATH_CONV /tmp/jp1as "D:\\jp1as_tmp"   <--Path string substitution 2.
    #-adsh_conf PATH_CONV /tmp "C:\\temp"              <--Path string substitution 3.
    #-adsh_conf PATH_CONV_ACCESS /dev/null nul    <--Convert file paths during file input and output.
  • Specification of the job definition script

    #-adsh_path_var PATH,DIR,DIR3    <--Shell variable definition 1.
     
    DIR="/home/hitachi/bin"    <--Convert to DIR="C:\\hitachi\\bin" by path string substitution 1.
     
    "$DIR/myprog"    <--Convert to "$DIR\\myprog" by shell variable definition 1.
     
    "${DIR}/myprog"    <--Convert to "${DIR}\\myprog" by shell variable definition 1.
     
    DIR2=$DIR
    "$DIR2/myprog"    <--$DIR2 is not converted because it is not in shell variable definition 1.
     
    $DIR/myprog    <--Not converted because this is not enclosed in double quotation marks (").
     
    FILE1="/tmp/jp1as/file"    <--Convert to "D:\\jp1as_tmp\\file" by path string substitution 2.
     
    DIR3=""
    ls "$DIR3../bin"    <--Convert to "..\\bin" by shell variable definition 1. Relative paths are also converted.
     
    DIR4="/home/hitachi/sbin:$DIR2"    <--Convert to C:\\hitachi\\sbin;$DIR2 by path string substitution 1. Path separators are also converted.
     
    PATH="../bin/:$DIR"    <--Convert to ..\\bin\\;$DIR by shell variable definition 1. Path separators are also converted.
     
    "$DIR2/myprog" > /dev/null    <--Convert to nul by file path conversion during file input and output.

(b) In UNIX

  • Specification of the environment file

    #-adsh_conf PATH_CONV_ENABLE \\ ;    <--Enable path conversion.
    #-adsh_conf PATH_CONV "C:\\hitachi" /home/hitachi  <--Path string substitution 1.
    #-adsh_conf PATH_CONV "D:\\jp1as_tmp" /tmp/jp1as   <--Path string substitution 2.
    #-adsh_conf PATH_CONV "C:\\temp" /tmp     <--Path string substitution 3.
    #-adsh_conf PATH_CONV_ACCESS nul /dev/null    <--Convert file paths during file input and output.
  • Specification of the job definition script

    #-adsh_path_var PATH,DIR,DIR3    <--Shell variable definition 1.
     
    DIR="C:\\hitachi\\bin"    <--Convert to DIR="/home/hitachi/bin" by path string substitution 1.
    "$DIR\\myprog"    <--Convert to "$DIR/myprog" by shell variable definition 1.
     
    "${DIR}\\myprog"    <--Convert to "${DIR}/myprog" by shell variable definition 1.
     
    DIR2=$DIR
    "$DIR2\\myprog"    <--$DIR2 is not converted because it is not in shell variable definition 1.
     
    $DIR\\myprog    <--Not converted because this is not enclosed in double quotation marks (").
     
    FILE1="D:\\jp1as_tmp\\file"    <--Convert to "/tmp/jp1as/file" by path string substitution 2.
     
    DIR3=""
    ls "$DIR3..\\bin"    <--Convert to "../bin" by shell variable definition 1. Relative paths are also converted.
     
    DIR4="C:\\hitachi\\sbin;$DIR2"    <--Convert to /home/hitachi/sbin:$DIR2 by path string substitution 1. Path separators are also converted.
     
    PATH="..\\bin\\;$DIR"    <--Convert to ../bin/:$DIR by shell variable definition 1. Path separators are also converted.
     
    "$DIR2\\myprog" > nul    <--Convert to /dev/null by file path conversion during file input and output.

(2) Example output to job definition script images

JP1/Advanced Shell outputs a job definition script before path conversion and the lines after conversion to job execution logs. JP1/Advanced Shell also outputs as messages the conversion rules that were satisfied in the job definition script, job definition script name, and line numbers.

********  JOB CONTROLLER MESSAGE  ********
(omitted)
10:48:48 000007 KNAX6803-I The access path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=4 path converted="./local.log":".\\mylog"
(omitted)
 
********   Script IMAGE    ********
 
***** D:\home\user001\path_conv.ash *****
0001 : #-adsh_job JOB001
0002 : #-adsh_path_var DIR
0003 : DIR="/home/hitachi/bin"; DIR2="/tmp/tmpfile"
0004 : "$DIR/myprog" > ./local.log
0005 : exit
 
***** Converted lines in "D:\home\user001\path_conv.ash" *****
0003 : DIR="c:\\Program Files"; DIR2="c:\\temp\\tmpfile"
0004 : "$DIR\\myprog" > ./local.log
 
***** CONVERSION INFORMATION *****
KNAX6800-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=3 path converted="/home/hitachi/bin":"c:\\Program Files"
KNAX6800-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=3 path converted="/tmp":"c:\\temp"
KNAX6801-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=4 shell variable handling path="DIR"