
                               					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   1
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0001    C+++
0002    C
0003    C	Modify Subroutine for CAMAC Topology Supervisor
0004    C
0005    C This routine is called in response to the CTS command MODIFY.
0006    C
0007    C
0008    C   Date	By		Comments
0009    C		D.E.Greenwood	Original
0010    C  1/05/83	D.E.Greenwood	Wildcard changes permitted;  /[NO]PHYSICAL,
0011    C				/[NO]LOG, /BRANCH, /CRATE and /HIGHWAY
0012    C				switches added
0013    C  2/17/83	D.E.Greenwood	Correction to update system logical name in
0014    C				addition to database when physical specification
0015    C				is modified;  documentation updates
0016    C
0017    C---
0018    C
0019    	SUBROUTINE MODIFY
0020    C
0021    	IMPLICIT NONE
0022    C
0023    	CHARACTER MATCH*32, MIN_MATCH*32, PHY_SPECIFIER*32
0024    	INTEGER*2 LOG_LEN, MATCH_LEN, MIN_MATCH_LEN, PHY_SPEC_LEN,
0025         &		PRCNT_LOC, STAR_LOC
0026    	INTEGER*4 CLI$GET_VALUE, CLI$PRESENT, MODIFY_ONE_REC, WCMATCH
0027    	LOGICAL ANY_MATCHES, LOG_CHANGES
0028    C
0029    	INCLUDE 'CTSDEF'
0072    C
0073    	COMMON /CTS_MODIFY/ MATCH, MATCH_LEN, CAMDEF_RECORD, CSU_NAME, PHY_MOD
0074    C
0075    	LOG_CHANGES = CLI$PRESENT('LOG')
0076    C
0077    C Get the (next) match specification and determine the minimum number of
0078    C characters required for a match.  The minimum match string is used to
0079    C minimize the number of file reads we do while searching for records which
0080    C fit the complete match pattern.
0081    C
0082    	DO WHILE (CLI$GET_VALUE('NAME', MATCH))
0083    	    CALL STR$UPCASE(MATCH, MATCH)
0084    	    CALL STR$TRIM( MATCH, MATCH, MATCH_LEN)		! get length
0085    	    STAR_LOC = INDEX(MATCH, '*')			! min. match str.
0086    	    PRCNT_LOC = INDEX( MATCH, '%')			!  is the part
0087    	    MIN_MATCH_LEN = MATCH_LEN				!  of the match
0088    	    IF (STAR_LOC .GT. 0) MIN_MATCH_LEN = STAR_LOC - 1	!  string before
0089    	    IF (PRCNT_LOC .GT. 0 .AND. PRCNT_LOC-1 .LT. MIN_MATCH_LEN)	!  the
0090         &			MIN_MATCH_LEN = PRCNT_LOC - 1		!  1st wildcard
0091    	    MIN_MATCH = MATCH(1:MIN_MATCH_LEN)			!  character
0092    	    IF (MIN_MATCH_LEN .EQ. 0) MIN_MATCH = ' '
0093    C
0094    	    ANY_MATCHES = .FALSE.
0095    	    IF (CLI$PRESENT('PHYSICAL')) THEN
0096    C
0097    C /PHYSICAL specified, search for a match on the physical specifier
0098    C
0099    		IF (MIN_MATCH_LEN .GT. 3) THEN		! this kluge insures that

