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

  • Thread starter Thread starter Arokiamary
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion focuses on understanding specific lines of FORTRAN code. The fourth line, which contains the values (200,100,100), is part of an arithmetic IF statement. This statement directs the program to jump to statement 200 if the result is negative, to statement 100 if zero, and to statement 100 again if positive. The format specifier 1H1 indicates one Hollerith character, which in this case is '1'. Hollerith is an older method for character specification in FORTRAN, and the output behavior of '1' may have specific implications on the machine this code was designed for, such as causing a page eject. The code is recognized as outdated, but it remains functional in certain environments, such as Unix. Participants also suggest that experimenting with code modifications can enhance understanding.
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
What percentage of programmers have learned to touch type? Have you? Do you think it's important, not just for programming, but for more-than-casual computer users generally? ChatGPT didn't have much on it ("Research indicates that less than 20% of people can touch type fluently, with many relying on the hunt-and-peck method for typing ."). 'Hunt-and-peck method' made me smile. It added, "For programmers, touch typing is a valuable skill that can enhance speed, accuracy, and focus. While...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

Similar threads

Replies
12
Views
3K
Replies
8
Views
4K
Replies
6
Views
2K
Replies
4
Views
2K
Replies
22
Views
5K
Replies
2
Views
2K
Replies
14
Views
2K
Replies
5
Views
2K
Back
Top