18
lA-5410-MS INFORMAL REPORT ANSIFT: An ANSI Standard FORTRAN Sifting Program scientific laboratory of the University of California LOS ALAMOS, NEW MexICO 87544 , \ U:tITEtI STATES ATOMIC ENERGY COMMISSION CONTRACT W-70101-I!NG. 36 MASTER DiSTRIBUTiON Of THIS DOCUMtNT IS UNLlM, I <-..;

REPORT ANSIFT an ANSI Standard Fortran Sifting Program

Embed Size (px)

DESCRIPTION

Program to analyze Fortran programs

Citation preview

~'~"~~·l-'~··--- ~--' ,---:-,,-,~-,-,:---,-.--,,-.;:--,.,:,,-,:'.-:,.

lA-5410-MS INFORMAL REPORT

ANSIFT:

An ANSI Standard FORTRAN Sifting Program

scientific laboratory of the University of California

LOS ALAMOS, NEW MexICO 87544 , \

U:tITEtI STATES ATOMIC ENERGY COMMISSION

CONTRACT W-70101-I!NG. 36

MASTER DiSTRIBUTiON Of THIS DOCUMtNT IS UNLlM, I <-..;

This rtpCWt was PffPll'td IS oIft ICCOUnt 0' work spons!)tid by the Unitld SWts Go¥aNII.,t. Ntir'Mr tht Unirtd SUtts new the United sr. ... Atbmie E'*IY Commblion. new InV of their employ ... ~ .ny of their centrIC­tars. IUbc:ontractors. or theif" tmpIoyen. mlkllltlV \fIIIIffMtv. ppr:tllor im­plied. or _me Ifty rlgllf U.bility '" responsibility for the KCUtKy. com· ..,..,.. or U1IfvIMSl of IIIV' inforrnltion. appIr.tus. IWoduct GI ~ dis· cao.cl. or ,... ... r. d\at its uti would nat infringl priY.IIIV owned fifib.

In tile in1lren of prompt distribution. thll LAMS flo

part WH not editld by the TKhniclI Inforrnltion stiff.

Printed In the UnitlCl SUM ca' America. AVltIIb4t fram NlUoniI TlChrllclllnformlllon .wva

U. S. DlcllfttMftt of Commttct I2IS Part Roy" 1i'0Id

s,rlngfitkf. Vlrtlnil 22151 Price: "'ntld Copy SUO; M IcrofJmt 10.85

los alamos scl.ntUlc I.bo· •• tor"

.f th. Utti".r.1e, .f (.ti'.,nt. tOS AU~H;O$. tUW MtlllC.O ,'SU,

J \ I \

ANSIFT:

LA·S410·MS InfCfnut Rtport UC·32

I.SSUeo: OC:lObtr t913

An ANSI Standard FORTRAN Sifting Program

by

Clarice W. Cox

This work supported by the US Atomic Energy C.ommission's Dillision of Rcae~or Research and Devl!lopment (Reactor Physics Branch) .

..-----·-NO 71(1-----_ T1IIA ,.,1111 "'lO' r,.".,d II an ",coun' or war" Sf>OlI$IIttd b) .h" \11111,11 Sill" Gon,nm.n,. N.lltoor 1"- Unl1t4 SliltS nut I"" Unll.d SI.III Alollile En.,., Comrninkln. no •• n~ of Ihol. emplDy •••• not tn, of Ihlr CdnnACfGA. oubtoncrac'<IIl, Of Ih,1r ,mploy_. _h •• n~ ..-urlnly. Ul"'~'" Implied .... UliU_ .... , .... IlabUl', 01 ".sponllbilil, fOl lh' accUlIC" com· "' ... n.p o. uNfl~MU of Inr Informlnon, apP.,.,ul. ,..ootll<l 0' ",oce .. dllclotH. 0' ,"pIC .. n .. thai III 11M "'OlIId nOlln',I",. ",lra,e1y own.d ,l&tIlI.

.~' ,

ANSlfT: An ANSI Standard mTIAN Sifdn& PI:0lr ..

Cladee U. Cox

AMSU'T looks for GIll eMftI •• or n.,1 e_n noultaMareS v.3IS. ~ft CDC fOJfIAH .o~re. dsckl. The prolraa it.~lf I. written in al:IlD lard FOrTIWl to uke It !:lOre &ltaptsbl. for v •• ' on other 1l:000pii' 41':1.

I. lIn'IODUCTIOtt M51" (frOll !Urican !aUonal !taMard. 1n­

uUvle P,lIAII) _In.s Gurc. decks lhat 11:& coaa­

pUule 0= either !:he CDC 6600 or 1600 cotlplllera for

SOIII C_1l ftGuundard u ... ,... It cea datlct. ed

IOItItW.I conlet, the 1.1.,..1. Uat~ belovo Thue DOutsallcd uu .... htndc.r !:he &d.pta~ion of CDC FOR­

'IIAH cod .. to ot~cr aI.puter ••

1. Han.tlndsrd c!:oanctln (e.s •• =). 2. Blank card .. , 3. Nanet.ndsrd input/output ItAte .. nta (e.,.,

PAm).

4. U •• ot unaublcrlpted .I:ray naa.a or t.plied