MODIFY                         					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   2
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0100    		    MIN_MATCH_LEN = 3			!  match specs which
0101    		    MIN_MATCH(4:) = ' '			!  include crate nos work
0102    		ENDIF					!  correctly (at the cost
0103    							!  of extra file reads)
0104    		READ (1,KEYGE=MIN_MATCH(1:11),KEYID=1,ERR=18050) CAMDEF_RECORD
0105    		DO WHILE (.TRUE.)
0106    		    CALL MAKE_SPECIFIER( CAMDEF_RECORD, PHY_SPECIFIER)
0107    		    IF (MIN_MATCH_LEN .GT. 0 .AND.
0108         &			PHY_SPECIFIER(1:MIN_MATCH_LEN) .NE.
0109         &			MIN_MATCH(1:MIN_MATCH_LEN)) GOTO 18000
0110    		    CALL STR$TRIM( PHY_SPECIFIER, PHY_SPECIFIER, PHY_SPEC_LEN)
0111    		    IF (MATCH_LEN .EQ. 0 .OR.
0112         &			WCMATCH( MATCH(1:MATCH_LEN),
0113         &				PHY_SPECIFIER(1:PHY_SPEC_LEN)))
0114         &			THEN
0115    			    IF (.NOT. MODIFY_ONE_REC('PHYSICAL',LOG_CHANGES))
0116         &				RETURN
0117    			    ANY_MATCHES = .TRUE.
0118    		    ENDIF
0119    		    READ (1,END=18050) CAMDEF_RECORD
0120    C
0121    		ENDDO			! end of physical spec match loop
0122    C
0123    18000		UNLOCK (1)
0124    18050		IF (.NOT. ANY_MATCHES) TYPE *, 'No physical spec. matches ',
0125         &			MATCH(1:MATCH_LEN)
0126    C
0127    	    ELSE
0128    C
0129    C Search for match on logical name
0130    C
0131    		READ (1,KEYGE=MIN_MATCH,KEYID=0,ERR=28000) CAMDEF_RECORD
0132    		DO WHILE (MIN_MATCH_LEN .EQ. 0 .OR.
0133         &			LOGICAL_NAME(1:MIN_MATCH_LEN) .EQ. MIN_MATCH)
0134    		    CALL STR$TRIM( LOGICAL_NAME, LOGICAL_NAME, LOG_LEN)
0135    		    IF (MATCH_LEN .EQ. 0 .OR.
0136         &			WCMATCH(MATCH(1:MATCH_LEN),LOGICAL_NAME(1:LOG_LEN)))
0137         &			THEN
0138    			    IF (.NOT. MODIFY_ONE_REC('LOGICAL',LOG_CHANGES))
0139         &				RETURN
0140    			    ANY_MATCHES = .TRUE.
0141    		    ENDIF
0142    		    READ (1,END=28000) CAMDEF_RECORD
0143    C
0144    		ENDDO			! end of logical name match loop
0145    		UNLOCK (1)
0146    C
0147    28000		IF (.NOT. ANY_MATCHES) TYPE *, 'No logical name matches ',
0148         &			MATCH(1:MATCH_LEN)
0149    	    ENDIF			! end of log./phy. if-then-else
0150    C
0151    	ENDDO				! end of list of match strings loop
0152    	RETURN
0153    C
0154    	END

MODIFY                         					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   3
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  686   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                  80   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 384   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 CTS_MODIFY                             176   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                 1326


ENTRY POINTS

    Address  Type  Name          

  0-00000000       MODIFY        


VARIABLES

    Address  Type  Name                                Address  Type  Name                            

  2-0000004C  L*4  ANY_MATCHES                       3-00000022  CHAR CAMDEF_RECORD                   
  3-00000057  CHAR COMMENT                           3-0000004B  CHAR CR_COLON                        
  3-00000046  CHAR CSU                               3-00000048  CHAR CSU_CONTROLLER                  
  3-00000046  CHAR CSU_DEVICE                        3-0000009A  CHAR CSU_NAME                        
  3-00000049  CHAR CSU_UNIT                          3-00000022  CHAR LOGICAL_NAME                    
  2-00000050  L*4  LOG_CHANGES                       2-00000040  I*2  LOG_LEN                         
  3-00000000  CHAR MATCH                             3-00000020  I*2  MATCH_LEN                       
  2-00000000  CHAR MIN_MATCH                         2-00000042  I*2  MIN_MATCH_LEN                   
  2-00000020  CHAR PHY_SPECIFIER                     2-00000044  I*2  PHY_SPEC_LEN                    
  3-000000A0  I*4  PM_RUG                            3-000000A4  I*4  PM_RUM                          
  3-000000AC  I*4  PM_STATION                        3-000000A8  I*4  PM_UNIT                         
  2-00000046  I*2  PRCNT_LOC                         3-0000004F  I*4  REF_UIC_GROUP                   
  3-00000053  I*4  REF_UIC_MEMBER                    3-00000046  CHAR SPECIFIER                       
  2-00000048  I*2  STAR_LOC                          3-0000004C  CHAR STATION                         


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  3-000000A0  I*4  PHY_MOD                16  (4)


