From:	SMTP%"gbraine@cks.ssd.k12.wa.us" 11-MAR-1995 09:27:06.12
To:	EVERHART
CC:	
Subj:	Re: Equivalent of INTEGER*8 on a VAX?

From: Gerald B Raine <gbraine@cks.ssd.k12.wa.us>
X-Newsgroups: comp.os.vms
Subject: Re: Equivalent of INTEGER*8 on a VAX?
Message-ID: <Pine.SUN.3.91.950310080900.26167A-100000@cks>
Date: Fri, 10 Mar 1995 08:13:09 -0800 (PST)
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 84
To: Info-VAX@Mvb.Saic.Com



On 9 Mar 1995, C. Marby wrote:

> I have some VMS Fortran code that opens a file as follows
> 
> 	OPEN (... ACCESS='KEYED', KEY=(1:8:INTEGER) ...)
> 
> which corresponds to the format of the file. Under Alpha OpenVMS
> Fortran the following is valid:
> 
> 	INTEGER*8 QUADWORD
> 	
> 	QUADWORD = ...
> 
> 	READ (... KEYID=0, KEY=QUADWORD ...)....
> 
> And all is fine.
> 
> I would like to do this on a VAX as well, but the INTEGER*8 is not
> supported on VAXen. Previously it worked to declare QUADWORD as an
> array of two INTEGER*4's however under VMS 6.1, DEC Fortran 6.2, this
> generates an invalid key error for the READ statement. Not surprising
> really! So how does one get a QUADWORD as a key under DEC Fortran 6.2
> on OpenVMS VAX?
> 
I haven't used this code on the latest FORTRAN bot this is the way I 
opened an INTEGER*8 key using two INTEGER*4's

*
***     Open Alarm Database
*
        OPEN (  UNIT            =  LUNALRM,
        1       ACCESS          = 'KEYED',
        2       FILE            =  FILE_ALRM,
        3       FORM            = 'UNFORMATTED',
        4       IOSTAT          =  IOS,
        5       SHARED,
        6       USEROPEN        =  UFO_ALARM,
        7       STATUS          = 'OLD' )

        IF ( IOS .NE. IO_SUCCESS ) THEN
            TYPE *,'OPEN error in ALARM database.   IOS = ',IOS
        END IF

        INTEGER FUNCTION UFO_ALARM ( FAB,RAB,LUN )
*+      Integer Function UFO_ALARM ( FAB,RAB,LUN )
*
*       This function allows the reading of the 8-byte Date/Time key with
*       Fortran.
*-
        IMPLICIT INTEGER ( A-Z )

        INCLUDE         '($FABDEF)'
        INCLUDE         '($RABDEF)'
        INCLUDE         '($SYSSRVNAM)'
        INCLUDE         '($XABDEF)' 
        INCLUDE         '($XABKEYDEF)' 

        RECORD  /FABDEF/        FAB
        RECORD  /RABDEF/        RAB
        RECORD  /XABKEYDEF/     XAB0                    ! Key 0


        FAB.FAB$L_XAB   = %LOC(XAB0)                    ! Point to XABKEY 
block

        XAB0.XABKEYDEF$$_FILL_1 = XAB$C_KEY             ! Init type code
        XAB0.XABKEYDEF$$_FILL_2 = XAB$C_KEYLEN          ! Init block length
        XAB0.XABKEYDEF$$_FILL_4 = 0                     ! Point to next XAB
        XAB0.XAB$B_DTP          = XAB$C_BN8             ! Select bin8 key 
type

* Open file...

        UFO_ALARM = SYS$OPEN ( FAB )

        IF ( UFO_ALARM ) UFO_ALARM = SYS$CONNECT ( RAB )

        END

Just a suggestion if of interest...

Cheers
