Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
15 Views

Detecting OUTPUT_UNIT and ERROR_UNIT 'equivalence'.

Is there a way to detect the 'equivalence' of OUTPUT_UNIT (which is 6) and ERROR_UNIT (which is 0) when both are connected to the console, to avoid duplicate output there?

In other words, considering the code

WRITE(UNIT=OUTPUT_UNIT,FMT='(A)') 'Some text'
WRITE(UNIT=ERROR_UNIT,FMT='(A)') 'Some text'

can we avoid having a duplicate output of 'Some text' when using the console? (when the console is not used, it's okay and in fact desired to have separate output to stderr and stdout).

0 Kudos
2 Replies
Highlighted
15 Views

Do an INQUIRE by unit on both units, asking for NAME=. Compare the strings. 

0 Kudos
Highlighted
Beginner
15 Views

It works beautifully, neat trick! Thanks Steve.

0 Kudos