- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Fortran program hangs when writing to offline reve...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:24 PM - last edited on 05-10-2023 09:29 PM by support_s
05-09-2023 04:24 PM - last edited on 05-10-2023 09:29 PM by support_s
Hi All,
I've recently inherited our VMS system and I'm running into problems when a fortran program tries to write to a reverse TNA device that is offline at the device end (e.g. powered off, network outage). These still show up as online when using:
>show dev tna
(Which I believe to be property of reverse telnet devices.)
The TNA devices are opened in fortran using the standard Open() function and are written to using the standard write() function.
Ideally the write function, or underlying tcp, would hit a timeout/error condition and return an iostat which can be handled and the program can continue.
I've read through the available documentation on fortran and tcpip but haven't found anything I think is relevant.
Any ideas on how I can prevent the program hanging? Thanks!
Running:
OpenVMS 8.4-2
TCPIP V5.7 - ECO5
VSI Fortran V8.3
Apologies if this is poorly worded/explained, I'm new to both VMS and software management.
Cheers,
RBW
Solved! Go to Solution.
- Tags:
- Operating System
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 02:32 AM
05-10-2023 02:32 AM
SolutionRBW,
AFAIK a write with timeout cannot be done with standard FORTRAN statements.
You have 2 alternatives. both require OpenVMS programming skills and changes to your source code:
- use USEROPEN and set RAB$V_TMO and RAB$B_TMO
see VSI Fortran for OpenVMS User Manual — VMS Software, Inc.
- use QIOs with a timer, ASTs and/or event flags
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 02:09 PM
05-15-2023 02:09 PM
Re: Fortran program hangs when writing to offline reverse TNA device
Thanks for the leads Volker! I'll accept this as the solution until I get around to testing/confirming useropen.
Cheers,
RBW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 09:15 AM
05-16-2023 09:15 AM
Re: Fortran program hangs when writing to offline reverse TNA device
Hi,
I did something similar with useropen to set the wait-for-lock bit. I've modified this slightly to use the timeout bit to produce a demo program. Hopefully this will help. It does I/O to the terminal using Fortran Read/Write. If the read times out, it will exit with an error.
Tom Wade
C Program to demonstrate timeout I/O
Program Demo_Timeout
Implicit None
Integer status, unit, length
Character *256 line
Integer Set_Timeout_IO
External Set_Timeout_IO
Call Lib$Get_LUN (unit)
Open (unit, name='SYS$COMMAND', status='old', useropen=Set_Timeout_IO)
C Write and read some data.
Write (unit, 21, err=80)
21 Format (' This is some data')
Read (unit, 11, err=80) length, line
11 Format (Q, A)
Write (unit, 22, err=80) line (1:length)
22 Format (' Read "', A, '"')
Close (unit)
Call Lib$Free_Lun (unit)
Call Exit
C Error branch
80 Call Errsns (,status,,,)
Call Exit (status)
End
C+
Integer Function Set_Timeout_IO (fab, rab, unit)
C Open the file described by File Access Block 'fab', Record Access Block
C 'rab' and logical unit number 'unit'. We open the file so that all I/O
C is subject to a timeout.
C-
Integer unit, status
Include '($FABDEF)'
Include '($RABDEF)'
Include '($SYSSRVNAM)'
Record /FABDEF/ fab
Record /RABDEF/ rab
C Set the required bit for timeout
rab.Rab$L_Rop = rab.Rab$L_Rop .or. Rab$M_Tmo
C Set the timeout period
rab.Rab$B_Tmo = 5 ! seconds
C Open the file.
status = Sys$Open (fab)
If (status) status = Sys$Connect (rab)
C Return status
Set_Timeout_IO = status
End
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 04:16 PM - edited 05-16-2023 04:17 PM
05-16-2023 04:16 PM - edited 05-16-2023 04:17 PM
Re: Fortran program hangs when writing to offline reverse TNA device
Hi Tom,
Thanks for the code, I have a similar test program based on the info Volker directed me to. It seems to me the timeout only concerns reads and not writes, my program will still hang indefinitely when I write to the device and it's off.
c
Program test_useropen
c
integer iostat,ierr,sysfil
external timeout_config
c
sysfil = 10000
c
Print *, 'opening device'
OPEN (UNIT=SYSFIL,
1 STATUS='OLD',
1 SHARED,
1 ACCESS='APPEND',
1 FILE='FIL', ! FIL is a system logical = TNA101:
1 IOSTAT=IOSTAT,
1 FORM='FORMATTED',
1 USEROPEN=TIMEOUT_CONFIG)
Print *, 'open status: ',iostat
c
c
Print *, 'starting write'
write(sysfil,fmt=10,iostat=iostat)
10 format(1x,'testing writing to an offline device')
Print *, 'finished or skipped write with status: ',iostat
close(sysfil)
c
END
c
c
Integer Function Timeout_config(FAB,RAB,LUN)
c
Include '($FABDEF)'
Include '($RABDEF)'
Include '($SYSSRVNAM)'
c
Record /FABDEF/ FAB
Record /RABDEF/ RAB
c
RAB.RAB$L_ROP = IBSET(RAB.RAB$L_ROP,RAB$V_TMO)
RAB.RAB$B_TMO = 5
c
Timeout_config = sys$open(fab)
IF (.not. timeout_config) RETURN
Timeout_config = sys$connect(rab)
c
Return
END
c
Cheers,
RBW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2023 10:33 PM - edited 05-17-2023 10:50 PM
05-17-2023 10:33 PM - edited 05-17-2023 10:50 PM
Re: Fortran program hangs when writing to offline reverse TNA device
RBW,
as the RAB$V_TMO mechanism does not seem to work on WRITE - see above examples - I checked the DCL READ and WRITE statements. There is a /TIME_OUT=n parameter for READ, but not for WRITE. This might mean, that a timeout for a RMS WRITE operation is not implemented - except for a timeout on a record lock.
So the best approch would be to write a subroutine, which uses QIOs and TIMER ASTs
See previous discussion of a similar questions in
Re: SYS$QIOW doesn't return to caller - Hewlett Packard Enterprise Community (hpe.com)
Volker.