The &INFO String Function - Ultramarine.com The &INFO String Function

Often, one wishes to know the current settings. To accomplish this task, MOSES provides the string function:


     &INFO(NAME, DATA)

In general, there are four classes of information available. Information about:

Error information is obtained with a NAME of SEVERITY. When using macros or loops. it is sometimes useful to know if an error or warning occurred during execution. If so, appropriate action can be taken. The string function

     &INFO(SEVERITY  FLAG)

is used to determine if an error or warning has occurred. Here, FLAG is either ERROR or WARNING. The function will return a value of .TRUE. if FLAG is set to WARNING, and either an error or a warning occurred during the previous command. Likewise, a value of .TRUE. is also returned if FLAG is ERROR, and an error occurred during the previous command. Otherwise, a value of .FALSE. is returned. Consider the following example:

     &IF &INFO(SEVERITY ERROR) &THEN
     &TYPE LOST BEYOND HOPE
     &FINISH
     &ELSE &INFO(SEVERITY WARNING) &THEN
     &TYPE FIXING SITUATION
     FIXUP
     &ENDIF

In this example, a message is typed to the screen and a fixup macro is executed if a warning resulted from the previous command. If an error occurred, a different message is typed, and the program is exited.

Run information is obtained with either: MENU DATE, T_OF_DAY, TITLE, SUBTITLE, ROOT, or CWD. The first of these returns the current menu while the second returns the date and the third the twenty four hour time when the function was called. TITLE and SUBTITLE return the title and subtitle respectively. ROOT returns the root file being executed as a file alone and CWD returns the current working directory of the program. Thus, to have a fully qualified path name of a file with the same path and primary name as the root, but with an extension of NEW, one would use:

     &INFO(CWD)&INFO(ROOT).NEW

Unit information is obtained with either: BFORCE, LFORCE, BLENGTH, or llength. If BFORCE is used, then a string describing the unit used for "big force" ( kips, l-tons, s-tons, kn, or tonnes) is returned. The other admissible values return the names for "little force" (pounds or newtons), "big length" (feet or meters), and "little length" (inches or mm ).

File information is obtained with either: C_FILE, C_PATH, C_IFILE, C_IPATH, C_CFILE, C_CPATH, FILE_EXISTS, or CHA_FILE. Here, C_FILE and C_PATH return the names of the last file and path used by MOSES. C_IFILE and C_IPATH return the last used input file, meaning names ending in .dat and input file path. Types of C_CFILE and C_CPATH return the last used command file, meaning names ending .cif and the command file path. FILE_EXISTS returns .TRUE. or .FALSE. based on where DATA is a file which exists. CHA_FILE returns the file currently associated with the channel specified.

Program information is obtained with: VERSION, REVNUM. HOME, PGMPAT, or OS_CLASS. VERSION returns the general version being executed; e.g. REV 5.10, while REVNUM returns the total revision number; e.g. REV 5.10.010. HOME returns the path to the user's home directory. PGMPAT returns the path to where the program being executed is stored; e.g. /ultra. A type of OS_CLASS will return the type of operating system currently running the program.

For information about the current output device, one should use a NAME of either: TPGLEN, OPGLEN, FONT, PWIDTH, PHEIGHT IMARGIN, OMARGIN, TMARGIN, BMARGIN, DOUSIDE LPI, CPI, or DEVICE. The DEVICE value will return the physical device name of the current output device. All dimensions here returned here are in points except for CPI and LPI which are characters per inch and lines per inch respectively. Here TPGLEN returns the length of the screen. All of the others provided information about the current output channel.

Information about the current graphics is obtained with either: FIG_NUM, or PICT_TYPE. FIG_NUM, returns the number of the next figure plotted. PICT_TYPE returns the type of data currently being used for pictures.