Hitachi

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


6.2.20 Enabling and disabling the fault injection mode (joberrmode command)

You execute the joberrmode command to enable and disable the fault injection mode for the job definition script being debugged. The abbreviation of joberrmode is jem. The following shows the format of the joberrmode command:

joberrmode{on|off}
When on is selected:

The fault injection mode is enabled, which enables you to test cases where errors have occurred in the job. This mode is used to simulate errors when the C1 execution percentage rate is not 100% even though all execution paths have executed. For details about the case where the C1 execution percentage rate is not 100%, see 3.9.4(5) Case where the C1 execution percentage rate is not 100%.

When the fault injection mode is enabled, the debugger behaves as described in the following (the return code is not changed):

  • When abnormal or always is specified in the run attribute, the debugger executes the job step.

  • When the run attribute is omitted or normal is specified, the debugger does not execute the job step.

  • The debugger does not execute a command outside the job step.

  • If an error is injected within a step normal block, the debugger executes the commands within that step's step error block. The debugger executes the step error block without executing any subsequent command in that step even if cont is specified in the onError attribute.

When the run command is executed while the fault injection mode is on, the fault injection mode is reset to off.

When off is selected:

The fault injection mode is disabled.

Execution example 1

This example executes the job definition script shown in the following (the line numbers on the left correspond to the line numbers displayed in the execution results):

001  #!/bin/sh
002  
003  #-adsh_step_start STEP001                 <--Start of STEP001
004  
005  ./cmd1                                    <--Step normal block
006  
007  #-adsh_step_error                         <--Step error block
008  
009  ./cmd2
010  
011  #-adsh_step_end
012  
013  ./cmd3
014  
015  #-adsh_step_start STEP002 -run abnormal   <--Start of STEP002 (executed in the event of an error)
016  
017  ./cmd4                                    <--Step normal block
018  
019  #-adsh_step_error                         <--Step error block
020  
021  ./cmd5
022  
023  #-adsh_step_end
024  
025  ./cmd6
026  
027  echo JOB01-ended
Execution results 1

This example stops execution outside the step and uses the joberrmode command to enable the fault injection mode (the numbers at the right correspond to the numbers in the explanation provided below):

[jobuser1@HOST01 joberrmode]$ adshexec -d joberrmode.ash       <- 1.
KNAX7901-I The adshexec command will wait for all asynchronous processes at the end of the job.
KNAX0724-I The job ID was assigned. job ID=000037
(adshdb) b 2                                                   <- 2.
KNAX7015-W The breakpoint cannot be set at line "2". The breakpoint will be set at the next available line.
KNAX7018-I Breakpoint "1": filename="joberrmode.ash" line=3
(adshdb) b 17                                                  <- 3.
KNAX7018-I Breakpoint "2": filename="joberrmode.ash" line=17
(adshdb) run                                                   <- 4.
KNAX7007-I Execution of the following script will now start: /home/jobuser1/joberrmode/joberrmode.ash
 
KNAX0724-I The job ID was assigned. job ID=000038
KNAX0091-I ADSH000038 The job started.
KNAX7902-I The adshexec command will run in tty stdin mode.
 
KNAX7018-I Breakpoint "1": filename="joberrmode.ash" line=3    <- 5.
KNAX7032-I The script "joberrmode.ash" stopped running.
3: #-adsh_step_start STEP001
Current: #-adsh_step_start STEP001
(adshdb) info status                                           <- 6.
joberrmode:off                                                 <- 7.
(adshdb) joberrmode on                                         <- 8.
KNAX7126-I Fault injection mode is set to "on".
(adshdb) info status                                           <- 9.
joberrmode:on                                                 <- 10.
(adshdb) c                                                    <- 11.
KNAX7034-I The script will continue.
KNAX6508-I ADSH000038.STEP001 step was skipped because a previous step or command ended abnormally.
KNAX0092-I ADSH000038.STEP002 step started.
 
