Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Please help FORTRAN

  1. Feb 13, 2012 #1
    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 :)
     
  2. jcsd
  3. Feb 13, 2012 #2
  4. Feb 13, 2012 #3

    rcgldr

    User Avatar
    Homework Helper

    Re: FORTRAN 95: New to fortran, want to learn how to input a function

    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 (...).

    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: Feb 13, 2012
  5. Feb 13, 2012 #4

    NascentOxygen

    User Avatar

    Staff: Mentor

    Re: Help with Fortran compile error.

    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" [Broken]

    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: May 5, 2017
  6. Feb 13, 2012 #5

    jtbell

    User Avatar

    Staff: Mentor

    Re: Please help !! FORTRAN ..

    I've merged multiple replies from different threads, into a single thread.
     
  7. Feb 14, 2012 #6

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    Re: FORTRAN 95: New to fortran, want to learn how to input a function

    Maybe, but unix still understands this stuff - for example the -f option on the lpr command.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook