Author(s): R. Matthews, J. Zoll | Library: KERNLIB |
Submitter: | Submitted: 15.07.1978 |
Language: Fortran | Revised: 18.09.1991 |
The 'long list' form SPMquot
WRITE(LUN) (A(J),J=1,N) " is translated into
slow object code by some compilers.
Normally, these compilers handle the 'short list' form
DIMENSION A(N) WRITE(LUN) Acorrectly, compiling just one system request, rather than N requests.
Furthermore, some machines require the calling program to know the
record size beforehand, if reading is done in Fortran. The problem
can be solved by adding the record size as the first word of the record,
thus for
writing: | WRITE(LUN) N,(B(J),J=1,N) | ||
reading: | READ (LUN) N,(B(J),J=1,N) |
Sometimes it is convenient to prefix each record with some
identifiers, always the same number of words, say NA words:
writing: | WRITE(LUN) N,(A(J),J=1,NA),(B(J),J=1,N) | ||
reading: | READ (LUN) N,(A(J),J=1,NA),(B(J),J=1,N) |
The routines of XINOUT provide 'short list' reading and writing for split mode, variable length mode and also for fixed length mode.
Structure:
SUBROUTINE subprograms
User Entry Names:
XINB, XINBF, XINBS,
XOUTB, XOUTBF, XOUTBS
COMMON Block Names and Lengths: /SLATE/ NR,DUMMY(39)
Files Referenced: Parameter
Notes:
The routines XINCF and XOUTCF to handle formatted files are obsolete.
Usage:
Reading:
The vectors to be read are XAV and XV of length
NA and NX; the read routines contain effectively
DIMENSION XV(NX) [,XAV(NA)]Before calling, NX must be preset to the maximum number of words to be accepted into XV with, say, .
CALL XINB(LUN,XV,NX) | Read binary, variable length: | ||
READ(LUN) NR,(XV(J),J=1,MIN(NR,NX)) | |||
CALL XINBF(LUN,XV,NX) | Read binary, fixed length: | ||
READ(LUN) XV | |||
CALL XINBS(LUN,XAV,NA,XV,NX) | Read binary, split mode: | ||
READ(LUN) NR,XAV,(XV(J),J=1,MIN(NR,NX)) |
DIMENSION V(N) [,AV(NA)] | |||
CALL XOUTB(LUN,V,N) | Write binary, variable length: | ||
WRITE(LUN) N,V | |||
CALL XOUTBF(LUN,V,N) | Write binary, fixed length: | ||
WRITE(LUN) V | |||
CALL XOUTBS(LUN,AV,NA,V,N) | Write binary, split mode: | ||
WRITE(LUN) N,AV,V |