Efficiency Examples

Example 1

Task: Print out the values of 3 or 4 dozen variables in a FORTRAN program to check the values and find errors.

The left column below has a script from which a much more cryptic and busy FORTRAN WRITE() statement is generated (shown in column 2)

The cost of manually producing column 1 is 1/3 to 1/4 that of manually producing column 2.

Column 2 is the FORTRAN statement that prints out the indicated variables.

SUBROUTINE STORE(F) ; &IM ; &DM F(&NSAVE) ! STORE_

C ***************************************************************
C BWRITE IS A ‘BLOCK WRITE’ FORTRAN EXTENSION
C BWRITE IS FOLLOWED BY 1) PRINT SELECTION NUMBER 2) PRINT STATEMENT
C  IDENTIFICATION STRING, AND FINALLY BY A, SPACE SEPARATED,
C  LIST OF VARIABLES AND EXPRESSIONS TO BE PRINTED.
C ***************************************************************
BWRITE 216 h735:store():ctr1 IJ I II IK Z NVZN NTW NPLOD NDU NDIAML NWLT NVG VZM MINT1 NVZN NDQFLZ NIK NWV NDQADZ DQMDZ NNV NHGW NHG NHWMP NHGC NHI NHC NHA NWTQ NPO2V NTGC NTH NDQGCZ NDIAHI NDIAHO NTAEXG NHWML NHWMU NHWGC NHWH NHGCH HWGV NTGBR NTMBAR NVFRM NVC NTGCBR NHQ NHHS NIBRNR NQTGC NAHTR NARU NARV NARL NALHTH NALHTV NALKG NHS1 NALRL NALRV NALRU NSVF NTVF NTHTRA NQHEIN NIBRKH NAMDTA NDLTAH NCFENT NQHER NQWR NQHEW NQSHEL  NFHEW FHER FWHE FWR FWR FRHE FRR DIAM DIAHI DIAHO DIAMHI DIAMHO DIAMWI DIAWI DIAMWO DIAWO DIAML DIAM DRC DTGC DWT  DQGVZ HLT HLB QWGC QWH QWHE TGH TS T1 WLF WLB WLT PROPK(INT1,IINDRC)

      F(NDIAWI)   =DIAMWI
F(NTW)      =TW
F(NPLOD)    =PLOD
………

      RETURN
END

SUBROUTINE STORE(F)
IMPLICIT REAL*8(A-H,O-Z),INTEGER(I-N)
DIMENSION F(320)

C *********************************************************************
IF(FLAGS(216)) THEN
C     THE FOLLOWING FORTRAN PRINT(WRITE) STATEMENT IS GENERATED FROM
C     THE BWRITE STATEMENT ABOVE.  THUS, ONE STARTS WITH A SMALL NUMBER
C     OF LINES OF SCRIPT THAT SPECIFY WHAT IS TO BE DONE, AND THE
C     GENERATOR CONVERTS THIS SCRIPT INTO A VERY BUSY PROGRAMMING
C     LANGUAGE STATEMENT THAT PERFORMS THE OPERATIONS THE SCRIPT
C     SPECIFIES. EXPANSION RATIOS FROM 1 LINE OF SCRIPT TO
C     BETWEEN 5 AND 100 LINES OF GENERATED PROGRAM ARE CAN BE ACHIEVED. 

      WRITE(IOUT,'(A)') '******************************************'