DO-1cop notationa 1n DATA initialiaation Itat ... nt., 5. Uaap.c1fled ~ep .. t co~nt or .isllna field

a.par~tor. in FORMAT Itat .. ent.,

6. ENC(I)E Itat .. nt •• 1. Two-brancb 101ic~ IF Itat ... nta. 8. St.ple aflted.-.ode nl.tional exprel.lon in

10lical IF atlt .. lDta. 9. Calla to .Ylt .. lubroutine ••

10. S.veD-cMrecter variable _.,

11. HOllerith replac .. er.t atat ... nta (e.I.,

variable. DB ••• or variable· aL ••• ), and

12. 111.,1.1 lub.cript expr.laionl (e., ••

V (2*.1+1» •

FORTRAN il a prolr ... iDI lanauall ca..only u.ed

in tb. c'!!llputatlon of acientUie r .... rch prohl..,..

In principle, any FORTRAN code ahculd be readable by

my COCput1ll1' capable of cOlllpUina PO!TItAN. But 1n

fact. it u.lllll1 canaot becau.e local d1alect. which are inca.patiol. vith each other have b •• n dev~loped

for each computer. Consequently, a cr.de written in

CDC fORTM!1 ta r'-"t u'Wllly compUa'b1e on an 111'1-360

computer. and vic~ veraa. Indeed, 1t i. Just tho.e feature. which take a~v.ntsle of a co.puter's unique

caplb11ities tha: can :ake a code tapaa.ible to run

DO • different cOlllpu:ur. \lhen II code has been producad that 1. 0.£ enoulh

seneral 1ntere.: for an cut.tde inltallation to vant

to 1apart it, the Impolter can be faced ~1tb a tt.e

conauains tran.lation problea. Thi. probl .. 1&

Ire.tly d1llllni.bed if the code bdne exported II .. bun wrSttan in ANSI Standard PORTRAN. l Thi. lea.­

suase i. a aubl.t of FORTRA.~ IV that ia ca..on to the

different major co.put.r.. Witb .. fev except~ona,

thi. atandard FORTRAN .. y be called the interaection of the varloua FORTRAN JV dialectl.

ANSIPT va. wr1tten to help tbe exporter of CDC­

FORTRAN code. to .taodardt:e the language u •• d and

thua ea •• tha tran.l~tion problea. Ftr.t. a workins coda vaa ex .. ined to find out vh.t kind. of nonatand­

ard uaasaa it containld. Next. a control prolram va. writtan tMt call. apec1al subroutine. to &:heck for each kind of u..... Finally, the apec1&l .ub­

routin •• vere written and incorporated iDto the code.

If a DW DOn.taodud Uu&~ S. to be adeled to the

1

lut. a .pecul aubl'out!z1e to check for that uu,e

CaD ... U,. b. acldecl.

A5S1PT w •• itself witteD m ANSI Staadard

FORTIWI to IIIIke it aportable. It ba. checkecl it­

... 1£ .. vall •••• v.Ed l.rS8 source prosr.... The

t .. t prolr.. iD the ."eadtx 111uatratea lta

CApJlbUiti ...

c-.nt 1:f.n ... uncban&ed .tatIllllGu. and EN!) lille.

of the orts:l.na1 dack in thei~ original orliel'. The

fl... wUl also be written on this ftla beyond

colUllD 80 of the card _ge.

The liated output (FSET2) from th:Ls atase will

conaiat. &II 1n tbe firut stale. of headl1nea of each

pt:osru ullit followed by error lIIe8l1asea. At the eDd

of tha .econd stale. the final pr11lt veraioD (FSBT4).

II. USAGE iDcludiDl flaS., ia copied onto the output flle.

Four fU .. are Wled - cwo _aid!!!! t~ ~~ r/o. '!'hell the ao-colu;m ur~ 1iiai0i8. wJ.l.uoui; £laS8. are

copied onto the fiDal version punch file (FSRT3).

Fila Hue

FSEfl

FSB1'2

FSB"t3

FSBT4

neapt::l.ptton· .

Input fUe. Con:o:bul the source deck to be cocked followed by a terab!&l carel.

OI&tpuc file. Contaiaa enol' _.uSo followed b)' a lUt1Ds of I'SET4.

1'!aa1 veraioll pUllch file. CoDtaiDa car~ ..... nady for pUDch1na. Early ill thll pn~ .. it is alao uaed ... acratch fUs.

FiIla1 v.raioD pdllt file. Contollla cbaapcS card iIIq... if challiS. vere 1184s ... vell a •• pproprisee flas. be­yond co11lllD 81).

To use ANSII"l', the .ource deck to be checked

must fir.t be .et up with a term1aal card (a card

coDtaialDl tbe letter T in column 1) followiDl it.

laiC carel. Thil eleck should 11. ava11llble to ANSIPT

Oil tbe tslput fi1e(FGBrl). ANSIPT will DOt chllllga

the order of liD.. &Il4 otatemeDts ill the 80urce deck.

Bow."er. it 1liiY delete or iUllert lome I1ne8. so the

aize of the output '1.aioll of the aource deck lIIIly

elUfer froll that of the input ver.ioD.

Ther •• re two .tase. of proce.a1DB. In the

fir.t .t.,e, the :lDp,~" i:l.la (psm) containill8 the

