next up previous contents index
Next: Interrupting Procedures Up: MIDAS Command Language Previous: Conditional StatementsBranching

Special Functions

 

Special functions may be used in the context of COMPUTE/KEYWORD. The existing functions are listed in the following table (on the next page). Note, that arg1, arg2 may either be the name of a keyword, the contents of which are used, or a constant. Character constants have to be enclosed in double quotes to distinguish them from a keyword name.
The table on the following page contains all functions available.
On--line help for these functions is available via HELP COMPUTE/KEYWORD.

  
Table: Special Functions available for operations on keywords

As an example we want to check whether a table file name has been input with or without the file extension .tbl ; if not given we append the type inside the procedure:

!+
! Example 16, MIDAS procedure exa16.prg
!+
DEFINE/LOCAL INDX/I/1/1 0
COMPUTE/KEYWORD INDX = M$INDEX(P1,".tbl") ! test, if type of a table
! already given
IF INDX .EQ. 0 THEN
WRITE/KEYWORD IN_A P1.tbl ! if not, append type
ELSE
WRITE/KEYWORD IN_A P1 ! if yes, no need to append type
ENDIF

The MIDAS command @@ exa16 mytable as well as @@ exa16 mytable.tbl will both fill the character keyword IN_A with the string `mytable.tbl'.
One of the MIDAS verification procedures, verify3.prg shows the usage of all currently available functions. Enter @ vericopy to copy this procedure into your current directory (also the usage of verify3 will be shown then).



Pascal Ballester
Fri Mar 24 17:17:52 MET 1995