AUXILIARY

From ICE Enterprises
Jump to navigation Jump to search

sets NextMidas auxiliary disk/path assignments for data files

<write>   The aux for writing Midas files
<read>    The | separated aux list for locating/reading Midas files
<aux 0:N> Additional entries to add to or remove from the read AUX.

This routine is used to set the auxiliary disk paths for writing and locating
Midas data files.  An auxiliary, or aux, is an entry in the AUX table
containing an OS specific disk path name. In general, NextMidas uses names for
auxes instead of numbers (as in X-Midas).

If no arguments are given, the current aux settings and associated paths are
displayed.

Some 'standard' auxes common for all NextMidas systems:
  CWD      - Points to the Current Working Directory.
  HOME     - The user's login area.
  HOMEPATH - The current NextMidas HOME area (usually just for user macros).
  DAT      - The NextMidas DAT area used to store oft-used system files.
  RAM      - The current shell's data pipe area.
  1        - Special aux where the user name is appended to the midas data path.

At any time, a NeXtMidas user references a single WRITE AUX (ID of the default
output AUX) aux and one or more READ AUXs (list of IDs of the AUX entries to
search for a file).

  +--------------------------------------------------------------------------+
  | SPECIAL NOTE WHEN RUN FROM X-MIDAS:                                      |
  |   When NeXtMidas is running as an X-Midas option tree the AUX path is    |
  |   shared with X-Midas. This limits users to only using numbered AUX      |
  |   names other than the following NeXtMidas-managed names:                |
  |                                                                          |
  |      XMPIPE   - The mapping of the X-Midas pipes (like AUX.RAM)          |
  |      CWD      - Alias for AUX.0                                          |
  |      HOME     - Alias for AUX.98                                         |
  |      RAM      - NeXtMidas RAM AUX (used for pipes/in-memory files)       |
  |      HOMEPATH - Same as the X-Midas HOMEPATH (Mc.home_path)              |
  |                                                                          |
  |   Also note that NeXtMidas will always pair CWD and HOME as "0|CWD" and  |
  |   "98|HOME" this is beacuse X-Midas will only be able to see the numbered|
  |   AUX's. Also "XMPIPE|RAM" will always be added to the front of the path.|
  |                                                                          |
  |   Any alteration of the AUX table or the READ and WRITE AUX settings are |
  |   mapped between X-Midas and NeXtMidas. Changes in one will affect the   |
  |   other.                                                                 |
  +--------------------------------------------------------------------------+


Where New Files are Written:
  When writing files, Midas first searches the read aux path(s) for the
  specified file.  If it is found (the file already exists) it is overwritten
  in that path.  New files are created in the <write aux> disk path.

  When any file is opened in Midas, whether for read or write, all disks in the
  READ AUX are searched (open for write prefers to write to an existing file in
  the read list).

  What this means is that the longer your READ AUX list is, the longer it takes
  to open a file for output, particularly if your aux list includes networked
  disks. If your application requires the frequent re-opening of a file, you
  might try specifying its aux with a qualifier:

    nM> myprim myfile.prm{AUX=MYFILES}

  When an AUX=value is specified as a file qualifier, that AUX will be used
  and NeXtMidas will skip any checks for an existing file elsewhere on the
  READ AUX.

  In X-Midas, the initial read aux search is disabled if the write aux
  value is negative.  A similar concept has been implemented in NextMidas.
  This behavior can be activated by putting a '-' before the aux value,
  even if it is named and not numbered. See the examples.

Setting the READ AUX:
  The <read> parameters are used to define or alter the path list used
  to locate Midas data files.  The syntax of <read> is as follows:

      n1|n2|n3... - An ordered search list of one or more aux names separated
                    by vertical bars or as separate arguments.
      ALL         - Defines the read aux list to include all paths in the AUX
                    table except READ,WRITE,CWD,DAT,HOME.
      -MYDIR      - Removes MYDIR from the current read aux list.
      +MYDIR      - Adds MYDIR to the end of the current read aux list.
      MYDIR+      - Adds MYDIR to the front of the current read aux list.

  Also, it is possible to use the X-Midas syntax which is:
      AUX <write> <read> <r2> <r3> ... <rN>
  Where <r2>, <r3>, ... <rN> are additional AUXs to add/remove from the list.

Defining an AUX entry:
  An AUX entry is added by setting an entry in the AUX table using SET or RES.
  For example:

    nM> set aux.mydata "/home/smith/mydata/"

  Be careful to quote the entry when setting it, otherwise NeXtMidas will
  convert it to upper case. To see that an entry is set, just use GET or
  RES. For example:

    nM> get aux.mydata
    19S: /home/smith/mydata/

