This example starts by skipping to a selected block on the input
unit 10
using MODE=30
in EPREAD.
Then a further selection is
made on the logical record header (looking for ID=0
)
using MODE=20
.
The data for these events are then unpacked as 16-bit words, and
only the first 100 words are written to the output unit (20
)
and packed in 32-bits. In addition a user defined header (IH
) is
used where IH(1-4)
are the default package header, IH(5)
is the
original number of data words and IH(6)
the original record
sequence number.
PROGRAM EPTEST DIMENSION IBUF(900),IBUFO(900),IRECI(1000),IH(6) CALL EPINIT C SET STATUS WORDS FOR INPUT CALL EPSETW(10,2,1000,IERR) IF(IERR.NE.0)STOP 1 C-- SKIP TO BLOCK 15 5 CALL EPREAD(10,30,NW,IRECI,IBUF,IERR) IF(IERR.NE.0)STOP 5 IF(IRECI(3).LT.15)GOTO 5 C-- READ THE RECORD HEADER AND SELECT RECORDS WITH TYPE ID=0 50 CALL EPREAD(10,20,NW,IRECI,IBUF,IERR) IF(IERR.NE.0)GOTO 500 IF(IRECI(2).NE.0)GOTO 50 IH(6)=IRECI(4) C-- READ DATA OF CURRENT RECORD, UNPACK AS 16-BIT WORDS CALL EPREAD(10,12,NW,IRECI,IBUF,IERR) IF(IERR.NE.0)GOTO 500 JJ=NW-4 PRINT*,NW,(IRECI(I),I=1,5),(IRECI(I),I=JJ,NW) IH(5)=NW C-- WRITE AS 32-BIT WORDS CALL EPOUTL(20,3,6,IH,100,IRECI,IBUFO,IERR) IF(IERR.NE.0)GOTO 600 GOTO 50 C READ ERRORS C PARITY AND OTHER 500 IF(IERR.NE.1)GOTO 50 C EOF CALL EPCLOS(20,IBUFO,IERR) STOP C WRITE ERRORS 600 STOP 600 END