lOuree daek ia checked 11De b,. 1!z1e. The acceptecJ

linea .re writt.n on a .cratch file (PSET3). Proar ..

ullit budli1lea a,'8 written on the output flle (PSET2)

too aid in 10catiDa erl'ol'a. Errol' ..... 'e •• re then

writta OD the output file follovill8 tbe haacl11ne of

the ~out1lle iD which they vere d.tectecJ.

In the eec01l4 ata,e. the .c~atch fUe i. read

and at.t_UCa ara formed. Each statement i. checked

for 1M>UlltaDd.rd u",e.. Whera possible. a DIIutand­

arel atat_ant 18 chaqed to lUke lt standard. Where

1t caanot be chaDlecJ. the .tat_ent is fl.lled. The

f:l.Dal v •• too of the atat_t wUl be writt.n onto

a priDt f".1. (PSBr4). Thia file will coD<:ain. ill

aclel:lt101l to the corrected .tat ... llt.. all of ths

2

III. PB.OGRAM IIESCRIPTION

Tva k1Dde of proil'8111 unite make up tbe ANSUT

coclei a,ecial purpoae routines and senera! purpole

routinel. The .pacial purpoae routiDea ar" coDcerned

witb a particular job or certain k1Dd of statement.

Por ezample. l'!ITCIIK will oal,. check atatementa besin­

Il:f.na with the latter. FORHAT. Theae routin.. are

called by oaly ODe other rout:IDe.

The gener~ purpoae routinu work with a atat_

II8Ilt 1IIage arrayal' a aectioD of the arra,. and are

DIIt li111ted to • particular k1Dd of .tatement.

NllBtNlC. for _pia, searchea a portion of the array

for a DDnblaak cherecter. When 1t is foWlll. lQIBCBJl

fa sllGletiJaea called to tell what !dad of IlAllblaDk

character it 18. Tbeae routinu .re freely callad

by other routiD ...

WltbiG each of th ... evo c.tegorlo, there ia

a hf.er.rchy of coDtrol. Y.INORD and SDlTCK .re major

.pacial pu-rpo.e coDtrol routinea called by ANSIFT.

the .. in pro,r_. LGLSBS is a _jor general purpose

COIltrol routme. Theae chalU11 of cOlllll8Dd are illus­

trated in the flow chart (pi,. 1)

In the f:l-rat .tasa of the P-rocua:llll. ANSIFl"

checks FOR'l'RAH lin... There .re four .tenderd ldada

of linea.

1. Inltial l:f.ne. Has only a Itatement labal

or blaaka ill colU11D8 1-5, baa blank or zero In colUIDD

6, and 1a DOt an u,1) 11ne. ANS:iFT requlr..a • noD­

bleak charact.r .o.ewhare 1a columna 7-72.

2. Continu.tion I1ne. Ba. a character othGr

than letter C :ID colu.n 1 and a character other than

blink or zero in colUlllD 6. ANSIPT rllqulr.. blaaka

in colUIIIIs 1-5.

3. CO_eDt l:f.n.. Has letter C :l.D colllllll 1.

4. DID 1111.. Ba. blaDka 111 colwms 1-6 aad

the lettara DID .pp .. r1n1 once each and Jon that oreler

ANSIFT Routines DATACI( ellpansion

IFCHK expansion

~I----I

is !!:

!BLOCK DAT~

Fig. 1. Slmplifled flow diagram for ANSIFT code.

1

FMTCHIC Expansion HOLRPL El<pansiOl

4

in columna 7-72. All the r •• t of tha columna are blank.

LINORD calla LINTYP to c1anify each U.na in the

&ourc. deck. If tha line ia completely blaak or 18 blank except for a zero in column 6. LINORD will de­

lete the line and call ERRMSG to write the error mes­

sage, "Blank line delated". If :ile line is unrecog­

nizable it viII also be deleted with an er~or message

written. All of the acce~ted lines are counted and

written onto a scratch file. NFl (FSET3). The ter­

minal line (with letter T in column 1) signals the

end of input. It will not be transferred to NFl.

If the line prec.cing the terminal line h DOt an

mm line, Ln,OlIJ) will inaert an END line and count

it. LINTYP will substitute a + for = in column 6 of a continuation line.

In sddition to checking the type of line, LLNORD

checks U lines are in the right order. If an END

line is followed by any kind of line other than an

initial or terminal line, the linEI will be deleted

aZJd an eI"ror message written. ilxcessive (more tt.:an

19 consecutive) continuation lines ~l be deleted.

If a cOlltinuation line follows a comment line it vUl

not be deleted but an error message will be written.

In the second stsge of processing. NFl is rewound

and read, one line at a time. ColmDent line9 acd END

lines are transferred to the final versicn print f11e.

NF2 (PSET4) J w1thout flags or changes. II. Single in­

itial line. or an 1n1i:ial line followed by up to 19

continuation lines. is read into a statement image

array for processing. STMTCK examines this array to

determine what kind of statement it is and thea calls

an appropriate routine to inspect it further.

Starting Characters

PRINT or REAl)

DATA

FORHAT

ENCODE

IP

CALL

Non. of Lhe above

Routine Called

IOCHK

DATACK

FHTCHK

ENCD:CK

IFCHK

SYSUB

HOLRP7..

In this atage a statement may be flagged or changed.

