next up previous contents index
Next: Reading back the Up: Examples Previous: Read a File

Write a file with long blocks on a 32-bit computer

Do the same as in the example in section gif, but this time with a bigger buffer and convert data to IBM format for portability (CTOIBM).

      PROGRAM EPEXA5
      DIMENSION IBUF(4500),A(3000)
      CALL EPINIT
 C--- INCREASE OUTPUT BUFFER = PHYSICAL BLOCK LENGTH TO 9000 16-BIT
 C    WORDS (18000 BYTES), CORRESPONDING TO 4500 32-bit words
      CALL EPSETW(20,1,9000,IERR)
      IF(IERR.NE.0)  STOP 1
      DO 10  I=1,20
      CALL USER(A,NW)
 C
 C   ROUTINE -USER- HAS STORED NW VALUES IN A TO BE WRITTEN OUT.
 C   .....
 C--- NOW CONVERT TO IBM FLOATING POINT FORMAT + WRITE
      CALL CTOIBM(A,NW,3)
      CALL EPOUTS(20,3,NW,A,IBUF,IERR)
      IF(IERR.NE.0)STOP 2
   10 CONTINUE
 C **********************************************************
 C
 C                THE FOLLOWING CALL IS ESSENTIAL
 C
 C **********************************************************
      CALL EPCLOS(20,IBUF,IERR)
      IF(IERR.NE.0)STOP 3
      STOP
      END


Janne Saarela
Tue May 16 09:44:28 METDST 1995