Guidelines for Writing Platform-Independent ProcScript

To write ProcScript that is independent of the underlying operating system, follow these guidelines when specifying files and directories.

  • Use only alphanumeric characters and dollar ($) in file and directory names. Do not use spaces, underscores (_), @ or # signs. These are not supported by all platforms.
  • Avoid using names such as SYS1 that may have a special meaning on any of the platforms you intend to support.
  • Avoid starting names with a Q. Such names have special significance on iSeries.
  • Do not depend on case difference in file names; always use the same case. Some file systems are case sensitive, such as Unix, but others are not, such as Windows.
  • Use generic directory separators: backward slash (\), forward slash (/) , or the period (.) in combination with square brackets ([a.b]). These can be translated to the appropriate separator on all supported platforms.
  • Use relative paths instead of absolute paths, for example ../sibling/
  • Keep the total length of any path (or file name or directory name) less than 255 bytes.
  • The PathPrefix of a file specification is always platform-specific. Use logicals to specify it, possibly together with an application-specific directory. This enables the deployer to decide where the application files should be located. For more information, see Using Logicals to Prefix File Specifications.
  • Avoid using version numbers. They are not supported on most platforms.

iSeries

If your application will be deployed on iSeries and has to work in the library system use only one directory name in the path (the library). In this case, avoid using subdirectories because creation of libraries on the iSeries may not be allowed.

For information on other restrictions, consult the operating system documentation. For more information, see File-Naming Considerations on iSeries.

Using Logicals to Prefix File Specifications

To ensure that Uniface's internal representation of a file name is passed to the file system in the correct format, use generic file names in ProcScript and logicals in the assignment file to specify the Prefix (HFS:, DSN: or TSO:) and fixed parts of the Path.

In the following assignment file, logicals are defined for machines on which the application is deployed, in the format machine_OS, where OS is the code returned by $oprsys.

[LOGICALS]
; MS Windows 8
machine_M = d:\myapp\
; Unix
machine_U = /home/myapp/
; iSeries IFS
machine_4 = IFS:/home/myapp/

When constructing file and directory names, you can then use $logical to retrieve the correct prefix. For example

vMachine = "machine_%%$oprsys"
vPrefix = $logical(vMachine)
vDir = "%%vPrefix%%%logs\runtime\"
ldircreate vDir

Related Topics