The routine package accesses files by file descriptor, an integer variable
that is easily passed among multi-language routines.
The routines are stored in the ar library /$LVDLIB/liblvdr.a.
All variables are passed to C routines by address. The Fortran
caller must define the following variables:
integer max_size
parameter (max_size=100000)
integer buf(max_size),fd,ret
character file_name*50
with the following meaning:
file_name, returns file descriptor value in fd, and operation
code in ret
integer*4
variables in buf, emulating the Fortran statement:
read(fd) ret,(buf(k),k=1,ret)
integer*2
variables in buf emulating the Fortran statement:
read(fd) buf(1),(buf(k),k=2,buf(1))
buf(1)=ret
integer*4 data the routine emulates the
Fortran statement:
read(fd) ret/4,(buf(k),k=1,ret/4)
Return code values and meaning are described below.
| Binary Read Return Codes | ||
| routine | code | meaning |
| open | no such file | |
| any read | record too big | |
| read error | ||
| EOF in unput | ||
| read2_lvd | 2-byte word count, move to buf(1) | |
| read4_lvd | 4-byte word count | |
| read_vms | byte count | |
Programs that need our read tool must use the lvdr library
to create the executable. A Makefile example follows to compile and link
program migr_dist.f that needs routine read4_lvd to read
data files imported using ftp.
| Linking with make |
LIBDIR = /$LVDLIB |
migr_dist : migr_dist.o |
f77 migr_dist.o -o migr_dist -L$(LIBDIR) -llvdr |
migr_dist.o : migr_dist.f |
f77 -c migr_dist.f |