HP 3000 Manuals

BKCLOSE [ KSAM/3000 Reference Manual ] MPE/iX 5.0 Documentation


KSAM/3000 Reference Manual

BKCLOSE 

A call to BKCLOSE terminates file processing for the specified 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 re-opens the file.

BKCLOSE can be executed only for a file that is open.

PARAMETERS 

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 successfull 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.  (Refer to the Status Parameter
                 discussion earlier in this section.)  (Required 
                 parameter)

USING BKCLOSE 

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 re-opened.  Note that a KSAM
file can be closed and then re-opened 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 the KSAMUTIL program.

The example in Figure 6-1, closes a file identified by the filenumber in
F. It then checks the status and prints a message if the status shows any
code except the zero for successful completion.
__________________________________________________________________________
|                                                                        |
|     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 THTS 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]|
|     376O CALL BKERROR(S$,M$)                                           |
|     3770 PRINT M$                                                      |
|     3780 DOEND                                                         |
__________________________________________________________________________

          Figure 6-1.  Closing a KSAM File with BKCLOSE 



MPE/iX 5.0 Documentation