Help with FORTRAN: 200,100,100 & 1H1 Interpretation

  • Context: Fortran 
  • Thread starter Thread starter Arokiamary
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary

Discussion Overview

The discussion revolves around the interpretation of specific lines of FORTRAN code, particularly focusing on the arithmetic IF statement and the FORMAT statement used in the code. Participants seek clarification on the meaning of the statement numbers (200, 100, 100) and the significance of the Hollerith format (1H1).

Discussion Character

  • Technical explanation
  • Debate/contested
  • Meta-discussion

Main Points Raised

  • Some participants explain that the line (200,100,100) represents an arithmetic IF statement, directing the flow of execution based on the value of NR: to statement 200 if negative, to 100 if zero, and to 100 if positive.
  • Others clarify that the 1H1 in the FORMAT statement refers to one Hollerith character, specifically the character '1', and suggest that this method is an older way of specifying characters in FORTRAN.
  • A participant notes that the use of Hollerith format may be tied to specific behaviors in output formatting on older machines, such as causing page ejects or double spacing.
  • There is a suggestion that the code is quite old, but some argue that similar constructs are still understood in modern systems.
  • One participant advises against posting multiple questions in different threads and suggests conducting further research for additional FORTRAN statements.

Areas of Agreement / Disagreement

Participants generally agree on the interpretation of the arithmetic IF statement and the meaning of the Hollerith format, but there is some uncertainty regarding the implications of using such old code and its relevance in modern programming contexts.

Contextual Notes

Some participants mention that the understanding of Hollerith format and its implications may depend on the specific machine architecture and historical context of the code.

Who May Find This Useful

Individuals interested in FORTRAN programming, particularly those dealing with legacy code or exploring older programming paradigms, may find this discussion beneficial.

Arokiamary
Messages
1
Reaction score
0
Please help ! FORTRAN ..

SUBROUTINE PRGTAC
COMMON IA(2),IB(2),J,JSUM,IFL
NR=4000-JSUM
IF(NR-51) 200,100,100
100 JSUM=0
RETURN
200 IF(NR.EQ.6 .OR. NR.EQ.7) PRINT 1
1 FORMAT(1H1)



In the above given lines from a program.. What does the 4th line intepret ? (200,100,100)
and what does 1H1 in the format mean ? .. Thank you :)
 
Technology news on Phys.org


Arokiamary said:
In the above program.. what does (200,100,100) in the 4th line mean?
It's an arithmetic if statement, which goes to the first statement number (in this case 200) if the result is negative, second statement number if the result is zero (in this case 100), and the third statement number if the result is positive (in this case also 100). The GOTO(...)IFL is a computed goto statement, where IFL indexes the list of statement numbers in (...).

Arokiamary said:
Can someone help me with the format explanation too ?
The 1H1 means one "Hollerith" character, in this case '1'. It's an old method for specifying characters, you could probably use '1' instead. My guess is that on the machine this code was written for, a '1' as the first character of output on a line cause a page eject. '+' would cause an overwrite. '0' would double space, and a space (' ') would produce a normal line. '/', is probably 'end of record' so '//' should should cause a double space.

This must be really old code.
 
Last edited:


Arokiamary said:
In the above program.. what does (200,100,100) in the 4th line mean ? Can someone help me with the format explanation too ?
Welcome to PF. You should post your question to only one thread, and wait for an answer there. It is better to start a new thread for your question, since it is not on the specific tpoic of the post where you have piggybacked it.

I see you already got your answer to the computed IF statement in another thread. For help with other FORTRAN statements I suggest you do a google search. As for the H in the FORMAT statement, I recall that H stands for Hollerith. Here is more detail: "gcc.gnu.org/onlinedocs/.../gfortran/Hollerith-constants-support.html"

Good luck. When experimenting, never hesitate to modify a line of code to investigate how your change causes it to run differently. You'll learn a lot through trial and error; and even better, you'll remember it! :smile:
 
Last edited by a moderator:


I've merged multiple replies from different threads, into a single thread.
 


rcgldr said:
The 1H1 means one "Hollerith" character, in this case '1'.
...
This must be really old code.

Maybe, but unix still understands this stuff - for example the -f option on the lpr command.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 22 ·
Replies
22
Views
5K
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K