[Info-vax] Command Procedure pass value to program READ

Arne Vajhøj arne at vajhoej.dk
Thu Feb 10 19:27:15 EST 2022


On 2/8/2022 11:38 AM, HCorte wrote:
> A terça-feira, 8 de fevereiro de 2022 à(s) 15:19:36 UTC, abrsvc escreveu:
>> On Tuesday, February 8, 2022 at 10:16:57 AM UTC-5, HCorte wrote:
>>> Well the project that am working multiple executables the source
>>> code is using in the WRITE statements unit=5 instead of correct
>>> unit=6 that originates the following error when running the
>>> script to inject the params needed for the input's...
>>> 
>>> %FOR-F-ERRDURWRI, error during write unit 5 file SYS$INPUT:.; 
>>> user PC 00000000
>>> 
>>> Since it detects that its a unit 5 assumes that is READ/SYS$INPUT
>>> when in fact for this specific cases its a Write... can't change
>>> the source code since this value is passed as parameter in
>>> multiple source code file, so gona have to give up the ideia of
>>> automatizing the running of a group of programs.
>>> 
>>> Is there any reason one would use unit=5 for Write??

>> In older FORTRAN programs, writes to unit 5 were usually prompts to
>> the user. I haven't seen this in many years though.
> 
> The source code of this subroutine is from the 90's, gona try later
> changing this subroutine itself and put a condition if its unit=5
> change the value to unit=6.

It is what it is.

read unit * means read unit 5

write unit * means write unit 6

unit 5 points default to SYS$INPUT

unit 6 points default to SYS$OUTPUT

if SYS$INPUT and SYS$OUTPUT both points to the terminal then 5 and 6 
points to the same and you can both read and write from and to both

if SYS$INPUT points to an input file then you cannot write to 5

if SYS$OUTPUT points to an output file then you cannot read from 6

Demo:

       program io
       character*1 dummy
       write(*,*) '*'
c this fails if SYS$INPUT is a file:
       write(5,*) '5'
       write(6,*) '6'
       write(*,'(1x,a,$)') 'Read from *: '
       read(*,*) dummy
       write(*,'(1x,a,$)') 'Read from 5: '
       read(5,*) dummy
       write(*,'(1x,a,$)') 'Read from 6: '
c this fails if SYS$OUTPUT is a file:
       read(6,*) dummy
       end

Arne



More information about the Info-vax mailing list