WRITE(IOUT,'('' h735:store():ctr1:216:DIAHI='',1PD11.4, '' DIAHO
C='',1PD11.4, '' DIAM='',1PD11.4, '' DIAMHI='',1PD11.4, '' DIAMHO='
C',1PD11.4, '' DIAML='',1PD11.4, '' DIAMWI='',1PD11.4, '' DIAMWO=''
C,1PD11.4, '' DIAWI='',1PD11.4/'' DIAWO='',1PD11.4, '' DQGVZ='',1PD
C11.4, '' DQMDZ='',1PD11.4, '' DRC='',1PD11.4, '' DTGC='',1PD11.4,
C'' DWT='',1PD11.4, '' FHER='',1PD11.4, '' FRHE='',1PD11.4, '' FRR=
C'',1PD11.4, '' FWHE='',1PD11.4/'' FWR='',1PD11.4, '' HLB='',1PD11.
C4, '' HLT='',1PD11.4, '' HWGV='',1PD11.4, '' I='',I6, '' II='',I6,
C '' IJ='',I6, '' IK='',I6, '' MINT1='',I6, '' NAHTR='',I6, '' NALH
CTH='',I6/'' NALHTV='',I6, '' NALKG='',I6, '' NALRL='',I6, '' NALRU
C='',I6, '' NALRV='',I6, '' NAMDTA='',I6, '' NARL='',I6, '' NARU=''
C,I6, '' NARV='',I6/'' NCFENT='',I6, '' NDIAHI='',I6, '' NDIAHO='',
CI6, '' NDIAML='',I6, '' NDLTAH='',I6, '' NDQADZ='',I6, '' NDQFLZ='
C',I6, '' NDQGCZ='',I6/'' NDU='',I6, '' NFHEW='',I6, '' NHA='',I6,
C'' NHC='',I6, '' NHG='',I6, '' NHGC='',I6, '' NHGCH='',I6, '' NHGW
C='',I6, '' NHHS='',I6, '' NHI='',I6/'' NHQ='',I6, '' NHS1='',I6, '
C' NHWGC='',I6, '' NHWH='',I6, '' NHWML='',I6, '' NHWMP='',I6, '' N
CHWMU='',I6, '' NIBRKH='',I6, '' NIBRNR='',I6/'' NIK='',I6, '' NNV=
C'',I6, '' NPLOD='',I6, '' NPO2V='',I6, '' NQHEIN='',I6, '' NQHER='
C',I6, '' NQHEW='',I6, '' NQSHEL='',I6, '' NQTGC='',I6/'' NQWR='',I
C6, '' NSVF='',I6, '' NTAEXG='',I6, '' NTGBR='',I6, '' NTGC='',I6,
C'' NTGCBR='',I6, '' NTH='',I6, '' NTHTRA='',I6, '' NTMBAR='',I6/''
C NTVF='',I6, '' NTW='',I6, '' NVC='',I6, '' NVFRM='',I6, '' NVG=''
C,I6, '' NVZM='',I6, '' NVZN='',I6, '' NWLT='',I6, '' NWTQ='',I6, '
C' NWV='',I6/'' PROPK(INT1,IINDRC)='',1PD11.4, '' QWGC='',1PD11.4,
C'' QWH='',1PD11.4, '' QWHE='',1PD11.4, '' T1='',1PD11.4, '' TGH=''
C,1PD11.4, '' TS='',1PD11.4, '' WLB='',1PD11.4, '' WLF='',1PD11.4/'
C' WLT='',1PD11.4, '' Z='',1PD11.4 )') DIAHI, DIAHO, DIAM, DIAMHI,
CDIAMHO, DIAML, DIAMWI, DIAMWO, DIAWI, DIAWO, DQGVZ, DQMDZ, DRC, DT
CGC, DWT, FHER, FRHE, FRR, FWHE, FWR, HLB, HLT, HWGV, I, II, IJ, IK
C, MINT1, NAHTR, NALHTH, NALHTV, NALKG, NALRL, NALRU, NALRV, NAMDTA
C, NARL, NARU, NARV, NCFENT, NDIAHI, NDIAHO, NDIAML, NDLTAH, NDQADZ
C, NDQFLZ, NDQGCZ, NDU, NFHEW, NHA, NHC, NHG, NHGC, NHGCH, NHGW, NH
CHS, NHI, NHQ, NHS1, NHWGC, NHWH, NHWML, NHWMP, NHWMU, NIBRKH, NIBR
CNR, NIK, NNV, NPLOD, NPO2V, NQHEIN, NQHER, NQHEW, NQSHEL, NQTGC, N
CQWR, NSVF, NTAEXG, NTGBR, NTGC, NTGCBR, NTH, NTHTRA, NTMBAR, NTVF,
C NTW, NVC, NVFRM, NVG, NVZM, NVZN, NWLT, NWTQ, NWV, PROPK(INT1,IIN
CDRC), QWGC, QWH, QWHE, T1, TGH, TS, WLB, WLF, WLT, Z
CALL  FLUSH(IOUT)
ENDIF
C ***********************************************************************
F(NDIAWI)   =DIAMWI
F(NTW)      =TW
F(NPLOD)    =PLOD
………

      RETURN
END

 

Example 2

Task: Print out columns of numbers from a FORTRAN program to be able to make some graphs of values the program is calculating.

