900 Series HP 3000 Computers HP FORTRAN 77/iX Migration Guide ABCDE HP Part No. 31501-90004 Printed in U.S.A.
The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material.
Print History The following table lists the printings of this document, together with the respective release dates for each edition. Many product releases do not require changes to the document. Therefore, do not expect a one-to-one correspondence between product releases and document editions. Edition Date Software Version First Edition November 1987 31501A.01.04 Second Edition June 1992 31501A.04.
. iv
Preface This manual explains how to run FORTRAN 66/V and HP FORTRAN 77/V programs on the MPE/iX operating system and how to covert them to HP FORTRAN 77/iX programs. It is written for experienced FORTRAN programmers. This manual contains the following chapters: Chapter 1 Explains terminology used in this manual. Explains migration to compatibility mode versus migration to native mode. Chapter 2 Discusses the scope of Part I and describes the FORTRAN 66/V to HP FORTRAN 77/V Migration Aid.
Additional Documentation This manual does not discuss the MPE/iX operating system in detail. See the appropriate operating system or language manual for complete information about those subjects.
Conventions In a syntax statement, commands and keywords are shown in uppercase and lowercase characters. The characters must be entered in the order shown; however, you can enter the characters in either uppercase or lowercase.
Conventions [ ] (continued) In a syntax statement, brackets enclose optional elements. In the following example, ,TEMP can be omitted: PURGE lename[,TEMP] When several elements are stacked within brackets, you can select one or none of the elements. In the following example, you can select devicename or deviceclass or neither. The elements cannot be repeated. devicename SHOWDEV deviceclass [ . ..
SET [(modi er)]1(variable); 4 5 4CNTL5char 5indicates a key on the The symbol 4 keyboard. For example, 4RETURN5 represents the carriage return key. 4CNTL5char indicates a control character. For example, 4CNTL5Y means you press the control key and the Y key simultaneously.
Conventions (continued) Comment > j ; base pre xes Explains an operator entry or debug message. The HP Symbolic Debugger prompt. Represents \or". Separates commands in a command list. The pre xes %, #, and $ specify the numerical base of the value that follows: %num speci es an octal number #num speci es a decimal number $num speci es a hexadecimal number Bits (bit:length ) x If no base is speci ed, decimal is assumed.
Contents 1. Introduction Terminology . . . . . . . . . . . . . . . . . . Direct Migration of Object Code (Compatibility Mode) Source Code Migration (Native Mode) . . . . . . Migration Paths . . . . . . . . . . . . . . . . Finding Information on the Migration Paths . . . . 1-1 1-1 1-2 1-2 1-3 2. Introduction to Part I The Migration Aid . . . . . . . . . . . . . . . 2-1 3. What the Migration Aid Does How the Migration Aid Works . . . . . . . . . . The Commands of the Command File . . . . . . .
4. What the Migration Aid Does Not Do Data Type Word Length . . . . . . . . . . . . Word Length of Passed Integer and Logical Parameters Logical Variables . . . . . . . . . . . . . . . Functions Not Found in HP FORTRAN 77/V . . . Replacing the BOOL Function . . . . . . . . . Supplying the CSINH Function . . . . . . . . . Supplying the CCOSH Function . . . . . . . . Supplying the CTANH Function . . . . . . . . Evaluation of Mixed Mode Expressions . . . . . . The S Edit Descriptor . . . . . . . . . . . . . .
7. Introduction to Part II Compatibility Mode Versus Native Mode . . . . . Factors A ecting Migration . . . . . . . . . . . 8. Di erences Changed Features . . . . . . . . . . . . Word Size . . . . . . . . . . . . . . . Floating-Point Data . . . . . . . . . . Uninitialized Variables . . . . . . . . . Alignment . . . . . . . . . . . . . . . Common Blocks . . . . . . . . . . . . SYSTEM INTRINSIC Statement . . . . . SEGMENT and LOCALITY Directives . . SYSINTR Directive . . . . . . . . . . .
Figures 1-1. Migration Paths from FORTRAN 66/V to HP FORTRAN 77/iX . . . . . . . . . . . . . 1-2. Migration Paths from HP FORTRAN 77/V to HP FORTRAN 77/iX . . . . . . . . . . . . . 8-1. Data Alignment Comparison . . . . . . . . . . 1-2 1-3 8-3 Tables 3-1. 3-2. 3-3. 4-1. 8-1. Contents-4 Conversions of Directives . . . . . . . . . . . Conversions of IF and SET Directives . . . . . . Conversions of Function Names or Types. . . . . Format Conversions . . . . . . . . . . . . . .
1 Introduction This guide explains how to run FORTRAN 66/V and HP FORTRAN 77/V programs on the MPE/iX oprerating system and how to convert them to HP FORTRAN 77/iX programs. Terminology This guide discusses three versions of FORTRAN: The version of FORTRAN 66 that runs under MPE V and under MPE/iX in compatibility mode is called FORTRAN 66/V. The version of FORTRAN 77 that runs under MPE V and under MPE/iX in compatibility mode is called HP FORTRAN 77/V.
Source Code Migration (Native Mode) Another way to move your programs from an MPE V system onto the MPE/iX operating system is to make necessary modi cations to your source code and then recompile and create new native mode program les. Your programs can then be run in native mode. Programs run more quickly and e ciently on the MPE/iX operating system in native mode than in compatibility mode.
Figure 1-2. Migration Paths from HP FORTRAN 77/V to HP FORTRAN 77/iX Finding Information on the Migration Paths This manual contains two parts: Part 1 (Chapters 2 through 6) describes migration of FORTRAN 66/V programs to HP FORTRAN 77/V (that is, FORTRAN 66 to FORTRAN 77), both running under MPE V. If your programs are written in FORTRAN 66/V, it's best to rst convert them to HP FORTRAN 77/V and then to HP FORTRAN 77/iX.
2 Introduction to Part I Part I compares FORTRAN 66/V to HP FORTRAN 77/V and explains how to use the FORTRAN 66/V to HP FORTRAN 77/V Migration Aid. It also describes manual changes your programs may require. The Migration Aid Several changes must be made to a FORTRAN 66/V program before it can be compiled by the HP FORTRAN 77/V compiler. The FORTRAN 66/V to FORTRAN 77/V Migration Aid allows you to make many of these changes automatically.
3 What the Migration Aid Does The migration aid is a powerful editor that accepts commands from a le, applies those commands to a source le, and generates an output le containing the appropriate changes. The migration aid can make many changes, which are described below. In addition, you can easily modify the command le to make speci c changes your programs require (see the chapter \Customizing the Command File").
When the migration aid is run, the following prompt occurs after each explanation: apply these commands? (expected Y,N,A) These are the valid responses: Y Performs the described conversion wherever the construct occurs in the source le. N Performs no conversions of the kind described. (A carriage return assumes this response.) A Asks the user before performing each conversion. E Exits the program without performing any conversions of the kind described. (Note that both uppercase and lowercase are accepted.
The Commands of the Command File Free Format The following are the commands contained in the command le FTNCMDS.PUB.SYS. They are listed in the order they appear when the migration aid executes. If free formatting has been used in a FORTRAN 66/V program, you must change the source le to xed format before the migration aid can perform any other conversions. However, since most FORTRAN 66/V programs are written in xed format, this command does not usually need to be applied.
Table 3-1.
IF and SET Directives The IF and SET directives are changed as follows: Table 3-2. Conversions of IF and SET Directives FORTRAN 66/V Octal Constants Character Constants Logical Constants HP FORTRAN 77/V $SET Xn ON $SET (Xn = .TRUE.) $SET Xn OFF $SET (Xn = .FALSE.) $IF Xn =ON $IF (Xn ) $IF Xn =OFF $IF (.NOT.X n ) $IF $ENDIF Octal constants have a di erent notation in HP FORTRAN 77/V.
Condition Code, Parameters Passed by Value, and Alternate Returns Note When this command is applied, the following changes occur: Condition code constructs of the form .CC. are changed to CCODE(). The backslashes (\) that precede parameters passed by value are deleted. In HP FORTRAN 77/V, passing parameters by value requires that an ALIAS directive be inserted in the source code. This insertion must be done manually. The dollar signs ($) in alternate returns are changed to asterisks (*).
Parameterless System Intrinsics CALENDAR CAUSEBREAK CLOCK DEBUG The system intrinsics listed below are changed to parameterless system intrinsics. FATHER FREELOCRIN GETJCW GETORIGIN GETPRIVMODE GETUSERMODE PROCTIME RESETDUMP TERMINATE TIMER For example, date=CALENDAR is changed to date=CALENDAR() If your program contains variables with names identical to these system intrinsics, answer A so that you are prompted before each change is made.
New Function Names The following are the FORTRAN 66/V intrinsic functions whose names or parameter types are changed by the migration aid. For example, in FORTRAN 66/V the function IABS has an INTEGER*2 parameter, whereas in HP FORTRAN 77/V its parameter type is INTEGER*4. Therefore, IABS is changed to HABS, which has an INTEGER*2 parameter. Table 3-3. Conversions of Function Names or Types.
Conversion of Constructs of the Form VAR[i:j] Note Substring Designators In FORTRAN 66/V, substring designators and partial word designators have the same form: VAR[i:j]. Only a compiler can determine whether a construct is a substring designator or a partial word designator. Therefore, the migration aid splits the conversion of this construct into two parts. The rst part asks whether to treat such constructs as substring designators; the second asks whether to treat them as partial word designators.
Replacing the STR Function If you select the STR conversion command, the migration aid converts expressions of the form variable1=STR(variable2,format) to internal WRITE statements of the form WRITE(variable1,format) variable2 Deleting the 'END=' Specifier in WRITE Statements 3-10 'END=' speci ers are not allowed in HP FORTRAN 77 WRITE statements. The migration aid removes 'END=' speci ers from WRITE statements if you select this command.
4 What the Migration Aid Does Not Do The migration aid cannot perform all transformations necessary to properly compile a FORTRAN 66/V program with the HP FORTRAN 77/V compiler; some changes must be performed manually. This chapter discusses the manual changes. Some features of HP FORTRAN 77/V are incompatible with similar features in FORTRAN 66/V. This chapter also discusses these incompatibilities.
Word Length of Passed Integer and Logical Parameters Logical Variables When calling subprograms that pass integer and logical parameters by reference , make sure that the actual and formal parameters have the same word length. (They should both be single integer or double integer.) This is especially important when calling subprograms in other languages. If parameters passed by reference are not the same, the Segmenter issues an error message.
If the FORTRAN 66/V program uses BOOL to convert to a logical (expecting logicals to be in the FORTRAN 66/V format), make the changes illustrated in the following example: FORTRAN 66/V IF (BOOL(i)) GOTO 10 HP FORTRAN 77/V IF (BTEST(i,0)) GOTO 10 Note that BTEST(i,0) tests the low-order bit of i, according to the FORTRAN 66/V format for logicals. If the value of i has been adjusted to the HP FORTRAN 77/V format for logicals, the bit de ned by HP FORTRAN 77/V must be tested.
Evaluation of Mixed Mode Expressions Mixed mode expressions are evaluated di erently in the two compilers. In operations of the same precedence, FORTRAN 66/V evaluates the same types within an expression rst, while HP FORTRAN 77/V evaluates strictly from left to right. The following example program produces di erent results in the two compilers: INTEGER*4 j j = 2000000000 WRITE(6,*) 1.0+j-j END The result returned in FORTRAN 66/V is 1.0. The result returned in HP FORTRAN 77/V is 0.0.
Named Constants in PARAMETER Statements Passing Character Variables In the PARAMETER statement of FORTRAN 66/V, the type of a named constant is determined solely by the constant itself and not by the initial letter of its name. In HP FORTRAN 77/V, the type is determined by the initial letter of the name. For this reason, a named constant should be explicitly typed before using the PARAMETER statement.
DO Loops HP FORTRAN 77/V does not allow jumping into the middle of a DO loop. DO loops with this feature in FORTRAN 66/V require a logic change in HP FORTRAN 77/V. The migration aid automatically inserts the CONTROL ONETRIP compiler directive in converted programs. However, new programs must specify this directive if they require all loops to be executed at least once. Composite Numbers HP FORTRAN 77/V does not allow composite numbers.
Format Statements Format statements should be changed as follows: Table 4-1. Format Conversions Change These Recognition of End of Data To These 2/ // 3/ /// 2"-" 2("-") When reading from a terminal, FORTRAN 66/V recognizes end of data when it encounters either a colon (:) or (:EOD) in input data. HP FORTRAN 77/V recognizes end of data only when it encounters :EOD, it does not recognize a colon as end of data.
List-Directed READ Statements HP FORTRAN 77 handles list-directed input di erently from FORTRAN 66/V. FORTRAN 66/V allows you to input fewer values than the number of variables in a READ statement. HP FORTRAN 77/V requires that you either supply a value for each variable in the READ statement or append a slash (/) after the last value. For example, for the source lines REAL A,B READ (5,*) A,B in FORTRAN 66/V you can input a value for A, followed by a carriage return.
5 Using the Migration Aid This chapter explains how to use the migration aid and shows an example of a migration. Please read the entire chapter before using the migration aid. Checking Your Catalog The CONVERT UDC must exist in your catalog before you can use the migration aid. To list the contents of your catalog, enter the command SHOWCATALOG. If CONVERT is not listed, execute this command: 2 :SETCATALOG FTNUDC.PUB.
Example Conversion Here is an example that shows the steps in converting a FORTRAN 66/V source program to an HP FORTRAN 77/V source program. This is the program as originally written in FORTRAN 66/V: $control uslinit program test system intrinsic dateline, calendar parameter prompt = "today is ....
Running the Migration Aid on the Example Program The following command runs the migration aid on the FORTRAN 66/V source le INPUT66 and produces the HP FORTRAN 77/V source le OUTPUT77: :CONVERT INPUT66,OUTPUT77,FTNCMDS.PUB.SYS While the migration aid runs, it sends the following information to the terminal (user responses are highlighted): FORTRAN MIGRATION AID (C) 1987/A.00.
- from from from from from from from from SEGMENT=sname to SEGMENT "sname" LIST/NOLIST to LIST on/off CODE/NOCODE to LIST_CODE on/off MAP/NOMAP to TABLES on/off BOUNDS to RANGE on WARN/NOWARN to WARNINGS on/off LOCATION/NOLOCATION to CODE_OFFSETS on/off INIT to INIT ON apply these commands? expected (Y,N,A) Y The next changes will delete any compiler directive in FORTRAN/V that has no equivalent in FORTRAN 77.
apply these commands? expected (Y,N,A) Y The next changes will affect character constants of the form %nnC. They will be converted to CHAR(nn) except if they are found in the same line as a FORMAT statement. Note that numbers of the form %nn,%nnJ,%nnL,%nnR,%nnD won't be changed. apply these commands? expected (Y,N,A) Y The next changes will affect the condition code intrinsic, alternative return locations, and parameters passed by value in the following way, -Occurrences of .CC.
The intrinsics affected are -CALENDAR CAUSEBREAK -DEBUG FATHER -GETJCW GETORIGIN -GETUSERMODE PROCTIME -TERMINATE TIMER CLOCK FREELOCRIN GETPRIVMODE RESETDUMP apply these commands? expected (Y,N,A) Y The next commands will change all the following intrinsic functions to their corresponding name in FORTRAN 77. IABS....HABS JMOD....MOD JMAX1...MAX1 JFIX....IFIX JDIM....IDIM JABS....IABS MOD.....HMOD AJMINO..AMINO ISIGN...HSIGN FLOATJ..FLOAT JINT....INT AJMAXO..AMAXO JMINO...MINO JSIGN...ISIGN JDINT...
The next change will replace the STR function with an internal WRITE VAR1 = STR(VAR2, num) --> WRITE (VAR1, Inum) VAR2 apply these commands? expected (Y,N,A) Y Deletion of END=label in WRITE statements apply these commands? expected (Y,N,A) Y NOW THE CONVERSION WILL START. old line: $control uslinit new line: $OPTION uslinit C$control uslinit $OPTION uslinit program test system intrinsic dateline,calendar old line: parameter prompt = "today is...." new line: PARAMETER ( prompt = "today is....
old line: PRINT *, prompt,datebuf[1:17] ASK option was requested PRINT *, prompt,datebuf(1:1+17-1) apply it? expected (Y,N) Y old line: display prompt,datebuf[1:17] new line: PRINT *, prompt,datebuf(1:17) C display prompt,datebuf[1:17] PRINT *, prompt,datebuf(1:17) old line: cctrl=%320C new line: cctrl=CHAR(320B) C cctrl=%320C cctrl=CHAR(320B) write(6,1100) cctrl read(5,1200) string write(6,1300) read(5,1400) ybirth,mbirth,dbirth old line: today=int(calendar) new line: today=int(CALENDAR()) C today=int(cale
ASK option was requested dtoday=IBITS(today,-7+15-9+1,9) apply it? expected (Y,N) Y old line: dtoday=today[7:9] new line: dtoday=IBITS(today,+8-9+1,9) C dtoday=today[7:9] dtoday=IBITS(today,+8-9+1,9) mtoday=0 do 50 i=1,12 mtoday=mtoday+1 if ( dtoday .le. daym(mtoday)) go to 60 dtoday=dtoday-daym(mtoday) 50 continue 60 age=ytoday-ybirth if ( mtoday-mbirth) 100,80,200 80 if ( dtoday-dbirth) 100,200,200 100 age=ytoday-ybirth-1 200 write(6,1500) string,age stop 1100 format(1a1,'.
C C C C C 50 60 80 100 200 1100 1200 1300 1400 1500 5-10 Using the Migration Aid display prompt,datebuf[1:17] PRINT *, prompt,datebuf(1:17) cctrl=%320C cctrl=CHAR(320B) write(6,1100) cctrl read(5,1200) string write(6,1300) read(5,1400) ybirth,mbirth,dbirth today=int(calendar) today=int(CALENDAR()) ytoday=today[0:7] ytoday=IBITS(today,+15-7+1,7) dtoday=today[7:9] dtoday=IBITS(today,+8-9+1,9) mtoday=0 do 50 i=1,12 mtoday=mtoday+1 if ( dtoday .le.
Compilation of the Converted Program When OUTPUT77 is compiled by the HP FORTRAN 77/V compiler, it produces the following listing: PAGE 1 HEWLETT-PACKARD HP32116A.00.08 HP FORTRAN 77 (C) HEWLETT-PACKARD CO. 1987 MON, MAY 18, 1987, 12:55 PM 0 0 1 2 2 1 2 3 4 5 C$control uslinit $OPTION uslinit program test system intrinsic dateline,calendar C parameter prompt = "today is....
25 26 27 28 29 30 31 32 33 37 38 39 40 41 42 43 44 45 PAGE 1 50 60 80 100 200 1100 1200 continue age=ytoday-ybirth if ( mtoday-mbirth) 100,80,200 if ( dtoday-dbirth) 100,200,200 age=ytoday-ybirth-1 write(6,1500) string,age stop format(1a1,'.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 1 1 1 1 50 60 80 100 200 1100 1200 1300 1400 1500 read(5,1200) string write(6,1300) read(5,1400) ybirth,mbirth,dbirth today=int(CALENDAR()) ytoday=IBITS(today,+15-7+1,7) dtoday=IBITS(today,+8-9+1,9) mtoday=0 do 50 i=1,12 mtoday=mtoday+1 if ( dtoday .le.
6 Customizing the Command File This section describes how the commands of the command le work. You do not need to read this section unless you plan to create new command les or add more commands to the existing le. Since the conversion instructions reside in ASCII les, the instructions can be customized to your speci cations. You can add new commands to the existing le or create new command les that suit your particular needs. The supplied command le is FTNCMDS.PUB.SYS.
The syntax of the R, N, G, S, and T commands is command/search expression//replace expression/ R/boy//girl/ Example This replaces the rst occurrence of boy (upper- or lowercase) in each line with girl. The slashes in the example are the search string delimiters. Two slashes are used between the search and replacement strings. If one is omitted, the search is performed but no replacement done.
Tag Fields {expn } a&b \Remember" the text matched by the expression expn for use in the replacement string. Match a string delimited by evenly nested occurrences of a and b (which can be any two characters), and also \remember" the contents for use in the replacement string. Example R/(&)//[wow]/ This command replaces any set of characters delimited by parentheses with the string [wow]. For example, if a source line contained the string (hi(people)), the migration aid would replace it with [wow].
Examples The following command converts all occurrences of the string ACCEPT to the string READ *,. G/{@}ACCEPT//&1READ \*,/ The following command converts only the rst occurrence of the string ACCEPT to the string READ *,.
Replacement String Commands Tag Fields Replacement string commands are those that appear on the right side of the R, N, G, and S commands. &n >n
Example Command File Here is an example of a command le, with comments explaining what it does. * This file converts free format to fixed format FORTRAN. * * If the string "$CONTROL FREE" is found, delete that line: D/$CONTROL FREE/ * If a line begins with a series of alphanumeric characters, * followed by a space, delete them (or, if the line begins with just * a space, delete the space).
7 Introduction to Part II This part of the migration guide describes migration of HP FORTRAN 77/V programs to the MPE/iX operating system. Compatibility Mode Versus Native Mode HP FORTRAN 77/V programs can be run on MPE/iX in compatibility mode or native mode . As discussed in Chapter 1, FORTRAN 77/V object code can be directly transferred to an MPE/iX based system with no changes to the source code; these programs can then be run on an MPE/iX system under compatibility mode.
Changes may also be required to HP FORTRAN 77/V data les before they can be used by an HP FORTRAN 77/iX program. These changes are described in Chapter 10 (\Data File Conversion").
8 Differences An HP FORTRAN 77/iX program di ers in a few respects from an HP FORTRAN 77/V program, mainly because of di erences in machine architecture. Changed Features Word Size Note Floating-Point Data Uninitialized Variables Some features are implemented di erently in HP FORTRAN 77/V and HP FORTRAN 77/iX. These are explained below. The main di erence a ecting conversion from HP FORTRAN 77/V to HP FORTRAN 77/iX is word size.
Alignment The default alignment of data items larger than 16 bits is di erent in HP FORTRAN 77/iX and HP FORTRAN 77/V. The term alignment here refers to a data item's position in memory relative to the adjacent word boundaries. For example, in both versions of HP FORTRAN 77 an INTEGER*4 variable is aligned by default on a word boundary in both versions of HP FORTRAN 77. Therefore, the alignment is on a 16-bit boundary in HP FORTRAN 77/V and on a 32-bit boundary in HP FORTRAN 77/iX (see Figure 8-1).
Figure 8-1.
In Figure 8-1, both versions of HP FORTRAN 77 assign the rst hole in the same position after the character variable, because the following data item, which is declared as an INTEGER*2, is 16-bit aligned in both. HP FORTRAN 77/iX assigns a second hole to align the double precision variable D8 on a double-word (64-bit) boundary. In HP FORTRAN 77/V, on the other hand, double precision items need only be word (16-bit) aligned.
Table 8-1.
Here is an example showing alignment di erences for common block variables in two program units.
SYSTEM INTRINSIC Statement SEGMENT and LOCALITY Directives Programs using the SYSTEM INTRINSIC statement to call MPE/iX intrinsic functions that are incompatible with their MPE V counterparts (MYCOMMAND, CREATEPROCESS, etc.) must modify the calls to those intrinsics. The changed intrinsics generally store procedure labels or addresses in 16-bit variables; these items are 32 bits in MPE/iX. Refer to the MPE/iX Intrinsics Reference Manual and the Application Migration Guide when using these intrinsics.
Removed Limitations USLINIT Directive The MPE V operating system limits stack space to 65,535 bytes. The virtual memory mechanism of the MPE/iX operating system increases stack space to more than 230 bytes. The USLINIT compiler directive is used in HP FORTRAN 77/V to empty the user subprogram library (USL) before placing any object code in it.
New Features HP3000 16 Directive Many features not available in HP FORTRAN 77/V are added in HP FORTRAN 77/iX. These are outlined below. For complete information about any of these features, see the HP FORTRAN 77/iX Reference manual. The HP3000_16 compiler directive speci es various options for compatibility with HP FORTRAN 77/V. These are the options: $HP3000_16 REALS Speci es MPE V format for oating-point data. $HP3000_16 ALIGNMENT Speci es alignment of noncharacter data on 16-bit boundaries.
$OPTIMIZE LEVEL2_MIN $OPTIMIZE LEVEL2_MAX 8-10 Differences See below for ASSUME descriptions. Level 2 optimization with all the ASSUME settings at OFF. Level 2 optimization with all the ASSUME settings at ON.
$OPTIMIZE ASSUME_NO_PARAMETER_OVERLAPS $OPTIMIZE ASSUME_NO_SIDE_EFFECTS $OPTIMIZE ASSUME_PARM_TYPES_MATCHED $OPTIMIZE ASSUME_NO_EXTERNAL_PARMS No actual parameters passed to a subprogram overlap each other. The current subprogram changes only local variables. It does not change any variables in COMMON, nor does it change parameters. All of the actual parameters passed were the type expected by this subprogram.
SYMDEBUG Directive LOCALITY Directive EXTERNAL ALIAS and LITERAL ALIAS Directives UPPERCASE and LOWERCASE Directives ON Statement and INTEGER*2 Conditions 8-12 Differences The MPE/iX operating system provides symbolic debugging for HP FORTRAN 77/iX programs. If the SYMDEBUG directive is used, the compiler inserts debugging information in the object le. Symbolic debugging is not compatible with code optimization; therefore, do not use both $SYMDEBUG and $OPTIMIZE.
9 Source Program Conversion Certain changes may be required in an HP FORTRAN 77/V program before it can be compiled by the HP FORTRAN 77/iX compiler and executed properly on the MPE/iX system. These changes mainly involve data format. The quickest way to run your program in native mode is to use the HP3000_16 directive as explained below.
Programs Packing Data Items with EQUIVALENCE Implied Equivalence Programs that use EQUIVALENCE statements to pack data items relative to each other must either remove the packing dependency or use the $HP3000_16 directive with the ALIGNMENT option. If a program implies equivalence by de ning common blocks di erently among program units, either use the HP3000_16 directive with the ALIGNMENT option or revise the program.
10 Data File Conversion ASCII les need no conversion. Binary (unformatted) les are also compatible except for oating-point items (of type REAL, DOUBLE PRECISION, COMPLEX, or DOUBLE COMPLEX). Binary les containing reals in the MPE V format can be used without any conversion if the program is compiled specifying HP3000_16 REALS or HP3000_16 ON. If you want full native mode oating-point performance, you should convert the binary les to IEEE oating-point format, as explained below.
> OPEN (15, FILE='newdata', ACCESS='SEQUENTIAL', FORM='FORMATTED', STATUS='NEW') recnum = 1 C Main loop reading and writing records until past the end of file, C which is an error on a direct access file. 10 100 CONTINUE ! Do until end READ (12, REC=recnum, ERR=99) i, x, recnum = recnum + 1 WRITE (15, 100) i, x, i4, dp, j, y, FORMAT (I7, E14.8, I11, E24.18, I7, GOTO 10 of file. i4, dp, j, y, z z ! Same I/O list as READ. 2E14.8) C Exit from loop, file finished.
99 CONTINUE WRITE (6, *) 'FILE "mydata" CREATED WITH', RECNUM - 1, ' RECORDS.' CLOSE (15, STATUS='DELETE') ! Purge file used for transfer. END Another way is to use the HPFPCONVERT system intrinsic. A program can read in the FORTRAN 77/V oating-point data, pass the data to HPFPCONVERT for translation to IEEE format, and then write out the data in native mode.
11 Conversion Checklist Here is a quick check. If your program does not use any of the features listed in this chapter, you need only recompile to run it in full native mode. If your program has any of these characteristics, it may need modi cation. Here are some points to check: EQUIVALENCE Statement or Redefined Common Blocks HP FORTRAN 77/iX has di erent alignment requirements from HP FORTRAN 77/V. In most programs, the compiler automatically allocates the alignment.
COBOL compatible type) that may align variables other than on their regular boundaries, specify HP3000_16 ALIGNMENT. Note Specifying HP3000_16 ALIGNMENT causes a slight reduction in performance, so do not use it unnecessarily. If your program uses equivalence to overlay one logical set of data items with another (planning for them to be used separately, for data space savings), consider modifying it not to do this.
Index A ACCEPT statement, 3-6 AJMAX0 function, 3-8 AJMIN0 function, 3-8 algebraic expressions, 3-9 ALIAS directive, 3-6 ALIAS directive, 4-5 alignment, 8-4, 8-5, 9-2, 11-1 comparison, 8-2, 8-4 default, 8-2 HP Precision Architecture, 9-1 alternate returns, 3-6, 4-6 AMAX0 function, 3-8 AMIN0 function, 3-8 B C binary databases, 9-1 binary les, 9-1 converting to IEEE format, 10-1 with HP 3000 oating-point data, 11-2 BOOL function, 4-2 BOUNDS directive, 3-3 CALENDAR system intrinsic, 3-7 carriage control co
compilation, 5-11 composite numbers, 4-6 condition code, 3-6 constants carriage control, 3-5 character, 3-5 logical, 3-5 octal, 3-5 CONTROL , 3-4 CONTROL directive, 3-4 CONTROL ONETRIP directive, 4-6 conversion checklist, 11-1 CONVERT command, 5-1 CSINH function, 4-3 CTANH function, 4-3 customizing the command le, 6-1 D Index-2 data les binary, 9-1 data type declaration, 8-5 data type word length, 4-1 DEBUG system intrinsic, 3-7 directive ALIAS, 3-6 ALIAS, 4-5 BOUNDS, 3-3 CHECK, 3-3 CODE, 3-3 CODE_OFFSETS
TABLES, 3-3 TRACE, 3-4 UPPERCASE, 8-12 WARN, 3-3 WARNINGS, 3-3 directives, 3-3 DISPLAY statement, 3-6 DO loop execution, 4-6 jumping into, 4-6 E EDIT directive, 3-4 'END=' speci er, 3-10 equivalence, 11-2 implied, 9-2 EQUIVALENCE statement, 8-4, 9-2, 11-1 evaluation of mixed mode expressions, 4-4 example conversion, 5-2 expressions algebraic, 3-9 mixed mode, 4-4 EXTERNAL_ALIAS directive, 8-12 F FATHER system intrinsic, 3-7 xed format, 3-3 FLOAT function, 3-8 oating-point, 8-1, 11-2 HP 3000, 8-1 IEEE,
H HABS function, 3-8 HDIM function, 3-8 HMOD function, 3-8 HP3000_16 ALIGNMENT, 9-2 HP3000_16 directive, 8-4, 8-5, 8-9, 9-2, 11-2 STRING_MOVE option, 8-7 HP3000 16 directive, 11-1 HP3000_66 CHARS directive, 4-5 HP 3000 oating-point, 8-1 HPFPCONVERT system intrinsic, 10-3 HSIGN function, 3-8 I IABS function, 3-8 ICHAR function, 3-8 IDIM function, 3-8 IDINT function, 3-8 IEEE oating-point, 8-1 IEEE format, 9-1, 10-1 IF Directive, 3-5 IFIX function, 3-8 implied equivalence, 9-2 INCLUDE , 3-4 INIT directiv
L LIST_CODE directive, 3-3 LIST directive, 3-3 LITERAL_ALIAS directive, 8-12 LOCALITY directive, 8-7, 9-2 LOCATION directive, 3-3 logical constants, 3-5 logical parameters, 4-2 logicals, 9-2 LOGICAL type declarator, 3-6 logical variables, 4-2 LOWERCASE directive, 8-12 M MAP directive, 3-3 MAX0 function, 3-8 MAX1 function, 3-8 migration aid, 2-1 migration of object code, direct, 1-1 migration path information, nding, 1-2 MIN0 function, 3-8 MIN1 function, 3-8 MOD function, 3-8 MORECOM directive, 8-8 N O
R RANGE directive, 3-3 READ statement, 3-6 REALS option, 9-1 replacement string commands, 6-5 RESETDUMP system intrinsic, 3-7 running the migration aid, 5-3 S Index-6 search string commands, 6-2 S edit descriptor, 4-4 SEGMENT directive, 3-3, 8-7, 8-12, 9-2 Segmenter, 4-2 SETCATALOG, 5-1 SET Directive, 3-5 SHOWCATALOG, 5-1 source code migration, 1-2 source program conversion, 9-1 SPLINTR directive, 8-7 stack space, 8-8 statement ACCEPT, 3-6 COMMON, 8-5 DISPLAY, 3-6 EQUIVALENCE, 8-4, 9-2, 11-1 ON, 8-12 PR
T TABLES directive, 3-3 U UDC, 5-1 V W tag elds, 6-3, 6-5 TERMINATE system intrinsic, 3-7 TIMER system intrinsic, 3-7 TRACE directive, 3-4 TurboIMAGE, 9-1 type declarator CHARACTER, 3-6 INTEGER , 3-6 LOGICAL , 3-6 PARAMETER, 3-6 uninitialized variables, 8-1 UPPERCASE directive, 8-12 user subprogram library (USL), 8-8 USLINIT , 8-8 variables, uninitialized, 8-1 VAR[i:j] , 3-9 WARN directive, 3-3 WARNINGS directive, 3-3 word designators partial, 3-9 word length data type, 4-1 of passed parameters, 4-2