SORT-MERGE/XL Programmer's Guide (32650-90884)

Appendix D 111
FORTRAN Program Examples
Example of Record Input
60 continue
end do
C Now read PERMEMP, as explained above.
EOF = .false.
LNGTH = FREAD (PERMFILENUM, BUFFER, LENGTH)
if (ccode()) 70,90,80
70 print *, 'FREAD error on PERMEMP.'
call QUIT (70)
80 EOF = .true.
90 continue
do while (.not. EOF)
call HPSORTINPUT (STATUS, BUFFER, LENGTH)
if (STATUS .ne. 0) then
MESSAGE = ' '
call HPSORTERRORMESS (STATUS, MESSAGE, LENGTH)
print *, MESSAGE
endif
LNGTH = FREAD (PERMFILENUM, BUFFER, LENGTH)
if (ccode()) 100,120,110
100 print *, 'FREAD error on PERMEMP'
call QUIT (100)
110 EOF = .true.
120 continue
end do
call HPSORTEND (STATUS)
if (STATUS .ne. 0) then
MESSAGE = ' '
call HPSORTERRORMESS (STATUS, MESSAGE, LENGTH)
print *,MESSAGE
endif
return
end
C
subroutine CLOSE_FILES
C
system intrinsic FCLOSE
C
integer*2 DISPOSITION
2 ,SECURITYCODE
C
integer TEMPFILENUM
2 ,PERMFILENUM
3 ,OUTFILENUM
4 ,STATUS
C
common /PARMS/ TEMPFILENUM, PERMFILENUM
2 ,OUTFILENUM, STATUS