OPEN(UNIT=7,FILE='PROB.OUT',FORM='FORMATTED',STATUS='UNKNOWN')
This command assigns the unit number (=7) to which you will write the formatted information. Use a CLOSE command before you end your program; otherwise, the compiler may or may not close the file for you at the end of execution.
Remember to close the unit before your program terminates; i.e.: CLOSE(7)
Sometimes it is useful to check whether the program was able to successfully open the file. This is done with the IOSTAT parameter in the OPEN statement. For example:
OPEN(UNIT=8,FILE='TEST.OUT', STATUS='UNKNOWN',IOSTAT=IOTST)
! check for open error, if iotst does not = 0, then it did not work, print message
IF(IOTST.NE.0) THEN
PRINT *,'COULD NOT OPEN TEST.OUT'
END IF
for printing out every other element of the first 9 elements of array A, try
A(1) A(3) A(5) A(7) and A(9) are printed on one line
You can loop several arrayes at a time
Note that to use the NCAR graphics routine PLCHHQ, one needs to start GKS, have SET ranges defined, etc. If you are unfamiliar, consult RG's NCAR graphics documentation page. Example usage can be found in the ATM150 software library.
Back to ATM 150 homepage