3.13.1 Examples
The following shows an example of specifying a spool job name in the initialization script.
In the initialization script, a part of the JP1/AJS job name specified in the AJSJOBNAME environment variable is extracted, and is specified for the ADSH_SPOOL_JOBNAME shell variable as a spool job name. If the job is not run from JP1/AJS or if the extracted part is longer than 100 bytes, the job execution date and time is used as a spool job name. Note that this behavior applies if BYTE is specified for the VAR_SHELL_GETLENGTH environment setting parameter. If CHARACTER is specified, the 100-byte limit changes to the 100-character limit.
-
Example of the initialization script that extracts the last one of the elements separated by forward slashes (/)
If the value of the AJSJOBNAME environment variable is /user01/AJS-unit-name/PCjob, the spool job directory name is job-ID-PCjob.
WK="$( "${ADSH_DIR_CMD}basename" "$AJSJOBNAME" )" if [[ ${#WK} -le 100 ]] && [[ ${#WK} -ge 1 ]] then ADSH_SPOOL_JOBNAME="${WK}" else ADSH_SPOOL_JOBNAME="$( "${ADSH_DIR_CMD}date" "+%Y%m%d_%H%M%S" )" fi
-
Example of the initialization script that extracts the last two elements separated by forward slashes (/), and combines them with an underscore (_)
If the value of the AJSJOBNAME environment variable is /user01/AJS-unit-name/PCjob, the spool job directory name is job-ID-AJS-unit-name_PCjob.
SV_IFS="$IFS" IFS="/" WK=($AJSJOBNAME) IFS="$SV_IFS" i=${#WK[*]} if [[ i -gt 1 ]] && [[ "(( ${#WK[i-1]} + ${#WK[i-2]} ))" -le 99 ]] && [[ ${#WK[i-1]} -ge 1 ]] && [[ ${#WK[i-2]} -ge 1 ]] then ADSH_SPOOL_JOBNAME="${WK[i-2]}_${WK[i-1]}" else ADSH_SPOOL_JOBNAME="$( "${ADSH_DIR_CMD}date" "+%Y%m%d_%H%M%S" )" fi