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

OPENING A KSAM FILE WITH A COBOL PROCEDURE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

The CKOPEN procedure requires two parameters: one is a table that identifies the file and specifies the type of access; the other is a two-byte item to which the status of the call is returned. When calling this procedure from a FORTRAN program, the filetable parameter must be defined as an eight-word array containing both integer and character values.

Any item that is defined as COMPUTATIONAL or COMP in a COBOL program is declared as an INTEGER in a FORTRAN program when it contains four bytes or less. Thus, the following are equivalent:

   02 FILENUM PIC S9(4) COMP. <---------------------- COBOL description 



   INTEGER FILENUM <--------------------------------- FORTRAN description 

Any data items defined with a picture of X in COBOL would be declared as CHARACTER items in FORTRAN. Thus, the following are equivalent:

 

   02 FILENAME PIC X(8). <------------------------- COBOL description 

   CHARACTER *8 FILENAME <---------------------- FORTRAN description 

Assuming that file FEXAMFIL has been created by the >BUILD command, the FORTRAN statements in Figure 5-2 “Opening KSAM File with CKOPEN” open that file for output only and sequential access.

Figure 5-2 Opening KSAM File with CKOPEN

 

         INTEGER FILETABLE(8) 

         CHARACTER FILETABLC(16) 

         INTEGER FILENUM 

         CHARACTER*8 FILENAME 

         CHARACTER*2 FSTAT 

         INTEGER IOTYPE 

         INTEGER AMODE 

         INTEGER PREVOP 

         EQUIVALENCE (IFSTAT,FSTAT) 

         EQUIVALENCE (FILETABLE,FILETABLC,FILENUM) 

         EQUIVALENCE (FILETABLC(3),FILENAME) 

         EQUIVALENCE (FILETABLE(6),IOTYPE) 

         EQUIVALENCE (FILETABLE(7),AMODE) 

         EQUIVALENCE (FILETABLE(8),PREVOP) 

         DATA FILENAME/"FEXAMFIL"/,PREVOP/0/ 



C**********************************************************************

C OPEN KSAM FILE FOR SEQUENTIAL INPUT                                 *

C**********************************************************************



            IOTYPE=1                   I/O type is output only 

            AMODE=0                       access mode is sequential 

            CALL CKOPEN(FILETABLE,IFSTAT) 
Feedback to webmaster