
                               					 7-Jan-1983 13:29:00	VAX-11 FORTRAN V3.1-23              Page   1
								 3-Jan-1983 15:58:05	SYS$SYSROOT:[CAMAC.CTS]CTSSET.FOR;11        

0001    C+++
0002    C	CTSSET.FOR
0003    C
0004    C This module contains the SET subroutine for the CAMAC Topology Supervisor.
0005    C
0006    C The SET command requires a CAMAC Support Unit (CSU or crate) as a
0007    C parameter and can set the unit on-/off-line and enable/disable lam support.
0008    C If lam support is enabled, the station number of the lam grader may be
0009    C specified.
0010    C
0011    C LAM_SUPPORT=ENABLE and ONLINE may be specified in the same SET command, as
0012    C may LAM_SUPPORT=DISABLE and OFFLINE.
0013    C
0014    C
0015    C   Date	By		Comments
0016    C 10/07/82	D.E.Greenwood	Source moved from CTS.FOR; lam support added to
0017    C				command
0018    C  1/03/82	D.E.Greenwood	Calls to REPORT changed to 2 arguments
0019    C
0020    C---
0021    	SUBROUTINE SET
0022    C
0023    	CHARACTER CSU*10, LAM_STATION*10, SUPPORT_TYPE*20
0024    	INTEGER*2 CSU_LEN, IOSB(4), LAMG_N, LAM_STA_LEN
0025    	INTEGER*4 CAM$DABLAMS, CAM$ENLAMS, CAM$ERROR, ISTAT
0026    	INTEGER*4 CAM$CONL, CAM$COFL, CLI$PRESENT, GET_KEYWORD_VAL
0027    	PARAMETER Q=.TRUE., X=.TRUE.
0028    	PARAMETER LAM_KEYWRDS='DISABLE/ENABLE/OFF/ON'
0029    C
0030    C Get Camac Support Unit (crate number)
0031    C
0032    	CALL CLI$GET_VALUE('CSU',CSU)
0033    	CALL STR$TRIM(CSU,CSU,CSU_LEN)
0034    C
0035    C If LAM_SUPPORT qualifier was specified, make sure a legal value was given.
0036    C
0037    	IF (CLI$PRESENT('LAM_SUPPORT')) THEN
0038    	   IF (.NOT. GET_KEYWORD_VAL('LAM_SUPPORT', LAM_KEYWRDS, SUPPORT_TYPE))
0039         1		GOTO 89000
0040    	ENDIF
0041    C
0042    	ISTAT = 1
0043    	IOSB(1) = 1
0044    C
0045    C Disable lam support.
0046    C
0047    	IF (CLI$PRESENT('LAM_SUPPORT')) THEN
0048    	   IF (SUPPORT_TYPE .EQ. 'DISABLE' .OR. SUPPORT_TYPE .EQ. 'OFF') THEN
0049    		ISTAT =  CAM$DABLAMS(CSU(1:CSU_LEN),IOSB)
0050    		IF (CAM$ERROR(,,IOSB) .OR. .NOT. ISTAT) GOTO 80000
0051    	   ENDIF
0052    	ENDIF
0053    C
0054    C Set crate offline.
0055    C
0056    	IF (CLI$PRESENT('OFFLINE')) THEN
0057    	   ISTAT = CAM$COFL(CSU(1:CSU_LEN),IOSB)

SET                            					 7-Jan-1983 13:29:00	VAX-11 FORTRAN V3.1-23              Page   2
								 3-Jan-1983 15:58:05	SYS$SYSROOT:[CAMAC.CTS]CTSSET.FOR;11        

