2.6.3 Converting file paths when files are input and output
The file paths specified in job definition scripts are converted to the file paths that are subject to input and output operations according to the rules defined for file input and output operations. The specified file paths must correspond exactly to the file paths to be input and output.
- Organization of this subsection
(1) File path conversion conditions during file input and output operations
When a file input or output operation occurs, the file path is converted by using the redirect characters (<, >, <>, >>).
Input operations also occur in job definition scripts that are run by using the . (dot) or #-adsh_script command. However, in these job definition scripts, file paths are not converted during file input and output operations. If you want to convert such file paths, define conversion rules in the COMMAND_CONV_ARG parameter that converts arguments during command execution.
File path conversion for file input and output operations applies to job definition scripts that are subject to path conversion, as described in 2.6.2 Converting path names.
You can perform file path conversion during file input and output operations between the different platforms (UNIX Windows or Windows UNIX) as well as between the same platforms (UNIX UNIX or Windows Windows).
(2) Example of file path conversion during file input and output operations
The following subsections explain how job definition scripts are converted when files are input and output according to the information (PATH_CONV_ACCESS parameter) in the environment file defined for file input and output operations.
(a) Information in the environment file
The following shows an example environment file:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV /tmp "D:\\tmp" #-adsh_conf PATH_CONV_ACCESS /dev/null nul
(b) Job definition script before execution
The following shows an example job definition script before execution:
while read LOG do echo $LOG > /dev/null done < "/tmp/input.txt"
(c) Job definition script during execution
The job definition script is interpreted during execution as follows:
while read LOG do echo $LOG > nul done < "D:\tmp\input.txt"
(3) Example of combining the PATH_CONV and PATH_CONV_ACCESS parameters
This subsection presents an example in which the PATH_CONV and PATH_CONV_ACCESS parameters are combined in the Windows edition. If both parameters are specified, the PATH_CONV parameter takes precedence. When the same parameter is specified more than once, the parameters are processed sequentially in the order they are specified.
(a) Contents of environment file
The following example shows the contents of an environment file (with a number assigned to each line):
1. #-adsh_conf PATH_CONV_ENABLE / : 2. #-adsh_conf PATH_CONV /tmp "C:\\temp" 3. #-adsh_conf PATH_CONV_ACCESS /tmp/result.log "C:\\jp1as_tmp\\result3.log" 4. #-adsh_conf PATH_CONV_ACCESS "C:\temp\result.log" "C:\\jp1as_tmp\\result4.log" 5. #-adsh_conf PATH_CONV_RULE 1
(b) Contents of job definition script and the conversion method
If the following job definition scripts are executed on the environment file shown in (a), they produce different results.
cat data.txt > "/tmp/result.log"
In this example, the range enclosed in double quotation marks (") is converted by the PATH_CONV parameter because 1 is specified in the PATH_CONV_RULE parameter.
Because "/tmp/result.log" specified in the cat command is enclosed in double quotation marks ("), it is converted to "C:\\temp\\result.log" by the rule on line 2 in the environment file. Therefore, the rule on line 3 does not apply. The rule on line 4 applies; as a result, this path is further converted to "C:\\jp1as_tmp\\result4.log".
cat data2.txt > /tmp/result.log
Because /tmp/result.log specified in the cat command is not enclosed in double quotation marks ("), it is not subject to conversion by the PATH_CONV parameter on line 2. The rule on line 3 applies and the path is converted to "C:\\jp1as_tmp\\result3.log".