The left column below has a script from which a much more cryptic and busy program is generated (shown in column 2).
The cost of manually producing column 1 is 1/10 of that of manually producing the automatically generated program in column 2.

The data that is generated is also shown under columns 1 & 2.

The Windows Script that reads the data and generates the graphics is also shown under the data and a sample graph is also shown under the windows script.

C ************************************************************** C SUBROUTINE OUTP4() PRINT OUT THE TABLES SPECIFIED IN THE
C ENCLOSED SCRIPT, CREATE A SET OF TABLES THAT CAN BE
C READ BY A JAVA PROGAM AND USED TO CREATE PROFESSIONAL
C GRAPHS
C **************************************************************
SUBROUTINE OUTP4 ; &IM
C_IO1 C_A C_D C_SAVE1 C_FLAG C_A1 C_CMAIND C_GENTABLE
C Script Starts Here …
C  a First Table Definition

START TABLE       TMPS
INSERTED BLANK COLUMNS =  2
TOP BLANK ROWS         =  1
TOTAL WIDTH COLUMNS    =110
ROWS INCLUDING HEADING = 50
!          KEY    format   heading
MULTIPLIER=1
COLUMN     NIK      F5.0      IJ
COLUMN     NZ       F7.2
COLUMN     NTGV  F8.2
KEY NTGC NTM NTHG NTH NTGBR NTMBAR NTHG
END TABLE

C  a Second Table Definition For Housing Data

START TABLE       HSNG1
PRINTIFNOTZERO NTHG HSNCO2 HSNH2O HSNN2 HSNSO2 HSNH2S HSNCO HSNO2 HSNCVOL HSNHVOL HSNH2 HSNCVOL1
INSERTED BLANK COLUMNS =  2
TOP BLANK ROWS         =  1
TOTAL WIDTH COLUMNS    =110
ROWS INCLUDING HEADING = 50
!          KEY    format   heading
MULTIPLIER=1
COLUMN     NIK      F5.0      IJ
COLUMN     NZ       F7.2
!    IGASNH ACTCFM TGASNH 1=CO2 2=H2O 3=N2  4=SO2 5=H2S 6=CO 7=O2 8=CVOL 9=HVOL 10=H2 11=CVOL 12=DUST UNUSED
COLUMN     NTHG  F8.2
MULTIPLIER=PPHM
COLUMN     NQHG  F11.0
COLUMN     HSNCO2  F9.2
KEY HSNH2O HSNN2 HSNSO2 HSNH2S HSNCO HSNO2 HSNCVOL HSNHVOL HSNH2 HSNCVOL1
END TABLE
C Script Ends Here

RETURN
END

C ************************************************************** C SUBROUTINE OUTP4() PRINT OUT THE TABLES SPECIFIED IN THE
C ENCLOSED SCRIPT, CREATE A SET OF TABLES THAT CAN BE
C READ BY A JAVA PROGAM AND USED TO CREATE PROFESSIONAL
C GRAPHS
C **************************************************************
SUBROUTINE OUTP4
IMPLICIT REAL*8(A-H,O-Z),INTEGER(I-N)
C ---------------------------------------------------------------
C ---------------------- C_D -------------------------------
C ---------------------------------------------------------------
COMMON/D/IBRK,ICASE,ICNSV,IDU,IEQNQA,IFT(6),IGOF ,IHA ,IJ ,IK
1 ,IK0,IKK,IKN,IMIX ,INDP(10) ,INGAS ,INT1 ,INTL ,INTLX ,INTNL
2 ,INTO2 ,INTT ,IPROB ,IV ,JBED ,JDST ,JF(5,2) ,JLOC ,JRCY ,IJ0
3 ,JSLB ,LAM ,LDZ ,LUMIN ,MGR ,MO2 ,MSLAB ,NAMU ,NAR ,NBED ,NBEDM
4 ,NBR ,NBRKW ,NCASE ,NCH4 ,NCO,NCO2,NCO2B,NCO2G ,NCOM1(5,2) ,NCP
5 ,NCVOL ,NDIA2 ,NDIA3 ,NDIA4 ,NDIAM ,NDST ,NDSTM ,NEP ,NF(2)
5 ,NFGAS
6 ,NFGSP ,NFLA ,NFZAR ,NG(8,2) ,NGASC ,NGASM ,NGF ,NGS, MN2
7 ,NGSIN ,NGSM1 ,NH2 ,NH2O ,NNH3 ,NHVOL ,NINTL ,NITER(3) ,NKGAS
8 ,NKGSP ,NLIN ,NN2 ,NO2 ,NPROP ,NPVOL ,NPVOLB ,NQGV ,NQAMB ,NQFL
9 ,NQGC ,NQM ,NQT2 ,NR1 ,NRCY ,NRCYM ,NREC ,NREGN ,NRHO ,NRO ,NSLB
C ,NSLBM ,NSO2 ,NSTHK ,NSTOR ,NTGV ,NTBL2(30) ,NTIME ,NTM
1 ,NVLS ,NZ ,MZ,NVZN,PROPM(99),NBRKH,NKGDS,NPHIA