SJIII8times, the change requires the insertion of extra contin_tion linu or a new stataent. There are

four kinds of statements in which nonstandard usages

well be changed, DATA, FORHAT, two-branch logical IF,

and Hollerith replacement stataMnt8. In a DATA

.tatlllmlt. 1£ the list of <:onstanta contains a

Hollerith constmlt of the form nL •••• the letter

H will replace the letter L, resulting in DB .•. In a FORHAT scatement, a comma will be inserted

if it was omitted following either a Hollerith or

apacing (aX) sp8c1ficat10n, while a comma preceding

o~ followiQg a slash will be deleted. An 8sterisk­

encl03ed Hollerith specification will be replaced

by an DR ... specification. A parenthetical group

with"ut e repeat count ~"ill be changed in Oile of

two ways. If the group is followed by a format

specification, the number 1 is inserted as a rl~peat

count. If the group terminates the FORMAT state­

ment. the number 60000 is inserted as a repeat counc

and a sln~b i8 inserted before the group·s final

dght parenthesis. A two-branch logical If such

as IF ( ••• } nl ,n2 will be changed to the two

statements

IF ( ••• ) GOTO ~

COTO n2

A Holler~th replacement statement of the form

var~able - DR .•• or variable - tiL •••

will be replaced by the two statements

DATA dummy I DB ••• I

variable ~ dummy

The dummy name is either IIIIdd (for integer type)

or HHBHdd (for real type) where d is a decimal

digit.

With the exception of che unlimited repeat count

correction in a FORMAT statement, DOne of these

changes will be explained in an error message. How­

ever, the final version of the statement will be

flagged "CHANGED" or "INSERTED".

The flags, which are written on NF2 along with

the first line of the final statement but beyond

column 80, point out whether it is "NOT ANSI",

"INCOMPLETE", "POSSIBLY NOT ANSI", "CHANGED", or

"INSERTED". The headline of each routine is identi­

fied by the flag "NEW PROC". If the statement passes

all the tests it is written on NF2 without flags.

All of the statement-checking routines write

explanatory error messages on the output file if a

nonstandard usage is detected. If an unspecified

repeat count is detected in a FORMAT statement. the

statement will be changed on NF2 and the changes

will be described on the output file. All of the

5

error mesaages start by :1dentifyiDg the line or

statement in which the error was detected. The rest

of the messsge tells what was wrong. The possible

explanatlol18 are listed in Table I. along with the

names of the routines calling for ther .•

At the end of the second stage, the final ver­

sion print flle, NF2. is vritten on the output f11e.

NFl is rewound and the finsl version SO-column card

images are written on it.

All of the routines in ANSIFT are listed and

described in Table II.

TABLE I

ERROR EXPLANATIONS AND DETECTING ROUTINES

Error Messase ___ Ro=u.:;tin=e=--__ _

Only an initial line is ac-ceptable here. Illegal line cieleted. LINOD

Unrecogniz~ble line deleted. LINOBD

Continuation line illegal here. LINOBD

Blank line deleted. LINOBD

Missing END line il18erted. LINOBD

Incomplete statement. IOCBK. LIS'lV. LISTC.

Seven-character varisble

PMTCBK. SQUASH. ENCDCK. IFCBK. and IVAReK

name. IV ARCK and HOLRPL

Non-standard I/O statement. IOCBK

Illegal character or 11legal use' of this character... DATACK. LISle. and

HOLRPL

The llWIIber of real or integer variables found in Hollerith revlacement statements ex-ceeds 99. BOLlIX

Non-standard Hollerith re-placement or assigmuent SU.teDIeDt. (with an It. specification). BOLFIX

An unrecognizable IF state-ment form. IFCIIK

Error Message Routine

Contains an implied DO-loop, an array name, or a Hollerith colIStant with an It. Specifi-cation. DATAClC

A non-ANSI DATA initiali-zation statm..;.at. DATAClC

No available correction space -- DOR-ANSI asterisk (*) specification. STAR

No available correction space -- missing field separator. PLDSEP

No available correction space -- UDlimited repeat count. F.MTCHK

A two-branch logical IF statement.' IFCBK

Illegal subscript expression. HOLRPL

A DOn-A.lfSI simple mixed mode expression. IFCHK

lias a call to a system sub-routine. SYSDB

Illegal instruction. INCDCK

The preceding bas either a DOn-standard 0, or non-standard R specification. F.MTCBK

The preceding uses an unlim-ited repeat count ••• and is corrected as shown above. fMTCHK

May not boa an ANSI IF. IVABCK

TABLE II

DESCRIPTION OF PROGRAM UNITS IN ANSIFT CODE

...!!!!!!L. Description

Routines in this section are special pur­pose control or checkiDg routines.

ANSIFT The _in routine. Controls overall flow of sifting process. Calls LINOR» to check lines and STM7CK to check statements. Writea FSETs 2. 3. and 4. Reads FSETs 3 and 4.

6

~ Description

LINORD Called by ANSIFT to check the type and order of FORTRAN lines for deviations from ANSI stBtidards. May insert or delete lines. Calls LDITYP and ERRMSG. Reads FSEX 1 and writes FSETs 2 and 3.

TABLE II (cont.)

Name Description

