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

OVERVIEW

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

KSAM files are accessed from COBOL programs through calls to a set of procedures. These procedures allow you to open, open for shared access, write records to, read records from, lock, unlock, update, position, and close a KSAM file. (Refer to Table 3-1 “KSAM Procedures for COBOL Interface” for a list of the procedures and their associated functions.) The COBOL procedures provided with KSAM/3000 correspond to the INDEXED I-O module statements in COBOL 74.

Note: The following applies when using KSAM with COBOL.

  • The KSAM file must be created with KSAMUTIL's >BUILD command.

  • To access a KSAM file in chronological order, the KSAM file must be copied to a non-KSAM file.

  • KSAM permits duplicate primary keys as an extension to the ANSII standards.

In HP COBOL/3000, the procedures that are used to access KSAM files differ in form from the COBOL input/output statements used to access non-KSAM files. The KSAM interface procedures use parameters for information that would otherwise be specified in the FILE-CONTROL paragraph and the FD entry of the DATA DIVISION. These parameters are themselves defined in the WORKING-STORAGE section of the DATA DIVISION. The main restriction on the KSAM interface call parameters is that they must start on word boundaries.

Table 3-1 KSAM Procedures for COBOL Interface

PROCEDURE

NAME

PARAMETERSFUNCTIONPAGE
CKCLOSE

filetable

status

Terminates processing of KSAM file identified by filetable.3-12
CKDELETE

filetable

status

Logically removes record from KSAM file; deleted record is identified by previous read.3-13
CKERROR

status,

result

Converts numeric value returned in status to character string result.3-17
CKLOCK

filetable

status

lockcond

Dynamically locks file opened for shared access, conditionally depending on lockcond.3-18
CKOPEN

filetable

status

Initiates processing of file named in filetable; returns file number to first word of filetable.3-20
CKOPENSHR

filetable

status

Initiates processing with dynamic locking and shared access of file named in filetable. 3-25
CKREAD

filetable

status

record

recordsize

Reads next sequential record from KSAM file identified by filetable into record.3-26
CKREADBYKEY

filetable

status

record

key

keyloc

recordsize

Reads into record first record with a key in location keyloc whose value matches that of key, from KSAM file identified by filetable.3-29
CKREWRITE

filetable

status

record

recordsize

Replaces last sequential record read by CKREAD, or replaces record whose primary key matches the value of key item in record, with the contents of record.3-32
CKSTART

filetable

status

relop

key

keyloc

keylength

Positions record pointer in preparation for a sequential read to the first record with a key in location keyloc whose value has the relation relop to the value of key.3-36
CKUNLOCK

filetable

status

Unlocks file dynamically locked by CKLOCK.3-40
CKWRITE

filetable

status

record

recordsize

Writes record of length recordsize from record to a KSAM file identified by filetable.3-42

 

Feedback to webmaster