KNAX7018-I Breakpoint "2": filename="joberrmode.ash" line=17  <- 12.
KNAX7032-I The script "joberrmode.ash" stopped running.
17: ./cmd4
Current: ./cmd4
(adshdb) joberrmode off
KNAX7127-E Fault injection mode could not be modified.        <- 13.
(adshdb) c                                                    <- 14.
KNAX7034-I The script will continue.
cmd4 start
cmd4 end
KNAX6116-I Execution of the command ./cmd4 (line=17) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
KNAX6597-I ADSH000038.STEP002 step succeeded. exit status=0 execution time=3.081s CPU time=0.000s
KNAX0101-E ADSH000038 An error occurred during execution of the job.
KNAX0098-I ADSH000038 The job ended. exit status=0 execution time=12.162s CPU time=0.000s
KNAX6380-I A job name will be added to the spool job directory of the root job. spool job directory="/home/jobuser1/test6/spool/000038-ADSH000038/"
 
(adshdb) quit
KNAX6380-I A job name will be added to the spool job directory of the root job. spool job directory="/home/jobuser1/test6/spool/000037-ADSH000037/"
KNAX7999-I Advanced Shell ended. exit status=0

The numbers below correspond to the numbers added at the right in the execution results above:

  1. Starts debugging.

  2. Stops execution inside the script.

  3. Stops execution inside the step that is executed in the event of an error.

  4. Executes the script.

  5. Stops at the first breakpoint.

  6. Displays the status.

  7. The fault injection mode is disabled.

  8. Enables the fault injection mode.

  9. Displays the status.

  10. The fault injection mode is enabled.

  11. Restarts debugging.

  12. Stops execution inside the step that is executed in the event of an error.

  13. The fault injection mode could not be changed.

  14. Restarts debugging.

Execution results 2

This example stops execution inside the step and uses the joberrmode command to enable the fault injection mode (the numbers added at the right correspond to the numbers in the explanation provided below):

[jobuser1@HOST01 joberrmode]$ adshexec -d joberrmode.ash       <- 1.
KNAX7901-I The adshexec command will wait for all asynchronous processes at the end of the job.
KNAX0724-I The job ID was assigned. job ID=000043
(adshdb) b 5                                                    <- 2.
KNAX7018-I Breakpoint "1": filename="joberrmode.ash" line=5
(adshdb) b 17                                                   <- 3.
KNAX7018-I Breakpoint "2": filename="joberrmode.ash" line=17
(adshdb) run                                                    <- 4.
KNAX7007-I Execution of the following script will now start: /home/jobuser1/joberrmode/joberrmode.ash
 
KNAX0724-I The job ID was assigned. job ID=000044
KNAX0091-I ADSH000044 The job started.
KNAX7902-I The adshexec command will run in tty stdin mode.
KNAX0092-I ADSH000044.STEP001 step started.
 
KNAX7018-I Breakpoint "1": filename="joberrmode.ash" line=5     <- 5.
KNAX7032-I The script "joberrmode.ash" stopped running.
5: ./cmd1
Current: ./cmd1
(adshdb) info status                                            <- 6.
joberrmode:off                                                  <- 7.
(adshdb) joberrmode on                                          <- 8.
KNAX7126-I Fault injection mode is set to "on".
(adshdb) info status                                            <- 9.
joberrmode:on                                                  <- 10.
(adshdb) c                                                     <- 11.
KNAX7034-I The script will continue.
cmd2 start
cmd2 end
KNAX6116-I Execution of the command ./cmd2 (line=9) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
KNAX6596-E ADSH000044.STEP001 step failed. exit status=0 execution time=62.384s CPU time=0.000s
KNAX0092-I ADSH000044.STEP002 step started.
 
KNAX7018-I Breakpoint "2": filename="joberrmode.ash" line=17  <- 12.
KNAX7032-I The script "joberrmode.ash" stopped running.
17: ./cmd4
Current: ./cmd4
(adshdb) joberrmode off
KNAX7127-E Fault injection mode could not be modified.        <- 13.
(adshdb) c                                                    <- 14.
KNAX7034-I The script will continue.
cmd4 start
cmd4 end
KNAX6116-I Execution of the command ./cmd4 (line=17) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
KNAX6597-I ADSH000044.STEP002 step succeeded. exit status=0 execution time=11.865s CPU time=0.000s
KNAX0101-E ADSH000044 An error occurred during execution of the job.
KNAX0098-I ADSH000044 The job ended. exit status=0 execution time=74.272s CPU time=0.000s
KNAX6380-I A job name will be added to the spool job directory of the root job. spool job directory="/home/jobuser1/test6/spool/000044-ADSH000044/"