LINTYP Checks a single line according to ANSI standards and assigns a type number to it. May change a continuation line. Called by LINORD and calls COMPAR.

STMTCK Called by ANSIFT to check a complete st&te­ment for deviations from ANSI standards. Calls COMPAR to classify the atatement and calls IOCHK, DATACK. FMTCHK. ENCDCK, IFCHK, SYSUB, or HOLRPL to check it. Also calls NNBLNK.

IOCHK Called by STMTCK following detection of the word PRINT or READ to determine if the statement is a PRINT or nonstandard READ statement. Calls NNBLNK, JDIGIT, and ERRMSG.

DATACK Called by STMTCK folluwing detection of the word DATA to determine if the statement is a standard DATA initialization statement. May change a statement to make it standard. Calls LISTV, LISTC, ERRMSG, and NNBLNK.

LISTV Called by DATACK to examine DATA statement list of variables for nonstandard usages such as implied DO-loop. Calls NNBLNK. JD IG IT, and ERRMSG.

LISTC Called by DATACK to examine DATA statement list of constants for nonstandard usages such as Hollerith constants specified by DR or nL. Calls NNBLNK, JDIGIT, and ERRMSG.

FMTCHK Called by STMTCK following detection of the word FORMAT to determiue if the state-ment is a standard FORMAT statement. May change a statement to make it standard. Calls LGLSBS, NNBLNK. SQUASH, JDIGIT, ERRMSG, STAR. FLDSEP. and URC.

SQUASH Called by FMTCHK to eliminate unnecessary blanks from a FORMAT statement. Calls KNBCHR, JDIGIT, and ERRMSG.

STAR Called by FMTCHK to change asterisk-enclosed Hollerith messages to the standard nH •.. specification. Calls SP"'CHK, DGTSTR, and ERRMSG.

FLDSEP Called by FMTCHK to insert a comma follow­ing nH ••• or nX specifications. Calls SPACRK and ERRMSG.

URC Called by FMTCHK to correct unspecified re­peat count. Calls NNBLNK and SPACHK.

ENCDCK Called by STMTCK follOWing detection of the word ENCODE to determine if the statement is an ENCODE statement. Calls NNBLNK and ERRMSG.

IFCHK Called by STMTCK following detection of the word IF to determine if the statement is a two-branch logical IF or if it contains a simple mixed-mode relational expression. May change a statement to make it standard. Calls NNBLNK, JDIGIT, DG'!'STR, ERRMSG, IVARCK. IllliLOP. and KTYPE.

IVARCK Called by IFCHK to locate a variable name. Calla LANSTR, LGLSBS. NNBLNK, and ERRMSG.

Name Description

IRELOP Called by IFCHK to locate a relational operator. Calls NNBLNK.

KTYPE Called by IFCHK to locate a constant and identify its type. Calls NNBLNK and JDIGIT.

SYSbB Called by STMTCK following detection of the word CALL to determine if the state­ment is a call to a system subroutine. Calls COMPAR and ERRMSG.

HOLRPL Called by STMTCK to check a statement not already classified as a nonstandard I/O, DATA FORMAT, ENCODE, IF or system subroutine CALL statement. It checks for a seven-character variable name, ill­egal subscripts, and whether the statement is a Hollerith replacement statement. May change a statement to make it standard. Calls LANSTR, LGLSBS, NNBLNK, KNBCHR, COMPAR, JDIGIT, ERRMSG, and HOLFIX.

HOLFIX Called by HOLRPL to correct Hollerith replacement statements. Calls ~~SG.

Routines in the following section are general purpose control or service routines.

SPACHK Shifts the remaining portion of a given array to the right to make room for cor­rections. Called by STAR, FLDSEP, and URC.

DGTSTR Encodes an integer and stores it in an array with elements in IH .•• format. Called by S~AR and IFCRK.

LGLSBS Checks whetber a given array contains a standard subscript. Called by FMTCHK, IVARCK, and HOLRPL and calls LGLSSX.

LGLSSX Called by LGLSBS to check whether a given array contdins a standard subscript ex­pression. Calls JDIGIT and LANSTR.

LANSTR Checks whether a given array contains an alphanumeric character string beginning with a letter. Called by IVARCK, HOLRPL, and LGLSSX and calls NNBLNK and KNBCHR.

JDIGIT Checks whether a given array contains a digit string. Called by IOCHK, LISTV, LISTC, FMTCHK, SQUASH, IFCHK, KTYPE, HOI~L, end LGLSSX. Calls NNBLNK and KNBCHR.

KNBCHR Tells which of five kinds of characters a given nonblank character is. Called by SQUAS~, HOLRPL, LANSTR, and JDIGIT.

COMPAR Checks whether a given array contains a FORTRAN keyword. Called by LINTYF, STMTCK, SYSUB, and HOLRPL and calls NNBLNK.

NNBLNK Checks whether a given array contains a nonblank character. Called uy several routines.

ERRMSG Writes an error message on the output file. Called by several routines.

BLOCK DATA Sets initial values of variabl~s in label­ed COMMON blocks.

7

·1

8

IV. REFERENCES

1. American National Standard FORTRAN, USAS Xl.9-1966, American National Standards Institute

(1966) •

