GETDIRECTORY

The GETDIRECTORY function returns the full path (directory) for the compiled map file or the source or destination associated with a specified card object.

You can use GETDIRECTORY in a map rule or component rule when you need the full path (directory) of either the compiled map or of a data source or destination.

Syntax:
GETDIRECTORY ([ single-simple-object-name ] )
Meaning:
GETDIRECTORY ([ card_or_object_for_which_directory_is_needed ] )
Returns:
A single text item

Without an argument, GETDIRECTORY returns the full path associated with the compiled map.

With an argument, the following occurs:

  • From a map rule, the function returns the full path of the source or destination that is associated with the card. In a map rule, the argument must be the name of the card for which to get the directory.
  • From a component rule, the function returns the full path of the source or destination that is associated with the active source or destination.

    The GETDIRECTORY command without arguments will return the directory of the compiled map, regardless of whether it is used in a map rule or in a component rule.

Examples

  • GETDIRECTORY (OrderFile)

    If the card OrderFile is associated with the data file, install_dir\order.txt, GETDIRECTORY returns \install_dir\.

  • GETDIRECTORY ( )

    If the compiled map on the HP-UX is /maps/prod/mymap.mmc, GETDIRECTORY returns /maps/prod/.

    Suppose you want to run the map, MyMap, from a component rule on Record in your input to determine whether input customer names are valid. MyMap has two inputs and one output. The first input is the customer name to look up. The second input is a lookup file. The output is a text item whose value is "valid" or "error".

    The name of the lookup file is constant; it is always XREF_TBL.TXT. However, its location might vary; it will always be in the same directory as the data file used as the source you are trying to validate. For example, if the name of the data file used as the source is C:\SHR\ABC\INPUT.TXT, the lookup file name is C:\SHR\ABC\XREF_TBL.TXT. If the data file name is /local/data/somefile, the lookup file name is /local/data/XREF_TBL.TXT, and so forth.

    You could use this component rule on Record to determine whether the customer name is valid:

    RUN ( "MyMap.mmc" , "-IE1S10" + CustomerName:$ + " -IF2 " + GETDIRECTORY ( ) + "XREF_TBL.TXT" + " -OE1" ) = "VALID"

Related functions

  • GETFILENAME
  • GETRESOURCENAME