 |
» |
|
|
|
The following listing is a FORTRAN program that inserts the value 95 into message number 201 in message set 1 in the message catalog CATALOG.PUB.SYS. The message is output to $STDLIST. The accessed portion of the message catalog is:
$SET 1
.
.
.
210 SYSTEM LOG FILE NUMBER ! IS ON
|
$control standard_level system
program CM_MSGCAT
*
system intrinsic QUIT
*
integer*2 MSGLEN
2 ,SETNUM
3 ,MSGNUM
4 ,PARMASK
5 ,DESTINATION
*
integer*4 PARAM1
2 ,FILENUM
*
logical STATUS_RETURN
*
character*20 FILENAME
*
* Initialize variables to open file.
*
FILENAME = '%CATALOG.PUB.SYS%'
STATUS_RETURN = .true.
*
* Open the file.
*
call OPEN_CATALOG (FILENAME
2 ,FILENUM
3 ,STATUS_RETURN)
*
if (STATUS_RETURN) go to 10
print *,'Open failed. Terminating.'
call QUIT (1)
*
|
* Initialize variables to read message.
*
10 SETNUM = 1
MSGNUM = 201
DESTINATION = 0
PARMASK = 13333B
PARAM1 = 95
STATUS_RETURN = .true.
*
* Generate the message, which will be displayed on $STDLIST
*
call READ_CATALOG (FILENUM
2 ,SETNUM
3 ,MSGNUM
4 ,DESTINATION
5 ,PARMASK
6 ,PARAM1
7 ,STATUS_RETURN)
if (STATUS_RETURN) go to 20
print *,'Read failed. Terminating.'
call QUIT (2)
*
* Close the catalog with default disposition and unrestricted access
*
20 call CLOSE_CATALOG (FILENUM
2 ,STATUS_RETURN)
if (STATUS_RETURN) go to 30
print *,'Close failed. Terminating.'
call QUIT (3)
*
* Normal end of program
*
30 stop
end
*
************************************************************
*
subroutine OPEN_CATALOG (FILENAME
2 ,FILENUM
3 ,STATUS_RETURN)
*
system intrinsic HPFOPEN
*
integer STATUS
2 ,PERM
3 ,ON
4 ,INHIBITED
5 ,ASCII_FILE
6 ,DESIGNATOR
7 ,DOMAIN
8 ,MULTIREC
9 ,BUFFERING
A ,ASCII_BINARY
B ,FILENUM
*
logical STATUS_RETURN
|
*
character*20 FILENAME
*
* Initialize variables
*
DESIGNATOR = 2
DOMAIN = 3
MULTIREC = 15
BUFFERING = 46
ASCII_BINARY = 53
PERM = 1
ON = 1
INHIBITED = 1
ASCII_ENTITY = 1
STATUS_RETURN = .true.
*
* Open the file
*
call HPFOPEN (FILENUM, STATUS
2 ,DESIGNATOR, FILENAME
3 ,DOMAIN, PERM
4 ,MULTIREC, ON
5 ,BUFFERING, INHIBITED
6 ,ASCII_BINARY, ASCII_FILE)
*
if (STATUS .ne. 0) STATUS_RETURN = .false.
*
return
end
*
************************************************************
*
subroutine READ_CATALOG (FILENUM
2 ,SETNUM
3 ,MSGNUM
4 ,DESTINATION
5 ,PARMASK
6 ,PARAM1
7 ,STATUS_RETURN)
*
system intrinsic GENMESSAGE
*
integer*2 MSGLENGTH
2 ,SETNUM
3 ,MSGNUM
4 ,PARMASK
5 ,DESTINATION
6 ,ERRORNUM
*
integer*4 PARAM1
2 ,FILENUM
*
logical STATUS_RETURN
*
* Initialize variables
*
STATUS_RETURN = .true.
*
* Generate the message
*
MSGLENGTH = GENMESSAGE (FILENUM
2 ,SETNUM
3 ,MSGNUM
4 ,,,PARMASK
5 ,PARAM1
6 ,,,,,DESTINATION
7 ,ERRORNUM)
*
if (ERRORNUM .ne. 0) STATUS_RETURN = .false.
*
return
end
*
************************************************************
*
subroutine CLOSE_CATALOG (FILENUM
2 ,STATUS_RETURN)
*
system intrinsic FCLOSE
*
integer*2 DISPOSITION
2 ,SECURITYCODE
*
integer*4 FILENUM
*
logical STATUS_RETURN
*
* Initialize variables
*
|
DISPOSITION = 0
SECURITYCODE = 0
STATUS_RETURN = .true.
*
* Close file
*
call FCLOSE (FILENUM
2 ,DISPOSITION
3 ,SECURITYCODE)
*
if (ccode()) 10,20,10
10 STATUS_RETURN = .false.
*
20 return
end
|
When this program is executed, the output is:
SYSTEM LOG FILE NUMBER 92 IS ON
|
|