Hitachi

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


PIPE_CMD_LAST parameter (defines execution processing for the last command in a pipe) (UNIX only)

Organization of this page

Format

#-adsh_conf PIPE_CMD_LAST {CURRENT|OTHER}

Description

This parameter specifies whether the last command in the pipeline in the current process is to be executed.

You specify CURRENT to update the contents of variables by using the last command in the pipeline and you want to use the updated contents in commands that follow the pipeline, as described in the following.

Contents of job definition script:
typeset -i CNT=0
cat INFILE | while read STR
do
  echo "$STR"
  let CNT=CNT+1
done
echo "Line count is $CNT."

As a result, when the while statement terminates, the shell variable CNT stores the number of lines loaded by the read command (INFILE line count).

On the other hand, if you want use the last command in the pipeline to update the contents of variables but you want to revert to using the contents of the pre-update variables after the pipeline has terminated, specify OTHER (CBL_SYSUT1 and CBL_SYSUT2 are assumed to be common interface variables of CBLUAPx).

Contents of job definition script:
CBL_SYSUT1=/file1
CBL_SYSUT2=/file2
CBLUAP1
cat INFILE | while read DIR
do
CBL_SYSUT1=`cmd1 y`
CBL_SYSUT2=`cmd2 y`
CBLUAP2
done
CBLUAP3

In this case, when the while statement terminates, the shell variable CBL_SYSUT1 stores "/file1" and the shell variable CBL_SYSUT2 stores "/file2".

This parameter cannot be specified more than once in the same environment file. If it is specified more than once, an error message is output and the job terminates.

Operands

CURRENT

Specifies that when the last command in the pipeline is one of the following, the command is to run in the current process:

  • Shell standard command

  • Substitution expression

  • Script control statement

OTHER

Specifies that the last command in the pipeline is to run in another process.

Notes

Example

The examples below show the difference in the execution result when the input file and job definition script shown in the following are used to specify the PIPE_CMD_LAST parameter.