Last Revised: 01/07/20 |
This program can be called or run to initialize a data file. This process will remove all records from the file, and if the file is dynamic, reduce the size of the file to the minimum size. There is also an option to retain the owner, group, and permissions when initializing files on Linux/Unix /AIX systems.
If RUN, then Z$
must be set to the channel number or numbers of the open files to be initialized. Note that only single digit channel numbers are supported. When multiple files are to be initialized they may be separated by a single non-numeric character which is ignored in the current version but was a file clearing indicator on older systems.
Examples | |
---|---|
Z$="1" or Z$="1 " or Z$="1Y" or Z$="1N" followed by RUN "CDS002"
|
would initialize file opened to channel 1 |
Z$="12" or Z$="1 2 " or Z$="1Y2N" or Z$="1N2N"
|
would initialize files opened to channel 1 and channel 2. Note: This is not channel 12! |
After the files are initialized, CDS002 will run the menu program CDS001.
CALL "CDS002",ERR=ERROR, CHAN$, CHAN
If called, then you may pass 1 or 2 parameters.
The first parameter is a string variable and operates the same as described above when CDS002 is run.
The second parameter is optional and is numeric. It represents any channel number to be initialized. Use this option when the channel number is more than a single digit.
Whether RUN or CALLED on Linux/Unix/AIX systems, the file owner and group will be changed to the current user and current user's primary group. In addition the file permissions are changed based on the current umask settings. You can, however, pass the CHAN as the negative value of the opened file to be initialized signalling CDS002 to retain the file owner, group, and permissions. Note that the negative CHAN option should not be used on MKV files that have named indexes (KNUM's) because named indexes would be lost.
When called, CDS002 will re-open the initialized file. It will also
LOCK
the file if the original file was locked.
Examples | |
---|---|
CALL "CDS002","12"
|
Initializes files opened to channels 1 and 2 |
CALL "CDS002","",12
|
Initializes file opened to channel 12 |
CALL "CDS002","1 2 ",12
|
Initializes files opened to channels 1, 2, and 12 |
Whether run or called, CDS002 will display an error message if:
- unable to lock the file (unless it is already locked)
- unable to erase the file
- unable to define the file
After an error message, the operator may resolve the situation that is preventing CDS002 from working and touch Enter to retry; or touch F4 to abort.
If the operator aborts, and multiple files were to be initialized, any files not yet initialized will not be initialized. If CDS002 was run, then the menu will display even though one or more file was not initialized.
If CDS002 was called, then CDS002 will EXIT ERR
so that the calling program
can take the ERR=
branch. If the file was closed but not erased, then CDS002 will attempt to re-open the file.