LABELS

    Address   Label       Address   Label       Address   Label   

  0-0000016B  18000     0-00000174  18050     0-0000026B  28000   

MODIFY                         					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   4
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

   I*4  CLI$GET_VALUE                      I*4  CLI$PRESENT                        I*4  LIB$INDEX                       
        MAKE_SPECIFIER                     I*4  MODIFY_ONE_REC                          STR$TRIM                        
        STR$UPCASE                         I*4  WCMATCH                         

                               					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   5
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0001    	INTEGER*4 FUNCTION MODIFY_ONE_REC( SEARCH_ORDER, LOG_CHANGES )
0002    C
0003    C This subroutine modifies a single record in the data base.  The record to be
0004    C changed is passed via the common area CTS_MODIFY.  A call is made to a CLI
0005    C routine for each part of the record which may be changed.  The calling
0006    C parameters are:
0007    C
0008    C	SEARCH_ORDER	char. string indicating whether we are search via
0009    C			logical name ('LOGICAL') or physical specification
0010    C			('PHYSICAL')
0011    C	LOG_CHANGES	is a logical variable indicating whether changes are
0012    C			to be logged to the terminal
0013    C
0014    C
0015    C The basic idea for making modifications is to test each possible MODIFY command
0016    C switch.  When we find one which has been specified, we put its value into the
0017    C string VALUE and trim it to find its real length.  If the switch will cause a
0018    C change to the physical specifier, we patch the value into the string
0019    C PHY_SPECIFIER (which contains the current physical specifier string) and
0020    C pass it to CAM$PHYMOD.  That subroutine verifies the legality of the physical
0021    C specifier and parses it into the character string CSU_NAME and the array
0022    C PHY_MOD.  Thus, PHY_SPECIFIER and, together, CSU_NAME and PHY_MOD contain the
0023    C most up-to-date physical specifier info.
0024    C
0025    	IMPLICIT NONE
0026    C
0027    	INTEGER*4 CAM$PHYMOD, CLI$GET_VALUE, CLI$PRESENT, SYS$CRELOG,
0028         &		SYS$DELLOG, SYS$TRNLOG, WCCOPY
0029    	INTEGER*4 ISTAT
0030    	LOGICAL LOG_CHANGES, LOG_NAM_CHNG, PHY_MOD_CHNG
0031    	INTEGER*2 COLON_LOC, DOT_LOC, LOG_NAM_LEN, MATCH_LEN, NEW_LOG_LEN,
0032         &		OLD_LOG_LEN, OLD_PHY_LEN, PHY_SPEC_LEN, STATION_LOC,
0033         &		TEMP_NUM, VALUE_LEN
0034    	CHARACTER MATCH*32, MIN_MATCH*32, NEW_LOG_NAM*32, OLD_LOG_NAM*32,
0035         &		OLD_PHY_SPEC*32, PHY_SPECIFIER*32, SEARCH_ORDER*(*), VALUE*40
0036    	EXTERNAL CLI$_NEGATED
0037    C
0038    	INCLUDE 'CTSDEF'
0081    	INCLUDE '($SSDEF)'
0472    C
0473    	COMMON /CTS_MODIFY/ MATCH, MATCH_LEN, CAMDEF_RECORD, CSU_NAME, PHY_MOD
0474    C
0475    	LOG_NAM_CHNG = .FALSE.
0476    	PHY_MOD_CHNG = .FALSE.
0477    	CALL MAKE_FULL_SPEC(CAMDEF_RECORD, PHY_SPECIFIER, PHY_SPEC_LEN)
0478    	CALL STR$TRIM( OLD_LOG_NAM, LOGICAL_NAME, LOG_NAM_LEN)
0479    	OLD_LOG_LEN = LOG_NAM_LEN
0480    	OLD_PHY_SPEC = PHY_SPECIFIER
0481    	OLD_PHY_LEN = PHY_SPEC_LEN
0482    C
0483    C May want to change the camac highway BRANCH
0484    C
0485    	IF (CLI$GET_VALUE( 'BRANCH', VALUE)) THEN
0486    	    CALL STR$TRIM( VALUE, VALUE, VALUE_LEN)
0487    	    PHY_SPECIFIER =
0488         &		PHY_SPECIFIER(1:2)//VALUE(1:VALUE_LEN)//PHY_SPECIFIER(4:)
0489    	    CALL STR$TRIM(PHY_SPECIFIER, PHY_SPECIFIER, PHY_SPEC_LEN)

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   6
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0490    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0491    	    IF (ISTAT) THEN
0492    		PHY_MOD_CHNG = .TRUE.
0493    	    ELSE
0494    		TYPE *, 'Illegal branch'
0495    		GOTO 89000
0496    	    ENDIF
0497    	ENDIF
0498    C
0499    C May want to replace or delete the COMMENT.
0500    C
0501    	IF (CLI$PRESENT('COMMENT')) CALL CLI$GET_VALUE('COMMENT',COMMENT)
0502    	IF (CLI$PRESENT('COMMENT') .EQ. %LOC(CLI$_NEGATED)) COMMENT = ' '
0503    C
0504    C May want to change the camac CRATE number.
0505    C
0506    	IF (CLI$GET_VALUE( 'CRATE', VALUE)) THEN
0507    	    CALL STR$TRIM( VALUE, VALUE, VALUE_LEN)
0508    	    COLON_LOC = INDEX( PHY_SPECIFIER, ':')
0509    	    PHY_SPECIFIER =
0510         &		PHY_SPECIFIER(1:3)//VALUE(1:VALUE_LEN)//
0511         &		PHY_SPECIFIER(COLON_LOC:)
0512    	    CALL STR$TRIM(PHY_SPECIFIER, PHY_SPECIFIER, PHY_SPEC_LEN)
0513    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0514    	    IF (ISTAT) THEN
0515    		PHY_MOD_CHNG = .TRUE.
0516    	    ELSE
0517    		TYPE *, 'Illegal crate'
0518    		GOTO 89000
0519    	    ENDIF
0520    	ENDIF
0521    C
0522    C May want to replace the entire CSU
0523    C
0524    	IF (CLI$GET_VALUE('CSU',VALUE)) THEN
0525    	    CALL STR$TRIM(VALUE,VALUE,VALUE_LEN)
0526    	    IF (VALUE(VALUE_LEN:) .EQ. ':') VALUE_LEN = VALUE_LEN-1
0527    	    COLON_LOC = INDEX(PHY_SPECIFIER,':')
0528    	    PHY_SPECIFIER = VALUE(1:VALUE_LEN)//PHY_SPECIFIER(COLON_LOC:)
0529    	    CALL STR$TRIM(PHY_SPECIFIER,PHY_SPECIFIER,PHY_SPEC_LEN)
0530    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0531    	    IF (ISTAT) THEN
0532    		PHY_MOD_CHNG = .TRUE.
0533    	    ELSE
0534    		TYPE *,'Illegal csu'
0535    		GOTO 89000
0536    	    END IF
0537    	END IF
0538    C
0539    C May want to change the camac HIGHWAY.
0540    C
0541    	IF (CLI$GET_VALUE( 'HIGHWAY', VALUE)) THEN
0542    	    CALL STR$TRIM( VALUE, VALUE, VALUE_LEN)
0543    	    PHY_SPECIFIER = VALUE(1:VALUE_LEN)//PHY_SPECIFIER(3:)
0544    	    CALL STR$TRIM(PHY_SPECIFIER, PHY_SPECIFIER, PHY_SPEC_LEN)
0545    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0546    	    IF (ISTAT) THEN

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   7
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0547    		PHY_MOD_CHNG = .TRUE.
0548    	    ELSE
0549    		TYPE *, 'Illegal highway'
0550    		GOTO 89000
0551    	    ENDIF
0552    	ENDIF
0553    C
0554    C May want to change the LOGICAL NAME.  The manner in which we do the rename 
0555    C depends on whether we are searching modules in logical name or physical spec.
0556    C order.  If we're doing the search by logical name, we do a wildcard rename.
0557    C Otherwise, we simply replace the logical name with the one specified.
0558    C
0559    	IF (CLI$GET_VALUE('LOGICAL_NAME',VALUE)) THEN
0560    	    CALL STR$TRIM(VALUE,VALUE,VALUE_LEN)
0561    	    IF (SEARCH_ORDER .EQ. 'LOGICAL') THEN
0562    		IF (.NOT. WCCOPY(MATCH(1:MATCH_LEN),
0563         &			LOGICAL_NAME(1:LOG_NAM_LEN), VALUE(1:VALUE_LEN),
0564         &			NEW_LOG_NAM, NEW_LOG_LEN)) THEN
0565    		    TYPE *, 'Internal CTS error'
0566    		    GOTO 89000
0567    		ENDIF
0568    	    ELSE
0569    		IF (INDEX(VALUE(1:VALUE_LEN),'*') .GT. 0 .OR.
0570         &			INDEX(VALUE(1:VALUE_LEN),'%') .GT. 0) THEN
0571    		    TYPE *, 'Illegal use of wildcard char. in logical name'
0572    		    GOTO 89000
0573    		ENDIF
0574    		NEW_LOG_NAM = VALUE
0575    		NEW_LOG_LEN = VALUE_LEN
0576    	    ENDIF
0577    	    IF (NEW_LOG_NAM .NE. LOGICAL_NAME) THEN
0578    		ISTAT = SYS$TRNLOG(NEW_LOG_NAM(1:NEW_LOG_LEN),,
0579         &			NEW_LOG_NAM,,,6)
0580    		IF (ISTAT .EQ. SS$_NOTRAN) THEN
0581    		    LOGICAL_NAME = NEW_LOG_NAM
0582    		    LOG_NAM_CHNG = .TRUE.
0583    		ELSE IF (ISTAT .EQ. SS$_NORMAL .OR.
0584         &			 ISTAT .EQ. SS$_RESULTOVF) THEN
0585    		    TYPE *, 'Logical name already in use'
0586    		    GOTO 89100
0587    	    	ELSE
0588    		    CALL REPORT(' ', ISTAT)
0589    		    GOTO 89000
0590    		END IF
0591    	    END IF
0592    	END IF
0593    C
0594    C May want to change the REFERENCE UIC.
0595    C
0596    	ISTAT = CLI$PRESENT('REFERENCE_UIC')
0597    	IF (ISTAT .OR. ISTAT .EQ. %LOC(CLI$_NEGATED)) THEN
0598    	    CALL GET_REF_UIC(PHY_SPECIFIER,PHY_SPEC_LEN)
0599    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0600    	    IF (ISTAT) THEN
0601    		PHY_MOD_CHNG = .TRUE.
0602    	    ELSE
0603    		TYPE *,'Illegal reference uic'

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   8
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0604    		GOTO 89000
0605    	    END IF
0606    	END IF
0607    C
0608    C May want to change the STATION number.
0609    C
0610    	IF (CLI$GET_VALUE('STATION',VALUE)) THEN
0611    	    IF (VALUE(1:1) .NE. 'N') VALUE = 'N'//VALUE
0612    	    STATION_LOC = INDEX(PHY_SPECIFIER,']')
0613    	    IF (STATION_LOC .EQ. 0) STATION_LOC = INDEX(PHY_SPECIFIER,':')
0614    	    PHY_SPECIFIER = PHY_SPECIFIER(1:STATION_LOC)//VALUE
0615    	    CALL STR$TRIM(PHY_SPECIFIER,PHY_SPECIFIER,PHY_SPEC_LEN)
0616    	    ISTAT = CAM$PHYMOD(PHY_SPECIFIER(1:PHY_SPEC_LEN),CSU_NAME,PHY_MOD)
0617    	    IF (ISTAT) THEN
0618    		PHY_MOD_CHNG = .TRUE.
0619    		ELSE
0620    	    TYPE *,'Illegal station'
0621    		GOTO 89000
0622    	    END IF
0623    	END IF
0624    C
0625    C Done - rewrite the record
0626    C
0627    C ...first, incorporate any changes to the physical specifier into our copy
0628    C    of the data base record (CAMDEF_RECORD).
0629    C
0630    	IF (PHY_MOD_CHNG) CALL MAKE_PHY_REC(CSU_NAME,PHY_MOD,CAMDEF_RECORD)
0631    C
0632    C ...if any change (other than to the comment string) was made, we must
0633    C    update the system logical name table.  Note that interpretation of the
0634    C    CRELOG status code depends on whether the logical name was changed.  Also
0635    C    note that the old logical name need be deleted only when the name is
0636    C    changed...
0637    C
0638    	IF (PHY_MOD_CHNG .OR. LOG_NAM_CHNG) THEN
0639    	    CALL STR$TRIM( LOGICAL_NAME, LOGICAL_NAME, LOG_NAM_LEN)
0640    	    ISTAT = SYS$CRELOG( %VAL(0), LOGICAL_NAME(1:LOG_NAM_LEN),
0641         &		PHY_SPECIFIER(1:PHY_SPEC_LEN),)
0642    	    IF (LOG_NAM_CHNG) THEN
0643    		IF (ISTAT .NE. SS$_NORMAL) GOTO 88000
0644    		ISTAT = SYS$DELLOG( %VAL(0), OLD_LOG_NAM(1:OLD_LOG_LEN),)
0645    		IF (ISTAT .EQ. SS$_NOLOGNAM) THEN
0646    		    TYPE *, 'Warning - '//OLD_LOG_NAM(1:OLD_LOG_LEN)//
0647         &			' was not found in system logical name table'
0648    		ELSE IF (ISTAT .NE. SS$_NORMAL) THEN
0649    		    CALL REPORT( 'Error deleting '//OLD_LOG_NAM(1:OLD_LOG_LEN)
0650         &			//' from system logical name table: ', ISTAT)
0651    		ENDIF
0652    	    ELSE
0653    		IF (ISTAT .EQ. SS$_NORMAL) THEN
0654    		    TYPE *, 'Warning - '//OLD_LOG_NAM(1:OLD_LOG_LEN)//
0655         &			' was not found in system logical name table'
0656    		ELSE IF (ISTAT .NE. SS$_SUPERSEDE) THEN
0657    		    GOTO 88000
0658    		ENDIF
0659    	    ENDIF
0660    	ENDIF

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page   9
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

0661    C
0662    C ...create the updated record - the logical name is the primary key, so if
0663    C    the logical name was changed we must delete the old record and write a
0664    C    new one...
0665    C
0666    	IF (LOG_NAM_CHNG) THEN
0667    	    DELETE (1)
0668    	    WRITE (1) CAMDEF_RECORD
0669    	ELSE
0670    	    REWRITE (1) CAMDEF_RECORD
0671    	END IF
0672    C
0673    C ...finally, if changes were made to the logical name or physical specification
0674    C    and we were so requested, log the changes...
0675    C
0676    	IF (LOG_CHANGES .AND. (PHY_MOD_CHNG .OR. LOG_NAM_CHNG)) THEN
0677    	    CALL MAKE_FULL_SPEC(CAMDEF_RECORD,PHY_SPECIFIER,PHY_SPEC_LEN)
0678    	    TYPE *, ' ', OLD_LOG_NAM(1:OLD_LOG_LEN),
0679         &		' ('//OLD_PHY_SPEC(1:OLD_PHY_LEN)//')',' changed to ',
0680         &		LOGICAL_NAME(1:LOG_NAM_LEN),
0681         &		' ('//PHY_SPECIFIER(1:PHY_SPEC_LEN)//')'
0682    	END IF
0683    	GOTO 89100
0684    C
0685    C Error creating new logical name
0686    C
0687    88000	CALL REPORT('Error assigning logical name '//
0688         &		LOGICAL_NAME(1:LOG_NAM_LEN)//' - ',ISTAT)
0689    C
0690    C Exit
0691    C
0692    89000	MODIFY_ONE_REC = 0			! error return
0693    	GOTO 89900
0694    89100	MODIFY_ONE_REC = 1			! success
0695    89900	RETURN
0696    	END

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page  10
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                 2151   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                 413   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 944   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 CTS_MODIFY                             176   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                 3684


ENTRY POINTS

    Address  Type  Name                            

  0-00000000  I*4  MODIFY_ONE_REC                  


VARIABLES

    Address  Type  Name                                Address  Type  Name                            

  3-00000022  CHAR CAMDEF_RECORD                     2-000000C8  I*2  COLON_LOC                       
  3-00000057  CHAR COMMENT                           3-0000004B  CHAR CR_COLON                        
  3-00000046  CHAR CSU                               3-00000048  CHAR CSU_CONTROLLER                  
  3-00000046  CHAR CSU_DEVICE                        3-0000009A  CHAR CSU_NAME                        
  3-00000049  CHAR CSU_UNIT                          2-000000CA  I*2  DOT_LOC                         
  2-000000E0  I*4  ISTAT                             3-00000022  CHAR LOGICAL_NAME                    
 AP-00000008@ L*4  LOG_CHANGES                       2-000000E4  L*4  LOG_NAM_CHNG                    
  2-000000CC  I*2  LOG_NAM_LEN                       3-00000000  CHAR MATCH                           
  3-00000020  I*2  MATCH_LEN                         2-00000000  CHAR MIN_MATCH                       
  2-000000CE  I*2  NEW_LOG_LEN                       2-00000020  CHAR NEW_LOG_NAM                     
  2-000000D0  I*2  OLD_LOG_LEN                       2-00000040  CHAR OLD_LOG_NAM                     
  2-000000D2  I*2  OLD_PHY_LEN                       2-00000060  CHAR OLD_PHY_SPEC                    
  2-000000E8  L*4  PHY_MOD_CHNG                      2-00000080  CHAR PHY_SPECIFIER                   
  2-000000D4  I*2  PHY_SPEC_LEN                      3-000000A0  I*4  PM_RUG                          
  3-000000A4  I*4  PM_RUM                            3-000000AC  I*4  PM_STATION                      
  3-000000A8  I*4  PM_UNIT                           3-0000004F  I*4  REF_UIC_GROUP                   
  3-00000053  I*4  REF_UIC_MEMBER                   AP-00000004@ CHAR SEARCH_ORDER                    
  3-00000046  CHAR SPECIFIER                         3-0000004C  CHAR STATION                         
  2-000000D6  I*2  STATION_LOC                       2-000000D8  I*2  TEMP_NUM                        
  2-000000A0  CHAR VALUE                             2-000000DA  I*2  VALUE_LEN                       


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  3-000000A0  I*4  PHY_MOD                16  (4)

MODIFY_ONE_REC                 					17-Feb-1983 10:08:24	VAX-11 FORTRAN V3.1-23              Page  11
								17-Feb-1983 09:39:26	SYS$SYSROOT:[CAMAC.CTS]CTSMODIFY.FOR;55     

LABELS

    Address   Label       Address   Label       Address   Label       Address   Label   

  0-0000080F  88000     0-00000859  89000     0-0000085E  89100     0-00000862  89900   


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

   I*4  CAM$PHYMOD                         I*4  CLI$GET_VALUE                      I*4  CLI$PRESENT                     
        CLI$_NEGATED                            GET_REF_UIC                        I*4  LIB$INDEX                       
        MAKE_FULL_SPEC                          MAKE_PHY_REC                            REPORT                          
        STR$TRIM                           I*4  SYS$CRELOG                         I*4  SYS$DELLOG                      
   I*4  SYS$TRNLOG                         I*4  WCCOPY                          


COMMAND QUALIFIERS

  FORTRAN /LIS/NOOBJ CTSMODIFY

  /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:           9.45 seconds
  Elapsed Time:       10.77 seconds
  Page Faults:        620
  Dynamic Memory:     334 pages
