[Info-vax] Command Procedure pass value to program READ
HCorte
hmmbcorte at gmail.com
Tue Feb 8 11:51:34 EST 2022
A terça-feira, 8 de fevereiro de 2022 à(s) 16:38:02 UTC, HCorte escreveu:
> 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??
> > >
> > > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > > Three unit numbers are automatically associated with specific standard I/O files at the start of program execution. These preconnected units are standard input, standard output, and standard error:
> > >
> > > Standard input is logical unit 5 (also Fortran 90 unit 100)
> > >
> > > Standard output is logical unit 6 (also Fortran 90 unit 101)
> > >
> > > Standard error is logical unit 0 (also Fortran 90 unit 102)
> > 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.
>
> Getting a behaviour when the WRITE uses format with editor descriptor $ when the script injects the input:
>
> >@script
> ENTER FILE NAME:
> File Name is:
> good
> ENTER FILE NAME2: >
> File Name is:
> well
>
> when the program run directly puts well
> >r program_example
> ENTER FILE NAME:
> good
> File Name is:
> good
> ENTER FILE NAME2: >well
> File Name is:
> well
>
> is there a way to provide in the script to ignore the $ edit descriptor?
> (https://docs.oracle.com/cd/E19957-01/805-4939/z400074387ff/index.html)
>
> -----------------------------------------------------------------------------------------
> the script
> $!example
> $!DEFINE/USER_MODE SYS$INPUT SYS$COMMAND
> $RUN PROGRAM_EXAMPLE
> good
> well
> -----------------------------------------------------------------------------------------
> the program
> PROGRAM PROGRAM_EXAMPLE
> IMPLICIT NONE
>
> CHARACTER*60 FILENAME,FILENAME2
>
> WRITE(6,102) 'ENTER FILE NAME:'
> READ(5,101) FILENAME
> write(6,102) 'File Name is: ',FILENAME
> C-------second Read-------------------------
> C PAUSE
> C WRITE(6,102) 'ENTER FILE NAME2:'
> CALL WRITE_TEST(6,'ENTER FILE NAME2:')
> READ(5,101) FILENAME2
> write(6,102) 'File Name is: ',FILENAME2
> 101 FORMAT(' ',A)
> 102 FORMAT(' ',A)
>
> ------------------------------------------------------------------------------------------
> the subroutine
> SUBROUTINE WRITE_TEST(LUN, STRING)
> IMPLICIT NONE
> C
> INTEGER*4 LUN
> CHARACTER STRING*(*)
> C
> C
> WRITE(LUN, 1001) ,STRING
> 1001 FORMAT(' ',A,' >',$)
> C
> RETURN
> END
**the script output is the follow:
@script
ENTER FILE NAME:
File Name is:
good
ENTER FILE NAME2: >
File Name is:
well
More information about the Info-vax
mailing list