HPlogo Accessing Files Programmer's Guide > Chapter 4 Specifying a File Domain

Changing Domains

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 6 ♥
E0692 Edition 5

A file need not always stay in the same domain. Any disk file can be made permanent, or can be deleted when it has served its purpose. The disposition parameter of the FCLOSE intrinsic can specify a different domain for a file as it closes, or the FILE command can be used to change the domain of a file. The DEL, TEMP, and SAVE parameters determine what happens to the file when it is closed. For details about how the FCLOSE intrinsic handles file domain disposition, refer to chapter 6, "Closing a File".

A file in any domain may be deleted if the DEL parameter is used in a file equation. For example, suppose that you have a permanent file named OLDFL, and want to delete it after its next use. Before running the program that uses OLDFL, enter:

  FILE OLDFL;DEL

The file may now be opened in your program, and when the program closes the file, it is deleted. If OLDFL were a new or temporary file, it would be deleted in the same way.

New files may be made temporary if the TEMP parameter is used in a file equation. If you are about to create a file named NEWFL, and wish it to remain as a temporary file after it is used, enter:

  FILE NEWFL,NEW;TEMP

After the file is created in your program and is closed, the file system maintains it as a temporary file. If you wish to keep a new or temporary file as a permanent file after it is used, use the SAVE parameter in a file equation. If you have a temporary file named TEMPFL, and you want it to be kept as an permanent file in the system, enter:

  FILE TEMPFL,OLDTEMP;SAVE

TEMPFL is kept as a permanent file, so it will not be lost when your job or session concludes.

File equations are useful for determining the disposition of files when the files have been programmatically accessed and closed. By using the MPE/iX SAVE command, you can keep a temporary file as permanent without opening and closing the file. If you want to keep a temporary file named TEMPDATA, but do not need to use it in a program at this time, enter:

  SAVE TEMPDATA

and the file system immediately identifies it as a permanent file. If there were a lockword associated with TEMPDATA, you would be prompted for it. You can use the SAVE command to keep $OLDPASS and assign it a name for future reference by entering:

  SAVE $OLDPASS,filename

where filename is any name that you choose.

For more information about the FILE and SAVE commands, consult the MPE/iX Commands Reference Manual.




Permanent Files


Searching File Directories