HPlogo KSAM/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 USING KSAM FILES IN COBOL PROGRAMS

CKCLOSE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

A call to CKCLOSE terminates file processing for the specified file.

  CALL "CKCLOSE" USING filetable, status

When processing is completed, a KSAM file should be closed with a call to CKCLOSE. No further processing is allowed on the file until a CKOPEN procedure call opens the file.

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

PARAMETERS

filetable

an 8-word record containing: the name of the file, its input-output type, access mode, the filenumber given the file when it was last opened, and a code indicating whether the previous operation on the file was successful and if so what it was. (Refer to Filetable Parameter discussion earlier in this section.)

status

one-word (two 8-bit characters) set to a pair of values upon completion of the call to CKCLOSE. It indicates whether or not the file was successfully closed and if not, why not. The left character is set to "0" if CKCLOSE is successful, to "9" if not. The right character is set to "0" if CKCLOSE is successful, to the file system error code if not. (Refer to Status Parameter discussion earlier in this section.)

USING CKCLOSE

Upon successful completion of CKCLOSE, the file identified by filetable is no longer available for processing. Note that a KSAM file can be closed and then reopened in order to specify a different access mode or input-output type.

EXAMPLES

Assuming the same filetable and status definitions used to define the sample file in Figure 3-2 Representation of KSAMFILE Used in COBOL Examples:

FINISH. 

   CALL "CKCLOSE" USING FILETABLE, STAT. 

   IF STATUS-KEY-1 = "9" THEN 

        CALL "CKERROR" USING STAT, RESULT 

        DISPLAY "CKCLOSE ERROR NO. ", RESULT; 

   ELSE DISPLAY"CKCLOSE SUCCESSFUL".