C ---------------------------------------------------------------
C ---------------------- C_SAVE1 -------------------------------
C ---------------------------------------------------------------
COMMON/SAVE1/SAVE(320,1000),SAVEWM(320,1000),VARBL(20)

C ---------------------------------------------------------------
C ---------------------- C_FLAG -------------------------------
C ---------------------------------------------------------------
LOGICAL FLAGS,GRRRRR,TESTAR
CHARACTER *30 BLNK
COMMON/FLAG/FLAGS(400),GRRRRR,TESTAR
COMMON/FLAGL/LEVEL,BLNK

C ---------------------------------------------------------------
C ---------------------- C_CMAIND -------------------------------
C ---------------------------------------------------------------
INTEGER PGASA
COMMON/RMAIND/GTMI(6,2),PPHGI(20),FNC(2),NNN(3,2),
1 GM1(6),GR1(6),FBS(3,2),FBS1(3,2),NN1(4,2),VLTO(7,7),
1 VLOU(7,7),
2 VLBR(7,7),VBUR(6),VOUTX(6),VOL1(6),VOL2(6),
2 GSI(6),
3 GMDST(6),GRDST(6),PGASB(13),AIRFU,PGASA(13),INDX(13)
CHARACTER GASNAM*8,GNAM*8,FMT*100
COMMON/CMAIND/GASNAM(13),GNAM(13),FMT

C ---------------------------------------------------------------
C ---------------------- C_GENTABLE -------------------------------
C ---------------------------------------------------------------
INTEGER WWIDTH(30),LHARG(30)
DOUBLEPRECISION F5Z(320)
CHARACTER HARG(30)*20,ZEROCOL*100,WARG(30)*30,DEFFMT(30)*30
LOGICAL PRTCOL(30),COLNT0

C ---------------------------------------------------------------
C ---------------------- C_IO1 -------------------------------
C ---------------------------------------------------------------
INTEGER RCHART,WHTML,WCSV,WTEMP,PIXLX,PIXLY
EQUIVALENCE (IN,IIN),(RCHART,IOUT2),(IOUT3,WHTML)
LOGICAL DFLAGS(1500)
CHARACTER INFILE*80,OUTFIL*80,WHERE1*30,BLANKS*100,VERSION*15,
1 PAGEBRK*45,DEFPTH*255,BASNAM*50,
2 PROGNAME*40,DATE*20,COMPANY*48,CONTD*13
COMMON/INOUT/IOUT,IN,IOUT2, WCSV,IOUT3,NPTSX, NPTSY, NABSC,
1 LNPTSX, LNPTSY, LNABSC, INLINE, MARKR, LMARKR,LANNOT,LPIXLX,
2 LPIXLY,PIXLX,PIXLY,NARGS,DFLAGS
COMMON/INOUT1/INFILE,OUTFIL,WHERE1,BLANKS,VERSION,PAGEBRK,DEFPTH, ! PARXXX
1 BASNAM,PROGNAME,DATE,COMPANY,CONTD
LOGICAL REHEAD
COMMON/CA1/INEWPG,REHEAD,WTEMP