FJlCGRAM T ES TC IIIP, OUT I IMPLICIT INTEGER (A-XI C(MMCN e,IF ClfoIENSICN IFIS)

APPENDIX

ANSIFT TEST PROGRAM

'!!~Q.'!

ClfoIENSICN A(101.GOTO (l,ltl). FOJ\IolATlI,Z,3>.G010l1lZ,Z) ,SilO) , C ItCllE T a COME

1:1101,(13) 1f1l!.E'.Ol GOlD 50 ENC[eEI 20, ZO, A) ~

28 fO~MAT(13Rl,Z~ 4X*~OLLERIT~ FlfLO.) zq FORMAT I * THIS AN INCORRECT OlllE*OZOI 161 FORMATIZ5X25X3H. I ZOll611 5 J FOIIMAT 13, 2,1 )=6

GOT 0 (20,30,40. 50), 1 <' 0 G or 0 I Z!), 30 , 40. 50 I I 30 GOT 0 11,2,3)= I 40 IF(2-EC-2) = K

JFI2.~E.ZI 20,24 IFIZ+2 •• NE.OI Z55,20

23 IFfTWC.EC.2) GOTO 130.401 J C4LL SECCNOIGLORP) CALL T IIo1ERe /lRGJMNl ) CALL ClCK C~LL eUFOPENIMORE) CALL CLCCKILESS)

24 GQTO(t+JI=t+J GOTO 12+JI=I+J I F I F R , NT I 5. /I R G. I + 3. 4 I .... E .0 I 40. 50

3 GOTOIT 11+2. K*31=PRINTl5.ARG. [*)+J.11 1 FORHATI15H*U**TEST ITI

C AT A e 12 I, B I 3), BI 4111. 2. 31 C C TI"IESE /IRE THE FIRST NODES ••• C