The numbers below correspond to the numbers added at the right in the execution results above:

  1. Starts debugging.

  2. Stops execution inside the script within the step.

  3. Stops execution inside the step that is executed in the event of an error.

  4. Executes the script.

  5. Stops at the first breakpoint.

  6. Displays the status.

  7. The fault injection mode is disabled.

  8. Enables the fault injection mode.

  9. Displays the status.

  10. The fault injection mode is enabled.

  11. Restarts debugging.

  12. Stops execution inside the step that is executed in the event of an error.

  13. The fault injection mode could not be changed.

  14. Restarts debugging.

Execution example 2

This example executes the job definition script shown in the following (the line numbers on the left correspond to the line numbers displayed in the execution results):

001  #-adsh_job JOB001
002  #-adsh_step_start STEP001 -onError cont  <--Start of STEP001 with -onError cont specified
003   ./cmd1                                  <--Step normal block
004   ./cmd2
005   ./cmd3
006  #-adsh_step_error
007   ./cmd4                                  <--Step error block
008   ./cmd5
009  #-adsh_step_end
010   ./cmd6                                  <--Command outside the step
Execution results

This example stops execution within the step (line 4) and then enters the joberrmode command (the numbers added at the right correspond to the numbers in the explanation provided below):

[jobuser1@HOST01 joberrmode]$ adshexec -d test_cont.ash       <- 1.
KNAX7901-I The adshexec command will wait for all asynchronous processes at the end of the job.
KNAX0724-I The job ID was assigned. job ID=000045
(adshdb) b 4                                                  <- 2.
KNAX7018-I Breakpoint "1": filename="test_cont.ash" line=4
(adshdb) r                                                    <- 3.
KNAX7007-I Execution of the following script will now start: /home/jobuser1/joberrmode/test_cont.ash
 
KNAX0724-I The job ID was assigned. job ID=000046
KNAX0091-I JOB001 The job started.
KNAX7902-I The adshexec command will run in tty stdin mode.
KNAX0092-I JOB001.STEP001 step started.
cmd1 start
cmd1 end
KNAX6116-I Execution of the command ./cmd1 (line=3) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
 
KNAX7018-I Breakpoint "1": filename="test_cont.ash" line=4    <- 4.
KNAX7032-I The script "test_cont.ash" stopped running.
4:  ./cmd2
Current: ./cmd2
(adshdb) info status                                          <- 5.
joberrmode:off                                                <- 6.
(adshdb) jem on                                               <- 7.
KNAX7126-I Fault injection mode is set to "on".
(adshdb) info status                                          <- 8.
joberrmode:on                                                 <- 9.
(adshdb) c                                                   <- 10.
KNAX7034-I The script will continue.
cmd4 start                                                   <- 11.
cmd4 end
KNAX6116-I Execution of the command ./cmd4 (line=7) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
cmd5 start
cmd5 end
KNAX6116-I Execution of the command ./cmd5 (line=8) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
KNAX6596-E JOB001.STEP001 step failed. exit status=0 execution time=42.531s CPU time=0.000s
KNAX0101-E JOB001 An error occurred during execution of the job.
KNAX0098-I JOB001 The job ended. exit status=0 execution time=42.533s CPU time=0.000s
KNAX6380-I A job name will be added to the spool job directory of the root job. spool job directory="/home/jobuser1/test6/spool/000046-JOB001/"

The numbers below correspond to the numbers added at the right in the execution results above:

  1. Starts debugging.

  2. Stops execution inside the script within the step.

  3. Executes the script.

  4. Stops at the first breakpoint.

  5. Displays the status.

  6. The fault injection mode is disabled.

  7. Enables the fault injection mode.

  8. Displays the status.

  9. The fault injection mode is enabled.

  10. Restarts debugging.

  11. Executes the command in the step error block.