Creating and Displaying M Routines

To create or edit a routine, use the ZEDIT command. ZEDIT invokes the Text Processing Utility (TPU) section file for GT.M and opens the specified file. dmex.m, for editing.

Example:

          GTM>ZEDIT "dmex"
        

Once in the editor, use the arrow keys to move between lines of text. When you finish editing, press <CTRL-Z> to save the changes, which returns you to Direct Mode.

To display M source code for dmex, use the ZPRINT command.

Example:

        GTM>ZPRINT ^dmex
        dmex;dmex - Direct Mode example
        ;
        begfor read !,"Name: ",name do name
        quit
        nameset ln=$l(name)
        if ln,$e("QUIT",1,ln)=$tr(name,"quit","QUIT") d q
        . s name="Q"
        if ln<30,bame?1.a.1"-".a1","1" "1a.ap do print q
        write !,"Please use last-name, "
        write "first-name middle-initial or 'Q' to Quit."
        quit
        print write !,$p(name,", ",2)," ",$p(name,", ")
        quit
        GTM>
        

This uses the ZPRINT command to display the routine dmex.

[Note]

The example misspells the variable name as bame.