,e ( r; It ec 6 It C 18. q. 4. tl +

C T ... 6TS ALL

1 C

+

[0 Z W .. CM= 1

1:0 4 WH~M= 1.10.2 (0 1 f.'(RE=b.K,"I COII.T I fl<U E THIS IS A COM~ENT

4 COII.TINUE 2 CALL S EGM ENH GL QRP 2 I

999

255

c

1<l2=9L3+J= ! .KL KL2=lOt- ... S = I CQ1=2P • ClTA C/Z5H ClT.II (C")'1=4,611 3u ........ , IFIiNTGRTF.GT.Z.57b) STOP IFIINlGAT-O.23.Ge.O.6) RETUflo,( IfI"TGRl( AI )=5 IFIlI= INTGAL" GOTO 255

I C(NTINUE

He

C HPE IS Tfo'E REST OF TI-'E LAST CjMMEIIIT C

SU ('PCUT IIIIE GCTO (A. 8. C. C, IF (SUfI..LT .AR IT E) 255,250 TEST2=3HTOl H EST=4HT!H e

25:1 flHURII. ?5S STCF T

PlfC:GA",.. TEsrIINP,CUT)

••••• ER~OR FCUII.O 1111--.. • •

1:11:1),(131

••••• CC~Tl~UATI(~ LINE ILLEGAL t-ERf •

• **.*ER~CJ Fru"c IN-­• • • ••• **elJ!!I;1I tll\!E [ElET Er..

* "'* •• EA ~Otl Feu" C I f\-­

* '" ,BI5J,EloJ.C 18.9.4,61

'" ****.CCr4TIM';ATlON lIt.:E ILLEGAL HRE.

* * I * .* •• *UN~EcrGNrLHLE UI\e CHECTED •

• ****ERFOR FC:U"C IN-­

*

QJ!!!'!!'!

,

9

• • fl

••••• 'Ol'f't."'ATtON UI'i'€ ILLEGAL HAt: •

••• "!;R IOn., Feu'" I PI--• • • ••••• VL t~1I U toE on ET eo •

••••• eR~O~ ftu~c ,N-· • -, <ttAf: IS h·e liES l' OF r ~e lAS' cOM"e~l .. ..... ~lY AN ,t.nUl LINE IS ACCfItUf'.U "EAE. Il.lfi5AL LI~e DEtEtfEO.

""'f~~O~ FCu~O t"-­• -c • ..... O,.t't hN l"Hb'l LI"iE ts ACCtPfAet.E .. eltE. JlUGU lIN~ OEtECfE:O •

••••• eK~c~ FeU'" ft.-­• -r • ...... ·I!.SING E:I\C ut.f. INSERHC.

10

• .• - t·.

FASS C~E SJM~ARt

9 ERRORtSI "EIECTeO

• -.-+-.

2 ILLeCAL LI~EIS' OEL~'ED 1 V~IIECOC;"IZIIPLE LI~EISt DELEtED 3 ILL EGAL CO'U '",uU l:l~ LI n c s. 2 eLANM. L INfl 51 OflHFO 1 J MISS I'IIG e~:: ll!fe ''4Se:c teo

e- ••• _. .. ...- .....

• .• -.-e

.-.-.-.

S JUE IE NT liS rt PoG

P~Cr.lU~ TeSJ(INP.OH I

••••• eR~cA fCU~r !~-­

• .IFfB.Eq.OI COTO 50

• ..... ,. NQH-tt.iSI S tlolFLE "'IXEC MotE EXPRESS \0,. •

••••• ER~CR fCV~O I~-­

• .ENr;CCf flO.?) fA' It • ••••• I L lEGA l it.S HueT I eN •

••• ·.ERPCP fCU~D IN L!~E

• • POS IT mN 10 • ''11 THE FOLLO ... NG SfA 1E "ErH--

.fOP~ATll9RI.1H 4X.HCLLER'T~ FlfLO.'

• ..... THE S:IHCEO'~C .. liS EITHER A NO~-STA~OARD O. lR I/O..,-STANOARD R SPECIFJCATlO~

••• ·.ERFCR fCU~[ l~ LINE 1. POSI1I:JN )jj ,1'"4 THE FOLLO.,1IlG STA,e/llENT--

• .fOIl",,,\: I22H T~tS tt. I~CCRReCT ~~E.020 I • ••••• iHt: ~RetEr.I~( .. AS EITHER A t.,JC~-5TANDARD :1. :lR \fOIll-STANDARD It speCIFICATlCPo •

••••• eR~cA FCUhC It. Lt~E

• .FOA~AT nsx~sX.l~ •• t20A611 •

• P051T101\I 22 • ''4 T ... E FOllO"'NG SJAle .. ENT--

• 'H £ FRECEC J f\( US ES ,,~ UNL 1M IT EC REPEAT COUNT--• .fOP"" C2SX.2SX.3~ •• 6000012066/11

• ••••• ANt IS C(APECTEC AS SHOWN ARnIfE •

••••• ER~CP fr.Uhr. IN-­• .GOlC ClQ,lO.40"OJ I

• ••••• ILlEGAl 5UES(PIPl EXPRESS InN •

••• •• ER IiC P Feur.. D I ~-­

• • IF 12 -E 8-2 I z IC .. ..... ILlEGAl SUESCItIPT EKPRES5 ION •

••••• eR~CA FCLr..[ IN-­.. • ,F nIoO.E'.21 GOO n~.40) J

• ••••• A NON-lNSI SI~PLE ~IKEt "ore EXPRESSION •

••••• FR~(~ Fr.u~C 1~-­

• .CAlL StCC~CCGLORPI • ••••• IIAS " CALL TO " SYSTEM S.J8RnuT INE.

11

..... ~R~CP FCU~C I~-­

• .CAll ElLFOPEt\lflOIlEt • ••••• HAS A CALL TO A SYSTEM SU8ROUT INE •

••••• ER~CIl FCUI\t If\-­

• *CA lL ClCC~ (lESS I

• ..... HAS A CALL rr " SYSTEM SUBRoUT INE •

..... ER~CIl FOU~t 1"-­• .GoTO 11+ J1-1 +J • ..... lllEGAl SUeSCRIPT EXPRESSION •

..... fRIICP FCU~C I~-­

• .GOTO 12+ 0 =J +J

• ••••• lLlEGAl SUeSCAIPT EXPRESSION •

..... ER~CIl FCUf\[ IN-­

• .GOTOn II +2 ,K.3)= FAINT 15, ARG. I.~+J, 11

• ..... lllEGAl SUfSCAIPT EXPRESSION •

••••• ERPCII FCUNC I~-­

• .FORflAT Cl5H .... HEST IT I

• ..... 1 NCCfoPlETE ST ATE"'ENT •

••••• ER~CR FCU~[ I~-­

• .00 2 IoIHOIt= 1

• ..... SE"E~ (HAIUCTER VARIABLE NAME •

••••• ERPCR FCU"O 1"-­

• .CA II S EG ME t4f (G l O~P2)

• ••••• HAS A CALL TO A SYSTEM SUBROUTINE.

••••• ER~C~ FCUf\[ If\ LI~E

* .CQl=2R •

1 , POS IT ION to , I~~ THE FOLLO"IN:; STA1EflENT--

••••• ,.ON-ST ~f\OAF[ HOLLERITH REPLACEMENT OR ASSJG"'14E~T STA Te"ENT--"lltl at. R SPEClflCATIO~ •

••••• ER~C~ FCU~O IN-­

• .OATA OI2'iH

• I

••••• COH~IHS liN I"PlIEC DO-LOOP, At,! ARRAV ",""'e, OR A HOLLERllH CONS'Af\T \11TH A~ II

SPEC IF IC IT 10".

12

••••• FM~rp FrU~r I~-­.. • ..... COHH!r.S AN ,flPLIfC CO-LOIlP, .~ ARRAY ,..I1E, DIl .. HElLLEAIIH CONS'AU .. IIH IN II

••••• £R~C~ fCU~O I~-­• -If If HJGATf.Gi.l.'i76J SHiP • ••••• SE"l:N (tUR,nEIl VARIABLE ~AMe •

••••• EA"r .. Fr.U~[ 11'.-·

-.IF 11 "HRJf.r.T.l.SU>I STOP

• •••••• NC~t~SI SlflFLE ~lKEC MOtE EXPRESSI~~ •

••• ·.E~~C~ FCU~( I~-­

• *If Ci HT(iRT·~.2).GE.O.bJ Ref URN

• ••• uu Y ".r: r fiE /lit .NS I IF

••••• EM~C~ fCU~[ IN-­

• .IF It. fG !iLIA II =S • ••••• ,LlEGAl sueSCRIPT EXPRESSION.

SlllflCl,;fl~t (Off ,~,e.C.DI

tolFILF lISTtt.c

P~CGA'fI TEsrll~p,cur' UIPllC1f I f>.rECEA I ~-)( I COMMC~ ~.IF OlflHI:Sl(f>. IfISI

SPEClF lUi 10"' •

........ Nl:W ~~o::

f>.CT us I

OJPo'lfl.SI(N .!1101.GOTO 11,1.11. fOR"'ATll.2.~,.(jJTOITl2.21.eIlOI. C "OAE r 0 (( NF.

0111>1 .C n 1 IFle.fe.O) COTO 50 E Nt 01' EllO ,20 • ~) ~

28 FOAfoATll\)Pl.2 ... t4IC. 1St-HOLLER iTH flELOI 29 fOR"U!22t- ft-IS ~N INCO~ReCT O~E.020' 161 FORfoATI2SIC.l5X,3t- •• 60000C 2046111 50 FORfo4T1J.2.1I=f>

GOfO 120.30,40.50), r 20 G I)T 0 12 a • 30 ,40.50) I 3 a GOT 0 n.2. 31:: I 40 I f (2· E c: -2 I = k

IH?""'.21 COTC 20 G OTO 24 It' 1/+2 •• f>.f.u) GeTC 2'51'5 GOlD 20

23 HITWO.EQ.ll CCTC 13(1.401 J

~CT If\S I /lCf tl'\S r r.CT ll'\S I f>.OT ll'\S I f>.cr U,S I

f>.CT '1\5 I

IIeT If\S I CHANGED

CI-'ANGED

CHA:'oJCEO C"~NGEO C~IIN GEO

IIISEItTED

I"lSERTED

13

3 7

c

e'LL 5eCQ~D'GLG~P' C~Ll TlMEIII.IlGU ..... r~ "Ll (L tJtC CAll l'UFOFEf4."OAEt tnl ClOClCCLESS J GOTO IItJ'"",tJ G oro ChU= HJ ItlFRI~r'5,AA~,lt3.~t.~E.Ot GDTO ~o r. or 0 so GOTOI Trlt2 ,!CO'.PAINT.!t. ARG ••• :HJ. l' FOR"'''' lS., ..... TEsr IT, OAT. EI2' ,fin. e'ItJl1. Z, 11

C THESE AfiE r ... e FIRST ~OOES ••• C

C t

THATS ALL

+

DO 2 IIHO"."'l DO 4 IIHQMa l,10,2 DO 1 .. CFE-6.K,I' COrllTlMJE fI"l S IS , (O""E""

4 C OMI IIJE 2 "LL SEGHEt.TIGlOIIP2'

D.TA 1111~11 9H3tJ-I.Kl I K12"'1 II 101 on. IIIIOU10tt t t S = 1/

(9) K L2 =1 It 102 C01=2R. OATA Dl2'iN

2!t5

C

250 255

14

DATA ICI",I=4.6J1 1.4t-•••• , 1 FIIP\fGRTf.H.~.516) STOP IHII'lTGRT-O.23.GE.O.61 RETURN : F CNTGHl. M ' .. 5 IfCl1zlM"GRlA GOT02'l5

I CONTI I«JE

E NO

SURI\CIJTIt.E GOTC , •• 8,C,O' If-ISUN.LT.eF.ITEI GOrD 255 G UTD 25:) o "T 6 ... H"'HO 11 T ES f2 :H t-I-I 1"0 1 OAT A U 11011 NTEST::IU 101 RHURN S lCP E NL>

'3I-1TO 1 I

41-1TOll! I

t- +-+-. .- t- t-. FASS TWO SUMMARY

2S U~COR~ECTED STATEMENT,S) 1 [~COMPLETE STATEMENT.SI 1 CJESTIONAI!LE USAGE.SI

11 CORRECT EO LlNE.S' 8 r~SERTEC STATEME~T' SJ

I

P[551SlY

~OT 1'6 I ~CT IfIS I ~CT 1t.S I her 1t.S I tIH1,.GED IIiSEIlTEO

hE!T ,r.s I UCCMFlETE

~cr ,1\5. ,.CT ,1\"5 I

ler .PiS I

,.CT ~t.S I

t.r:r IfIS I CHMoIGED

Ctt8NGED

toe, At.S I toOT 11\5 I toe, ,1\5 I t.CT 'hS I tocr .1\5 I t.eT ,,.S ,

IIISEA'En

IIISe~ TEO

•••• ·I""i ?R.r.::

C .. ANGEO III 5U TEf'

C"'''''IGEO I"'SEA TEO

C .. M,IGED 11I5ER TEO

•• t-t.. .- t-+-.

F.SS CNE S~"HARY 9 ERAQRISI DETECTED

2 ILL EGA!. L I,. EI S. OEL nEil) 1 UNIlECOGPUUflLE L I~ECS' DELETED 1 iLlr::G&l cO~"HunIO"" U,.E(5' 2 fl ANK LlNEI 51 DELETED I ,. HISS .tiC ENO l r..,e ''''SE:a feo

TASK SUH'UR'I 70 CAAtS PRoceSSEC 1~ C.RCS WRITTEN ONTO 'H~ P~'H FilE

2 ADJ'I~eIS) PRocesseD

CM:313(llO)

lS