Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Steve Lionel" <Steve.Lionel@digital.com>
Subject: Re: VMS FORTRAN LUN to channel mapping
Date: 1998/12/21	[thread overview]
Message-ID: <75lqh3$fjl@usenet.pa.dec.com> (raw)
In-Reply-To: 75eou2$qif$1@nnrp1.dejanews.com

<miim@cvfn.org> wrote in message news:75eou2$qif$1@nnrp1.dejanews.com...

>I have quite a pile of RSX FORTRAN undergoing conversion to
>Alpha OpenVMS.  Much of it is subroutines which accept a
>Fortran LUN as a parameter, then do a QIO to the associated
>LUN.
>
>This worked great under RSX, but under VMS an HLL LUN is not
>the same thing as a channel, and QIOs are done to channels.
>
>Does anyone know how to peek into the Fortran OTS LUN to
>channel mapping mechanism to get this information?

You couldn't use it even if you got it - the channel is owned by RMS in exec
mode.

The way to do what you want is to set the FAB$V_UFO bit in the FAB before
the OPEN is done (you can do this in a USEROPEN routine) and then the
channel number will be in FAB$W_STV after the OPEN completes.  You can get a
pointer to the FAB by calling FOR$RAB and following RAB$L_FAB.  Here's an
off-the-cuff example:

    EXTERNAL UOPN
    OPEN (UNIT=1,FILE='file.dat',STATUS='OLD',USEROPEN=UOPN)
    ...
    INTEGER*4 FUNCTION UOPN (FAB,RAB,LUN)
    INCLUDE '($FABDEF)'
    INCLUDE '($RABDEF)'
    INCLUDE '($SYSSRVNAM)'
    RECORD /FABDEF/ FAB
    RECORD /RABDEF/ RAB
    INTEGER*4 LUN

    FAB.FAB$L_FOP = FAB.FAB$L_FOP .OR. FAB$M_UFO
    UOPN = SYS$OPEN (FAB)
    RETURN
    END

    ! Routine to return channel number for a UFO'd LUN
    INTEGER*2 FUNCTION GETCHAN (LUN)
    INCLUDE '($FABDEF)'
    INCLUDE '($RABDEF)'
    RECORD /FABDEF/ FAB
    RECORD /RABDEF/ RAB
    POINTER (P_FAB, FAB)
    POINTER (P_RAB, RAB)
    INTEGER*4 FOR$RAB, LUN

    P_RAB = FOR$RAB (LUN)
    IF (P_RAB .EQ. 0) THEN
      GETCHAN = -1 ! No channel available
      RETURN
      END IF
    P_FAB = RAB.RAB$L_FAB
    GETCHAN = FAB.FAB$W_STV
    RETURN
    END


Now... do you REALLY need to do this?  What kind of "file" are you doing
QIOs to and what kind of QIOs?

Steve Lionel                    mailto:Steve.Lionel@digital.com
DIGITAL Fortran Development     http://www.digital.com/info/slionel.html
Compaq Computer Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698           "Free advice is worth every cent"

DIGITAL Fortran web site: http://www.digital.com/fortran









  reply	other threads:[~1998-12-21  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-18  5:00 Q: VMS FORTRAN LUN to channel mapping miim
1998-12-21  5:00 ` Steve Lionel [this message]
1998-12-21  5:00   ` John Laird
1998-12-21  5:00     ` Steve Lionel
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox