FORTRAN Reference Manual
Introduction to File I/O in the HP NonStop 
Environment
FORTRAN Reference Manual—528615-001
5-23
Structured Files
The following FUP commands create the relative file SALES:
To connect the file to a unit for sequential access, your program might contain the 
following:
OPEN (20, file='sales', ACCESS='SEQUENTIAL', RECL=80,
& FORM='FORMATTED', STATUS='OLD')
The following statements position the file for a search by an alternate key:
READ *, product
POSITION(20, KEY=product, KEYLEN=10, KEYID='PR',
& MODE='EXACT')
Once the file is positioned you can read or write the desired data as in the following 
statements:
READ (20,5) customer, product, quantity
PRINT *, customer, product, quantity
1> FUP
File Utility Program - T6553D10 - (08JUN92) System \ASYS
Copyright Tandem Computers Incorporated 1981, 1983, 1985-1992
-SET TYPE R
-SET REC 80
-SET ALTKEY ("CN", KEYOFF 0, KEYLEN 32) <-- Define alternate
-SET ALTKEY ("PR", KEYOFF 32, KEYLEN 32)  keys
-SET ALTFILE (0, altsale)   <-- Name alternate-
-SHOW      key file
 TYPE R
 EXT (1 PAGES, 1 PAGES)
 REC 80
 BLOCK 4096
 ALTKEY ("CN", FILE 0, KEYOFF 0, KEYLEN 32)
 ALTKEY ("PR", FILE 0, KEYOFF 32, KEYLEN 32)
 ALTFILE (0, $JUICE.FTRAN.ALTSALE)
 ALTCREATE
 MAXEXTENTS 16
-CREATE sales
CREATED - $JUICE.FTRAN.SALES
CREATED - $JUICE.FTRAN.ALTSALES
-RESET
-EXIT
2>
VST0502.vsd
Customer Name Product Name Quantity
0  Alternate Key CN  32  Alternate Key PR  64      80










