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

Appendix D 115
FORTRAN Program Examples
Example of Record Output
print *,MESSAGE
endif
C
do while (LENGTH .gt. 0)
call HPSORTOUTPUT (STATUS, BUFFER, LENGTH)
BUFFER(33:39) = 'Empl. #'
BUFFER(50:59) = 'Hire Date:'
print *,BUFFER
if (STATUS .ne. 0) then
call HPSORTERRORMESS (STATUS, MESSAGE, LENGTH)
print *,MESSAGE
endif
end do
C
call HPSORTEND (STATUS)
if (STATUS .ne. 0) then
MESSAGE = ' '
call HPSORTERRORMESS (STATUS, MESSAGE, LENGTH)
print *,MESSAGE
endif
C
return
end
C
subroutine CLOSE_FILES
C
system intrinsic FCLOSE
C
integer*2 DISPOSITION
2 ,SECURITYCODE
C
integer TEMPFILENUM
2 ,PERMFILENUM
3 ,STATUS
C
common /PARMS/ TEMPFILENUM, PERMFILENUM, STATUS
C
DISPOSITION = 0
SECURITYCODE = 0
C
call FCLOSE (TEMPFILENUM, DISPOSITION, SECURITYCODE)
call FCLOSE (PERMFILENUM, DISPOSITION, SECURITYCODE)
C
return
end
When this program is executed, the output is written to the screen:
Everett, Joyce Empl. # 000029 Hire Date: 10/19/87
Gangley, Tomas Empl. # 000003 Hire Date: 06/06/87
Jackson, Jonathan Empl. # 000006 Hire Date: 06/06/87
Jackson, Rosa Empl. # 000022 Hire Date: 08/15/87
Jones, Eliza Empl. # 000001 Hire Date: 06/06/87
Rields, Evelyn Empl. # 000007 Hire Date: 07/12/87
Smith, James Empl. # 000005 Hire Date: 06/06/87
Washington, Lois Empl. # 000014 Hire Date: 07/23/87