C ---------------------------------------------------------------
C ---------------------- C_A -------------------------------
C ---------------------------------------------------------------
CHARACTER FE*26,WA*16
CHARACTER TABHDG*300, TABROW*300, FMTBLK*40,FMTPGR*20
LOGICAL NOSLAB,NORCYL,YESSLB,YESRCL,NOG,YESG,NEWRAD,NOFUEL,LDUEQN,
1 COOLZN,SEL
INTEGER*8 IPROPK(50,97)
EQUIVALENCE (IPROPK,PROPK)
COMMON/A/HA,BR
COMMON/A/ABURN ,AIR ,AIRBD ,AIREX ,AIRQ4 ,AIRT ,AIRTH ,AIRTT
1 ,AIRVC ,AIRX4 ,AK ,AK0 ,AKLNL ,AKR ,ALMDF(6) ,AMT,AMU
2 ,AMW(20) ,AREAI ,AVMW ,AVTS ,BTUPT ,BTUU ,BURND ,BW, ENDIA
3 ,C(5,43) ,CF ,CLAIR ,CTG1 ,CTG2 ,DCO2 ,DELTA ,DIAM ,DIAMD(10)
4 ,DIAMU ,DLTOA ,DMAX ,DQ ,DZ, EPS1, EPS2, EPS3, EXN2, EXO2, FEED
5 ,FLAM0 ,FLAML ,FLUDZ ,FRH2O ,FRH2R ,FRRCY ,FRSLB ,FTCO2, ENDBR
6 ,GASIN0(15,8) ,GASVL ,GM(6) ,GR(6) ,HGC ,HGW ,HL ,HP
7 ,HS ,PBTUI(15,2) ,PCO2V ,PH2OV ,PHI ,PHIA ,PI ,PID4,PL, QME1
8 ,PLOD ,PNDFD(15,5,2) ,PO2V ,POUNF ,PP ,PPHG ,PPHGJ(20) ,PPHM
9 ,PPHMT ,PRAIR ,PRATM ,PRINC ,PROPK(50,99) ,Q9T ,QAA ,QINF(2) ,QMA
C ,QO ,QQ ,QRADL ,RPM ,SCO2 ,SECDI ,SL ,SLABW ,SLOPE ,SMAX ,STHIK
1 ,STHKM ,TA ,TDU ,TEDU ,TETS ,TETW ,TG ,TGO ,THRNG ,TL ,TM ,TME
2 ,TMI ,TMO ,TP ,TPOTH ,TSAIR ,TT1 ,TT2 ,YESG ,YESRCL ,YESSLB
3 ,IFLAM, DQXDZ0, DQFLZ0, TO ,HWAGV, QWAGV, TAGV, VAG, FEEDR,
4 INTRC,NIJRC,AMRIN,AMMOUT,DUSTR,AMROUT,TAA,TAA2,TAA3,TAA4,TGVMTM,
5 TGVOTM,SV1(25,12),DQXDZ,WTRIN0(4),WATRIN,GEVTOT(6)
COMMON/A/IA ,IPAGE ,L7(70) ,LBDC(12,50) ,LINE ,LQG3(12,25),
1 LQM3(12,25),LSHR(6,40),LTG3(36,14),LTM3(36,2),NBREAK,NLPAGE
2 ,NOG,NORCYL ,NOSLAB,N10,IFLDZ,DSRC,DMASS,SDSRC,SDMASS
3 ,DVLIN(6),DVLOUT(6),VCOOKM(6),VCOOKR(6),TGAV
COMMON/A/TABROW,TABHDG,FMTBLK,FMTPGR
COMMON/CA/ FE,WA
COMMON/CCA/TWMTM,IFHWGV,NEWRAD,NOFUEL,LDUEQN,KOOLZN,COOLZN,
1 TLOW,ZLOW,THI,ZHI,HTUPRT
COMMON/SEL1/SEL(1000)