Supported AUX Entries:
  NeXtMidas supports a wide array of entries in the AUX table, not just local
  directories (though local directories are the most common). Some of the
  resource types supported include:

    Resource Type       Description/Example                              R/W
  +-------------------+------------------------------------------------+------+
  | File              | - Unix or Windows directory                    | Read |
  | (FileResource)    | - Unix: Use full path name                     | Write|
  |                   |    - "/home/smith/mydata/"                     |      |
  |                   | - Windows: Use full path with drive letter     |      |
  |                   |    - "C:\myData\"                              |      |
  |                   | - Windows: For network drive, use alias drive  |      |
  |                   |   letter or remote mount point                 |      |
  |                   |    - "Z:\data\"                                |      |
  |                   |    - "\\NewtorkComputer\mountdir\data\"        |      |
  +-------------------+------------------------------------------------+------+
  | HTTP              | - Reads files from a URL (web server)          | Read |
  | (HttpResource)    | - "http://my.server.com/mydir/"                | Only |
  +-------------------+------------------------------------------------+------+
  | JAR               | - Reads files from a Java Archive (JAR)        | Read |
  | (JarResource)     | - Syntax is "jar:<archive>!<path>" (path must  | Only |
  |                   |   start with a '/')                            |      |
  |                   | - "jar:/home/smith/myjarfile.jar!/dir/datadir/"|      |
  |                   | - To read files from a JAR on web server       |      |
  |                   | - "jar:http://server/dir/file.jar!/dir/in/jar/"|      |
  +-------------------+------------------------------------------------+------+
  | MFTP              | - Midas File Transfer Protocol client (server  | Read |
  | (MftpResource)    |   is part of RMIF)                             | Only |
  |                   | - Syntax is "mftp://<lport>/<rhost>:<rport>/"  |      |
  +-------------------+------------------------------------------------+------+
  | Pipe              | - Handles pipes in the NeXtMidas pipe system,  | Read |
  | (PipeResource)    | - Always defined as RAM aux, do not change!    | Write|
  |                   | - Pipes are local to the macro                 |      |
  |                   |    - Shares RAM aux with RamResource           |      |
  +-------------------+------------------------------------------------+------+
  | RAM               | - Handles in-memory RAM files.                 | Read |
  | (RamResource)     | - Always defined as RAM aux, do not change!    | Write|
  |                   |    - Shares RAM aux with PipeResource          |      |
  +-------------------+------------------------------------------------+------+
  | RAM Disk          | - Part of the ICE option tree                  | Read |
  | (ICE Option Tree) | - See ICE documentation for details            | Write|
  +-------------------+------------------------------------------------+------+
  | TAR File          | - Reads files from a Tape Archive (TAR) File   | Read |
  | (TarResource)     | - Syntax is "tar:<arch>!<path>" (path may      | Only |
  |                   |   start with a '/', but this is rare)          |      |
  |                   | - "tar:/home/smith/mytarfile.tar!data/"        |      |
  +-------------------+------------------------------------------------+------+
  | TCP               | - TBD                                          | TBD  |
  | (TcpResource)     |                                                |      |
  +-------------------+------------------------------------------------+------+
  | X-Midas Pipe      | - Handles X-Midas pipes when NeXtMidas is run  | Read |
  | (XmPipeResource)  |   as an X-Midas option tree                    | Write|
  |                   | - Always defined as XMPIPE aux, do not change! |      |
  +-------------------+------------------------------------------------+------+

  Special resource types that can NOT be included on the AUX table:

    Resource Type       Description/Example                              R/W
  +-------------------+------------------------------------------------+------+
  | NFILE             | - Similar to FileResource but uses native code | Read |
  | (NFileResource)   |   to increase performance for some applications| Write|
  |                   | - Used by adding USENATIVE= qualifier          |      |
  |                   | - Can NOT add NFileResource to AUX table       |      |
  +-------------------+------------------------------------------------+------+
  | Socket            | - Reads/writes data from/to a socket           | Read |
  | (SocketResource)  | - Syntax is "stp:<rhost>:<rport>               | Write|
  |                   | - Full path must be used, can NOT add a socket |      |
  |                   |   resource to the AUX table                    |      |
  +-------------------+------------------------------------------------+------+
  | UDP               | - Reads/writes data from/to a UDP socket       | Read |
  | (UdpResource)     | - Syntax is "udp:<port>" for input and         | Write|
  |                   |   "udp:<host>:<port>" for output (<host> is    |      |
  |                   |   usually "localhost")                         |      |
  |                   | - Full path must be used, can NOT add a UDP    |      |
  |                   |   resource to the AUX table                    |      |
  +-------------------+------------------------------------------------+------+

