next up previous contents index
Next: The ZEBRA and Up: SYSREQ and SYSREQ-TCP Previous: SYSREQ and SYSREQ-TCP

The SYSREQ FORTRAN interface

CALL SYSREQ (SERVICE,COMMAND,IRC*,REPLY*,*LENREP*)

SERVICE
Character variable specifying the service required
COMMAND
Character variable specifying the command to pass to that service
IRC
Integer variable in which the return code is returned
REPLY
Character array of length LENREP in which the reply is returned
LENREP
Integer variable containing the number of elements of REPLY on input and the number of elements of REPLY containing returned data on output

This routine sends the specified command to the named service via the SYSREQ mechanism. One may also use the routine FMSREQ, which is part of the FATMEN [3] and resides in PACKLIB. This routine as the same calling sequence as SYSREQ, but provides automatic protection against network problems (timeouts etc.) with retry where required.  

IRC
Return status
0
Normal completion
2
Reply longer then LENREP. The COMMAND(LENREP) contains the command to issue to get the remaining part of the reply.

Example of using the SYSREQ routine

      CHARACTER*240 COMMAND
      CHARACTER*8   SERVICE
      INTEGER       IRC
      INTEGER       REPLEN
      PARAMETER     (REPLEN=100)
      CHARACTER*132 TMSREP(REPLEN)

      IRC = 0

      SERVICE = 'TMS'
      COMMAND = 'Q VID I29001 - I29010'
      LCOMM   = LENOCC(COMMAND)

 500  CONTINUE
      I = REPLEN
      CALL SYSREQ(SERVICE,COMMAND(1:LCOMM),IRC,TMSREP,I)

      DO 20 J=1,I-1
      WRITE (6,200) TMSREP(J)
 200  FORMAT(1X,A80)
 20   CONTINUE

      IF (IRC .EQ. 2) THEN
*
*     Reply exceeded buffer length. Print command that we
*     should issue to get remainder of reply
*
         COMMAND = TMSREP(I)
         LCOMM   = LENOCC(COMMAND)
         PRINT *,'Issuing ',COMMAND(1:LCOMM)
         GOTO 500
      ENDIF
C       Print the Last Line
      WRITE (6,200) TMSREP(I)

 9999 CONTINUE
      PRINT *,'SYSREQ(Fortran): RC(',IRC,')'

      END


Janne Saarela
Tue May 16 09:22:05 METDST 1995