3.7 Function Load a File

This function will load a file into MUMPS. If the file is created in the format of DSM ^%RS, the contents will be saved as MUMPS routines. If the file is in the format of ISM or Cache ^%GO or ^%GOGEN, the contents will be restored to the named globals. If the file is not any of these formats, then the file is loaded into ^cyz($J,"r",#).

If the first string in the file contains this pattern:

        |RUN|Mroutine|Directory| 
  
 where  | are literal;  
        RUN is literal;  
        Mroutine is the name of a valid Mroutine;  
        Directory is the target UCI or Namespace 
  
 example:  
  
        |RUN|cysdemo|DEV 
  

then the loader will load the structures into the target directory, and then run the named routine. In the above example, the target directory is DEV, and ^cysdemo will run once the load is completed.


This function may be called directly in a MUMPS shell or routine:

 Do ^cyufile2m ; loads routine or global save as documented above 
  
 Do LoadApp^cyufile2m ; same as Do ^cyufile2m 
  
 Do ASCII^cyufile2m ; loads an ASCII file into ^cyz($J,"FILE",#) 
  
 Do BINARY^cyufile2m ; loads a binary file into ^cyz($J,"FILE",#) 
  
 Set return=$$func^cyufile2M(ARRAY,FLAGS,TITLE) ; where 
  
 ARRAY  = the global or local array name to receive the file 
  
 FLAGS  = { ASCII(=the file is ASCII), 
            BINARY(=the file is binary), 
            L###(=string length for a binary file) } 
          Format is "ASCII" or "BINARY L###" 
  
 TITLE  = the title in the window 
  
 return = SOURCE_" "_FileName 
  
          where SOURCE = {SERVER(=file came from server), 
                          CLIENT(=file came from workstation)} 
  
                FileName = name of the file 
  

Examples for the func^cyufile2M call:

 Set x=$$func^cyufile2M("^z($J)","ASCII","Load an ASCII File 
 into ^z($J)") 
  
 Set x=$$func^cyufile2M("^z($J)","BINARY L255","Load a Binary 
 File into ^z($J)") 
  
 


Table of Contents

Next Page