Examples:
  1. Display the current AUX settings and associated paths AS DEFINED (user
     name is NOT substituted in for '+').
        nM> AUX
        Write AUX     = 1
        Read AUX List = 1|CWD|DAT|99|RAM

        CWD           = /home/smith/                             <Type=File>
        HOME          = /home/smith/                             <Type=File>
        HOMEPATH      = /home/smith/nxm230/nxm/sys/test/         <Type=File>
        DAT           = /home/smith/nxm230/nxm/sys/dat/          <Type=File>
        RAM           = ram:                                     <Type=Ram>
        1             = /midas/data1/+/                          <Type=File>
        9             = ramd:/midas/icedisk/,RAM,372M,128M       <Type=RamDisk>
        11            = /data11/+/                               <Type=File>
        12            = /data12/+/                               <Type=File>
        99            = /midas/opt/xmxxx/xm/dat/                 <Type=File>
        WEB           = http://alice.techma.com/nm/nxm/sys/dat/  <Type=Http>

  2. Display the current AUX settings and associated paths AS USED (user
     name is substituted in for '+').
        nM> AUX/LIST
        Write AUX     = 1
        Read AUX List = 1|CWD|DAT|99|RAM

        CWD           = /home/smith/                             <XmAlias=0>
        HOME          = /home/smith/                             <XmAlias=n/a>
        HOMEPATH      = /home/smith/nxm230/nxm/sys/test/         <XmAlias=98>
        DAT           = /home/smith/nxm230/nxm/sys/dat/          <XmAlias=n/a>
        RAM           = ram:                                     <XmAlias=n/a>
        1             = /midas/data1/smith/                      <XmAlias=n/a>
        9             = ramd:/midas/icedisk/                     <XmAlias=n/a>
        11            = /data11/smith/                           <XmAlias=n/a>
        12            = /data12/smith/                           <XmAlias=n/a>
        99            = /midas/opt/xmxxx/xm/dat/                 <XmAlias=n/a>
        WEB           = http://alice.techma.com/nm/nxm/sys/dat/  <XmAlias=n/a>

     Since /LIST matches X-Midas, the X-Midas alias is included if applicable.
     The alias is used with XBC (allows running X-Midas host primitives from
     NeXtMidas) and NeXtOpt (NeXtMidas running as an X-Midas option tree).

  3. Write new files to aux 1 and read from all available disks.
        nM> AUX 1 ALL

  4. Write to aux 1 and read from aux DAT. (A minimal read list reduces search
     time.)
        nM> AUX 1 DAT

  5. Set read to all auxes except the WEB.
        nM> AUX 1 ALL -WEB

  6. Write to the current directory (read aux is unchanged).
        nM> AUX CWD

  7. Always write to aux 1 regardless if the file exists in the read aux list
        nM> AUX -1

  8. Always write to the current directory regardless if the file exists in the read aux list
        nM> AUX -CWD

  9. Remove aux CWD from the current read list, write aux unchanged.
        nM> AUX ,, -CWD

  10. Add aux DAT to the end of the current read list.
        nM> AUX ,, +DAT

  11. Set write aux to CWD, remove auxes WEB and HOME from read list.
        nM> AUX CWD -WEB|-HOME

  11. Remove aux WEB, append HOME, and prepend DAT from/to read list.
        nM> AUX ,, -WEB +HOME DAT+


Switches:
  /LIST    - Display all valid auxes and their associated pathnames. Unlike
             normal listing (when no parameters given) this will "clean" the
             AUX paths (i.e. substitute user name for '+', remove ramdisk
             parameters, etc), and will include the X-Midas alias (used
             with XBC and NeXtOpt).
  /LOAD=res- Load READ and WRITE auxes from the specified result. (Since 2.9.3)
  /RESTORE - Restore current WRITE and READ auxes from OLDAUXREAD and
             OLDAUXWRITE, respectively.
  /SAVE=res- Save the current WRITE and READ auxes to the specified result.
             See also /LOAD (Since 2.9.3)
  /STORE   - Store current READ and WRITE auxes to OLDAUXREAD and OLDAUXWRITE,
             respectively.
  /WARN=NO - Disable warnings about invalid read/write AUX entries. [DEF=YES]

SEE ALSO:  ENVIRONMENT, FNAME, HOMEPATH