0058    	   IF (CAM$ERROR(X,,IOSB) .OR. .NOT. ISTAT) GOTO 80000
0059    	ENDIF
0060    C
0061    C Set crate online.
0062    C
0063    	IF (CLI$PRESENT('ONLINE')) THEN
0064    	   ISTAT = CAM$CONL(CSU(1:CSU_LEN),IOSB)
0065    	   IF (CAM$ERROR(X,,IOSB) .OR. .NOT. ISTAT) GOTO 80000
0066    	ENDIF
0067    C
0068    C Enable Lam support.
0069    C
0070    	IF (CLI$PRESENT('LAM_SUPPORT')) THEN
0071    	   IF (SUPPORT_TYPE .EQ. 'ENABLE' .OR. SUPPORT_TYPE .EQ. 'ON') THEN
0072    		CALL CLI$GET_VALUE('STATION',LAM_STATION)
0073    		IF (LAM_STATION(1:1) .EQ. 'N') LAM_STATION = LAM_STATION(2:)
0074    		CALL STR$TRIM(LAM_STATION,LAM_STATION,LAM_STA_LEN)
0075    		DECODE (LAM_STA_LEN,90000,LAM_STATION,ERR=88000) LAMG_N
0076    		ISTAT = CAM$ENLAMS(CSU(1:CSU_LEN), %VAL(LAMG_N), IOSB)
0077    		IF (CAM$ERROR(X,Q,IOSB) .OR. .NOT. ISTAT) GOTO 80000
0078    	   ENDIF
0079    	ENDIF
0080    C
0081    	GOTO 89000
0082    C
0083    C Error reporting
0084    C
0085    80000	IF (ISTAT) THEN
0086    	  IF (CAM$ERROR(X,,IOSB)) CALL CAM$SHOW_STAT(IOSB)
0087    	ELSE
0088    	  CALL REPORT(' ', ISTAT)
0089    	END IF
0090    	GOTO 89000
0091    C
0092    88000	TYPE *, '%CTS-W-ILLSTA, illegal station number'
0093    C
0094    89000	RETURN
0095    C
0096    C
0097    90000	FORMAT(I)
0098    	END

SET                            					 7-Jan-1983 13:29:00	VAX-11 FORTRAN V3.1-23              Page   3
								 3-Jan-1983 15:58:05	SYS$SYSROOT:[CAMAC.CTS]CTSSET.FOR;11        

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  484   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                 124   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 364   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  972


ENTRY POINTS

    Address  Type  Name          

  0-00000000       SET           


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-00000008  CHAR CSU             2-00000030  I*2  CSU_LEN         2-00000038  I*4  ISTAT           2-00000032  I*2  LAMG_N        
  2-00000012  CHAR LAM_STATION     2-00000034  I*2  LAM_STA_LEN     2-0000001C  CHAR SUPPORT_TYPE  


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  2-00000000  I*2  IOSB                    8  (4)


LABELS

    Address   Label       Address   Label       Address   Label       Address   Label   

  0-000001A2  80000     0-000001C7  88000     0-000001E3  89000     1-00000068  90000'  


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

   I*4  CAM$COFL                           I*4  CAM$CONL                           I*4  CAM$DABLAMS                     
   I*4  CAM$ENLAMS                         I*4  CAM$ERROR                               CAM$SHOW_STAT                   
        CLI$GET_VALUE                      I*4  CLI$PRESENT                        I*4  GET_KEYWORD_VAL                 
        REPORT                                  STR$TRIM                        

SET                            					 7-Jan-1983 13:29:00	VAX-11 FORTRAN V3.1-23              Page   4
								 3-Jan-1983 15:58:05	SYS$SYSROOT:[CAMAC.CTS]CTSSET.FOR;11        

COMMAND QUALIFIERS

  FORTRAN /LIS CTS,CTSASSIGN,CTSDEASGN,CTSMODIFY,CTSSET,CTSSHOW,WCCOPY,WCMATCH

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /STANDARD=(NOSYNTAX,NOSOURCE_FORM)
  /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP)
  /F77  /NOG_FLOATING  /I4  /OPTIMIZE  /WARNINGS  /NOD_LINES  /NOCROSS_REFERENCE  /NOMACHINE_CODE  /CONTINUATIONS=19


COMPILATION STATISTICS

  Run Time:           1.44 seconds
  Elapsed Time:       1.70 seconds
  Page Faults:        0
  Dynamic Memory:     382 pages
