The following program reads through the first lane of a mapping data set, and reports the largest pixel value found. It assumes the dataset has the charactersitics listed in the above example header file, and that the program is to be compiled and run on a DEC ALPHA.
Note that this example assumes RECL is in bytes. This assumption is dependent upon FORTRAN compiler options.
INTEGER*2 BUFFER(1280) INTEGER*2 MAXVAL INTEGER STATUS INTEGER J INTEGER INREC OPEN ( UNIT=1, FILE='l1', STATUS='OLD', ACCESS='DIRECT', : FORM='UNFORMATTED', RECL=2560 ) INREC = 0 STATUS = 0 MAXVAL = -32767 * * Read one row of pixels at a time updating the maximum transmission * value * DO WHILE ( STATUS .EQ. 0 ) INREC = INREC + 1 READ ( UNIT=1, REC = INREC, IOSTAT=STATUS ) BUFFER IF ( STATUS .EQ. 0 ) THEN DO J = 1, 1280 MAXVAL = MAX(BUFFER(J), MAXVAL) ENDDO ENDIF ENDDO PRINT *, 'Maximum transmission found was', MAXVAL CLOSE ( UNIT=1 ) END