IF(COLNT0(22)
C .OR.COLNT0(23)
C .OR.COLNT0(24)
C .OR.COLNT0(25)
C .OR.COLNT0(26)
C .OR.COLNT0(27)
C .OR.COLNT0(28)
C .OR.COLNT0(29)
C .OR.COLNT0(30)
C .OR.COLNT0(21)) THEN
C -----------------------------------------------------------------------------------------
NTROWS=50
NCOLSW=110
NBLANK=1
NCOLS =10
PRTCOL(1)=COLNT0(104)
PRTCOL(2)=COLNT0(43)
PRTCOL(3)=COLNT0(68)
PRTCOL(4)=COLNT0(201)
PRTCOL(5)=COLNT0(76)
PRTCOL(6)=COLNT0(283)
PRTCOL(7)=COLNT0(202)
PRTCOL(8)=COLNT0(214)
PRTCOL(9)=COLNT0(215)
PRTCOL(10)=COLNT0(283)
WARG(1)=' '
WARG(2)=' '
WARG(3)=' '
WARG(4)=' '
WARG(5)=' '
WARG(6)=' '
WARG(7)=' '
WARG(8)=' '
WARG(9)=' '
WARG(10)=' '
HARG(1)=' IJ'
HARG(2)=' Z'
HARG(3)=' TGV'
HARG(4)=' TGC'
HARG(5)=' TM'
HARG(6)=' THG'
HARG(7)=' TH'
HARG(8)=' TGBR'
HARG(9)=' TMBAR'
HARG(10)=' THG'
WWIDTH(1)=5
WWIDTH(2)=7
WWIDTH(3)=8
WWIDTH(4)=8
WWIDTH(5)=8
WWIDTH(6)=8
WWIDTH(7)=8
WWIDTH(8)=8
WWIDTH(9)=8
WWIDTH(10)=8
CALL SETSEL(NTROWS)
FMTPGR='(A,/)'
FMTSET=.TRUE.
CALL PAGER(LINE,0,IPAGE,1,5,IOUT,10493)
TABHDG =' TMPS'
LENG=6
DO I=1,NCOLS
IF(PRTCOL(I)) THEN
TABHDG=TABHDG(1:LENG) // HARG(I)(1:WWIDTH(I))
LENG=LENG+WWIDTH(I)
ENDIF
END DO
WRITE(IOUT,'(A)') TABHDG(1:LC(TABHDG))
WRITE(IOUT,'( 2X,80(1H-) )' )
DO I=IJ0,IKN
SEL(I)=.TRUE.
IF(SEL(I)) THEN
CALL PAGER(LINE,NLPAGE,IPAGE,1,5,IOUT,10493)
IF(REHEAD) THEN
WRITE(IOUT,'(A)') TABHDG(1:LC(TABHDG))
WRITE(IOUT,'( 6X,80(1H-) )' )
ENDIF
ENCODE(5, '(F5.0)',WARG(1)) SAVEWM(104,I)
ENCODE(7, '(F7.2)',WARG(2)) SAVEWM(43,I)
ENCODE(8, '(F8.2)',WARG(3)) SAVEWM(68,I)
ENCODE(8, '(F8.2)',WARG(4)) SAVEWM(201,I)
ENCODE(8, '(F8.2)',WARG(5)) SAVEWM(76,I)
ENCODE(8, '(F8.2)',WARG(6)) SAVEWM(283,I)
ENCODE(8, '(F8.2)',WARG(7)) SAVEWM(202,I)
ENCODE(8, '(F8.2)',WARG(8)) SAVEWM(214,I)
ENCODE(8, '(F8.2)',WARG(9)) SAVEWM(215,I)
ENCODE(8, '(F8.2)',WARG(10)) SAVEWM(283,I)
LENG=6
TABROW=' '
DO J=1,NCOLS
IF(PRTCOL(J)) THEN
TABROW=TABROW(1:LENG) // WARG(J)(1:WWIDTH(J))
LENG=LENG+WWIDTH(J)
ENDIF
END DO
WRITE(IOUT,'(A)') TABROW(1:LENG)
ENDIF
END DO
FMTSET=.FALSE.
ENDIF
IF(COLNT0(288)
C .OR.COLNT0(289)
C .OR.COLNT0(292)
C .OR.COLNT0(293)
C .OR.COLNT0(287)
C .OR.COLNT0(291)
C .OR.COLNT0(283)
C .OR.COLNT0(290)
C .OR.COLNT0(286)
C .OR.COLNT0(294)
C .OR.COLNT0(285)
C .OR.COLNT0(295)) THEN
C -----------------------------------------------------------------------------------------
NTROWS=50
NCOLSW=110
NBLANK=1
NCOLS =15
PRTCOL(1)=COLNT0(104)
PRTCOL(2)=COLNT0(43)
PRTCOL(3)=COLNT0(283)
PRTCOL(4)=COLNT0(284)
PRTCOL(5)=COLNT0(285)
PRTCOL(6)=COLNT0(286)
PRTCOL(7)=COLNT0(287)
PRTCOL(8)=COLNT0(288)
PRTCOL(9)=COLNT0(289)
PRTCOL(10)=COLNT0(290)
PRTCOL(11)=COLNT0(291)
PRTCOL(12)=COLNT0(292)
PRTCOL(13)=COLNT0(293)
PRTCOL(14)=COLNT0(294)
PRTCOL(15)=COLNT0(295)
WARG(1)=' '
WARG(2)=' '
WARG(3)=' '
WARG(4)=' '
WARG(5)=' '
WARG(6)=' '
WARG(7)=' '
WARG(8)=' '
WARG(9)=' '
WARG(10)=' '
WARG(11)=' '
WARG(12)=' '
WARG(13)=' '
WARG(14)=' '
WARG(15)=' '
HARG(1)=' IJ'
HARG(2)=' Z'
HARG(3)=' THG'
HARG(4)=' QHG'
HARG(5)=' HSNCO2'
HARG(6)=' HSNH2O'
HARG(7)=' HSNN2'
HARG(8)=' HSNSO2'
HARG(9)=' HSNH2S'
HARG(10)=' HSNCO'
HARG(11)=' HSNO2'
HARG(12)=' HSNCVOL'
HARG(13)=' HSNHVOL'
HARG(14)=' HSNH2'
HARG(15)=' HSNCVOL1'
WWIDTH(1)=5
WWIDTH(2)=7
WWIDTH(3)=8
WWIDTH(4)=11
WWIDTH(5)=9
WWIDTH(6)=9
WWIDTH(7)=9
WWIDTH(8)=9
WWIDTH(9)=9
WWIDTH(10)=9
WWIDTH(11)=9
WWIDTH(12)=9
WWIDTH(13)=9
WWIDTH(14)=9
WWIDTH(15)=9
CALL SETSEL(NTROWS)
FMTPGR='(A,/)'
FMTSET=.TRUE.
CALL PAGER(LINE,0,IPAGE,1,5,IOUT,10513)
TABHDG =' HSNG1'
LENG=7
DO I=1,NCOLS
IF(PRTCOL(I)) THEN
TABHDG=TABHDG(1:LENG) // HARG(I)(1:WWIDTH(I))
LENG=LENG+WWIDTH(I)
ENDIF
END DO
WRITE(IOUT,'(A)') TABHDG(1:LC(TABHDG))
WRITE(IOUT,'( 2X,135(1H-) )' )
DO I=IJ0,IKN
SEL(I)=.TRUE.
IF(SEL(I)) THEN
CALL PAGER(LINE,NLPAGE,IPAGE,1,5,IOUT,10513)
IF(REHEAD) THEN
WRITE(IOUT,'(A)') TABHDG(1:LC(TABHDG))
WRITE(IOUT,'( 6X,135(1H-) )' )
ENDIF
ENCODE(5, '(F5.0)',WARG(1)) SAVEWM(104,I)
ENCODE(7, '(F7.2)',WARG(2)) SAVEWM(43,I)
ENCODE(8, '(F8.2)',WARG(3)) SAVEWM(283,I)
ENCODE(11, '(F11.0)',WARG(4)) PPHM*SAVEWM(284,I)
ENCODE(9, '(F9.2)',WARG(5)) PPHM*SAVEWM(285,I)
ENCODE(9, '(F9.2)',WARG(6)) PPHM*SAVEWM(286,I)
ENCODE(9, '(F9.2)',WARG(7)) PPHM*SAVEWM(287,I)
ENCODE(9, '(F9.2)',WARG(8)) PPHM*SAVEWM(288,I)
ENCODE(9, '(F9.2)',WARG(9)) PPHM*SAVEWM(289,I)
ENCODE(9, '(F9.2)',WARG(10)) PPHM*SAVEWM(290,I)
ENCODE(9, '(F9.2)',WARG(11)) PPHM*SAVEWM(291,I)
ENCODE(9, '(F9.2)',WARG(12)) PPHM*SAVEWM(292,I)
ENCODE(9, '(F9.2)',WARG(13)) PPHM*SAVEWM(293,I)
ENCODE(9, '(F9.2)',WARG(14)) PPHM*SAVEWM(294,I)
ENCODE(9, '(F9.2)',WARG(15)) PPHM*SAVEWM(295,I)
LENG=7
TABROW=' '
DO J=1,NCOLS
IF(PRTCOL(J)) THEN
TABROW=TABROW(1:LENG) // WARG(J)(1:WWIDTH(J))
LENG=LENG+WWIDTH(J)
ENDIF
END DO
WRITE(IOUT,'(A)') TABROW(1:LENG)
ENDIF
END DO
FMTSET=.FALSE.
ENDIF
RETURN
END

