Product Documentation

FairCom RTG COBOL User Guide

Previous Topic

Next Topic

<drive>

Sub-option of <normalize>. Specifies a drive letter to be used if the path to be normalized does not include a drive letter.

If a drive letter is already included in the path, it is not replaced with the one specified by <drive>. Also, <drive> applies only to full file paths, not relative ones. The following attributes can modify these behaviors:

  • <drive force> - If the file path to be normalized already includes a drive letter, then setting <drive force="yes"> will force it to change the drive to the one specified. Defaults to "no".
  • <drive relative> - Setting <drive relative="yes"> will cause the drive letter to be added to relative file paths as well, not just full file paths. Defaults to "no".

Examples

If the file path to be normalized already has a drive it is not changed by default. It is possible to force the drive to be changed to the one specified by setting the force= attribute to yes. For example:

<normalize><drive force="y">C</drive></normalize>

It is also possible to remove an existing drive by specifying an empty drive. For example:

<normalize><drive></drive></normalize>

To normalize absolute file paths, but not relative file paths, by adding the specified drive letter:

<normalize><drive relative="no">D</drive></normalize>

For instance, here the D drive is added to the absolute file path "\data\custmast", but not to the relative file path "custmast":

>ctutil -info \data\custmast |findstr path

File path               : D:\data\custmast.dat

>ctutil -info custmast |findstr path

File path               : custmast.dat

Conversely, to normalize both relative and absolute paths, use:

<normalize><drive relative="yes">D</drive></normalize>

Resulting in:

>ctutil -info \data\custmast |findstr path

File path               : D:\data\custmast.dat

>ctutil -info custmast |findstr path

File path               : D:custmast.dat

TOCIndex