Google
 

Trailing-Edge - PDP-10 Archives - FORTRAN-10_V7wLink_Feb83 - substr.for
There are 9 other files named substr.for in the archive. Click here to see a list.
	PROGRAM SUBSTR

C THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
C   OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
C 
C COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1983

C	Jan-82
C	CDM

C	Tests character data
C	Substring

	CHARACTER*2 CHAR1*7,CHAR2,CHAR3*10,CHAR4(3,3)*7
	CHARACTER CHAR5(5)*5,CHAR6

C-100-	Substring tests
C	In logical comparison

	CHAR1='Boscone'
	CHAR2='co'

	IF (CHAR1(4:5) .NE. CHAR2) TYPE 100, CHAR1(4:5),CHAR2
100	FORMAT(' ?Error 100. CHAR1(4:5)='A10', CHAR2='A2)

C-200-	In assignment

	CHAR3='ABCDEFGHIJ'
	CHAR3(5:8)=CHAR3(3:10)

	IF (CHAR3 .NE. 'ABCDCDEFIJ') TYPE 200,CHAR3
200	FORMAT(' ?Error 200. CHAR3(3:10)='A10', should = ',
	1 '''ABCDCDEFIJ''')

C-300-	Of array

	CHAR4(2,3)='NMOPQRSTUV'
	CHAR5(3)='WXYZABC'
C	'MOP' // 'XYZA'
	CHAR4(2,3)=CHAR4(2,3)(2:4) // CHAR5(3)(2:5)

	IF (CHAR4(2,3)(2:5) .NE. 'OPXY') TYPE 300,CHAR4(2,3)(2:5)
300	FORMAT(' ?Error 300. CHAR4(2,3)(2:5) ='A4', should = ',
	1 '''OPXY''')

C-400-	On left of assignment with array

	CHAR4(2,3)(2:4)='POW'

	IF (CHAR4(2,3) .NE. 'MPOWYZA') TYPE 400,CHAR4(2,3)
400	FORMAT(' ?Error 400. CHAR4(2,3)='A10', should = ''MPOWYZA''')

	STOP
	END