Data File Produced by running the Generated Code (Left Column) Above (from inside a larger progam):

Z,TGV,TGC,TW,TS,TM
0.000,  195.485,    0.000,  175.602,    0.000,  189.380
0.200,  195.344,    0.000,  175.555,    0.000,  189.400
1.400,  194.517,    0.000,  175.284,    0.000,  189.520
2.600,  193.723,    0.000,  175.029,    0.000,  189.646
4.000,  192.839,    0.000,  174.750,    0.000,  189.800
5.200,  192.115,    0.000,  174.528,    0.000,  189.937
6.400,  191.422,    0.000,  174.321,    0.000,  190.079
7.800,  190.651,    0.000,  174.096,    0.000,  190.251
9.000,  189.697, 1573.402, 1015.520,  166.949,  187.999
10.200,  188.788, 1554.985,  997.460,  165.397,  186.195
11.600,  187.782, 1534.052,  977.477,  163.645,  184.710
12.800,  186.952, 1516.558,  960.736,  162.186,  183.486
14.000,  186.151, 1499.470,  944.159,  160.762,  182.306
15.400,  185.255, 1480.038,  925.046,  159.143,  180.981
16.600,  184.508, 1463.804,  908.841,  157.792,  179.888
18.000,  183.669, 1445.351,  890.148,  156.257,  178.662
19.200,  182.978, 1429.939,  874.304,  154.975,  177.649
20.400,  182.311, 1414.894,  859.474,  153.737,  176.671
21.800,  181.555, 1397.734,  844.261,  152.354,  175.568
23.000,  180.919, 1383.344,  831.382,  151.194,  174.653
24.200,  180.290, 1369.241,  818.649,  150.060,  173.765
25.600,  179.556, 1353.145,  803.978,  148.766,  172.762
26.800,  178.915, 1339.651,  791.561,  147.682,  171.930
28.000,  178.243, 1326.429,  779.614,  146.626,  171.121
29.400,  177.363, 1311.316,  766.857,  145.433,  170.205
30.600,  176.369, 1298.614,  755.759,  144.430,  168.571
31.800,  175.366, 1286.134,  744.662,  143.445,  166.668
33.200,  174.091, 1271.850,  731.706,  142.316,  164.094
34.400,  172.743, 1259.832,  720.283,  141.365,  160.764
35.800,  171.174, 1246.058,  707.015,  140.277,  156.165
37.000,  163.270, 1234.439,  694.667,  139.353,  148.721
38.200,  152.383, 1222.958,  681.834,  138.438,  140.002
39.600,  139.575, 1209.730,  667.321,  137.391,  129.971
40.800,  128.413, 1198.529,  654.902,  136.505,  121.486
42.000,  116.993, 1187.456,  642.390,  135.629,  113.109
43.400,  103.194, 1174.702,  627.677,  134.620,  103.474
44.600,   90.790, 1163.915,  614.966,  133.766,   95.336
45.800,   77.651, 1153.263,  602.166,  132.922,   87.312
47.200,   61.054, 1141.014,  586.904,  131.949,   78.099
48.400,   45.549, 1130.455,  575.147,  131.129,   70.323
50.333,   48.486,    0.000,   67.315,    0.000,   69.870
51.333,   50.405,    0.000,   67.398,    0.000,   69.888
52.333,   52.157,    0.000,   67.474,    0.000,   69.905
54.333,   55.211,    0.000,   67.608,    0.000,   69.937
55.333,   56.537,    0.000,   67.668,    0.000,   69.953
56.333,   57.745,    0.000,   67.724,    0.000,   69.968
57.333,   58.843,    0.000,   67.775,    0.000,   69.983
58.500,   60.000,    0.000,    0.000,    0.000,   70.000

Windows .bat file generated by the compiler

set cp1=jcommon-1.0.16.jar
set cp2=jfreechart-1.0.13.jar
javaw -cp ".;%cp1%;%cp2%;." LineChartDemo2 chart1.csv %chart1.png
javaw -cp ".;%cp1%;%cp2%;." LineChartDemo2 chart2.csv %chart2.png
javaw -cp ".;%cp1%;%cp2%;." LineChartDemo2 chart3.csv %chart3.png

One of the Charts Generated Automatically by the .bat file Above. This chart can be directed to paper and/or to a Monitor(Real Time):