User's Guide

SPLITNAME

Split a file name into a directory, root name, and extension.

Function:

Split a file name into a directory, root name, and extension. Each portion of the file name will be returned in a TAE string variable.

Parameters:

INFILE
Input file. The file specification to be examined.

OPTION
Option. Option for the type of file name that is to be split.

  = LAS:      Split a LAS file name
  = HOST:     Split a host file name
  = LAS2HOST: Split a LAS file name and return the
              elements as a host file name.
  = HOST2LAS: Split a host file name and return the
              elements as a LAS file name.

DIR
Directory. TAE string variable to receive the directory portion of INFILE.

ROOT
Root file name. TAE string variable to receive the root file portion of INFILE.

EXT
File extension. TAE string variable to receive the extension portion of INFILE.

Examples:

  1. LAS> splitname infile=[user.images]usa;img option=las dir=dir root=image ext=exten

    The LAS file specification [USER.IMAGES]USA;IMG is examined and the TAE string variables DIR, IMAGE, and EXTEN are assigned the values "[USER.IMAGES]", "USA", and "IMG" respectively.

  2. LAS> splitname infile=usa;img option=las dir=dir root=image ext=exten

    The LAS file specification USA;IMG is examined and the TAE string variable DIR is assigned the current working directory while IMAGE and EXTEN are assigned the values "USA", and "IMG" respectively.

  3. LAS> splitname infile=/usr/images/usa/june.img option=host dir=dir root=root ext=exten

    The host file specification /usr/images/usa/june.img is examined and the TAE string variables DIR, ROOT, and EXTEN are assigned the values "/usr/images/usa/", "june", and "img" respectively.

  4. LAS> splitname infile="" option=host dir=dir root=root ext=exten

    The host file specification "" is examined and the TAE string variable DIR is assigned the current working directory, while ROOT and EXTEN are assigned "".

Description/Algorithm:

INFILE is divided into a directory, root file name, and an extension. These components are then returned in the TAE string variables specified by the user.

If the directory is not specified, the current working directory will be returned. If the root file name or extension are missing, then the specified string variables are set to the empty string ("").

Nonfatal Error Messages:

    None.

Fatal Error Messages:

  1. [splitname-fatal] Fatal error encountered

    A fatal error was encountered. The message displayed preceding this message is the error that was encountered. Processing terminates.

  2. [splitname-tae] Error sending parameter to TAE

    An error was encountered while trying to pass a value back to the TAE variables. If the error persists, contact the system administrator.

User Notes:

  1. When working host file names, the directory that is returned will have a trailing '/'. See example three.

  2. This program is normally called by procedure PDFs.

  3. If OPTION is set to LAS or LAS2HOST and a host file name is specified, or if OPTION is set to HOST or HOST2LAS and a LAS file name is specified, the values that are returned for each component will be incorrect.