|
|
A call to BKCLOSE terminates file processing for the specified KSAM
file.
CALL BKCLOSE (filenum, status)
When processing is completed, a KSAM file should be closed
with a call to BKCLOSE. No further processing is allowed on the file
until a BKOPEN procedure call reopens the file.
BKCLOSE can be executed only for a file that is open.
- filenum
A numeric variable containing the file number that identifies the
file; this number was returned by the last call to BKOPEN. It
should not be altered until the file is closed with a successful call to
BKCLOSE. (Required parameter)
- status
A four-character string variable to which is returned a code that
indicates whether or not the file was successfully closed and if not, why
not. The first character is set to 0 if the close is successful, to
another value if not. (Required parameter)
After calling BKCLOSE, you should check the status
parameter to determine if the file was closed successfully.
A successfully closed file is no longer available for processing
until it is reopened. Note that a KSAM file can be closed and then
reopened in order to specify a different access mode or type of processing.
The BKCLOSE procedure does not remove the file from the system.
To do this, you should use the PURGE command of KSAMUTIL or MPE/iX.
The example in Figure B-1 "Closing a KSAM File with
BKCLOSE" closes a file identified by the file number in F. It then checks
the status and prints a message if the status shows any code except the zero
for successful completion.
Figure B-1 Closing a KSAM File with BKCLOSE
3610 REM ********************************************************
3620 REM * CLOSE A KSAM FILE *
3630 REM ********************************************************
3640 REM
3650 REM F IS THE FILE NUMBER OF A KSAM FILE
3660 REM DEFINED BY A CALL TO BKOPEN
3670 REM
3680 CALL BKCLOSE(F,S$)
3690 REM
3700 REM NOW DETERMINE WHETHER THIS CALL SUCCEEDED
3710 REM
3720 IF S$[1,1]<>"0" THEN DO
3730 REM N$ CONTAINS THE NAME OF THE KSAM FILE
3740 REM S$ CONTAINS THE STATUS CODE SET BY THE PRECEDING CALL
3750 PRINT "UNABLE TO CLOSE ";N$;" ERROR ";S$[1;1];" DETAIL ";S$[2]
3760 CALL BKERROR(S$,M$)
3770 PRINT M$
3780 DOEND
|