ISCLR
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
xcall ISCLR(filename, status)
Arguments
filename
An expression that names the ISAM file you want to clear. The alpha value is a standard file specification. The default extension is .ism. (a)
status
Currently required but ignored. (n)
Discussion
The ISCLR subroutine empties an ISAM file. It is extremely useful in programs that temporarily post information stored in ISAM transaction files. After the information is posted to another file, you can use ISCLR to clear the transactions.
If the file being cleared contains a sequence autokey, the next sequence is reset to 1, or to the SEED value if present.
ISCLR tries to gain exclusive access to the specified file. If the file is currently in use, the ISCLR request is rejected with a “File in use by another user” error ($ERR_FINUSE).
Use the ISCLR subroutine with caution so you don’t accidentally clear your ISAM files; clearing an ISAM file deletes all existing records. |
In previous versions of Synergy DBL, you could also specify a channel argument on the ISCLR subroutine. This syntax is still valid, but the channel argument is ignored. ISCLR no longer closes the channel if the channel is open.
See also
OPEN statement
Examples
The following example prompts the user for the name of an ISAM file to clear and uses the ISCLR subroutine to clear the specified file.
.define TTCHN ,1 record errname ,a40 status ,d1 name ,a40 proc xcall flags(7004020, 1) open(TTCHN, i, "tt:") display(TTCHN, "Enter name of ISAM file to clear: ") reads(TTCHN, name) onerror clrerr xcall isclr(name, status) offerror writes(TTCHN, "Cleared successfully") stop clrerr, display(TTCHN, "Operation failed, error was: ") writes(TTCHN, %string(%ernum)) stop end
If the isclr operation fails, the program displays the following message:
Operation failed, error was: nn
where nn indicates the runtime error number.
Otherwise, the program displays the message
Cleared successfully