From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-APR-1991 19:34:27.32
To:	ARISIA::EVERHART
CC:	
Subj:	FYI. DCL DECnet programming can fail for some calling PIDs

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA11403; Fri, 19 Apr 91 19:17:42 EDT
Received: From SLCS.SLB.COM by CRVAX.SRI.COM with TCP; Fri, 19 APR 91 08:00:21 PDT
Received: from sjosu1.sinet.slb.com ([129.87.118.1])
	by SLCS.SLB.COM (4.1/SLCS Mailhost 3.13)
	id AA26095; Fri, 19 Apr 91 10:01:34 CDT
Received: from epsx25.psi by sjosu1.sinet.slb.com (4.0/SINet-4.0.3a)
	id AA27691; Fri, 19 Apr 91 08:04:24 PDT
Date: Fri, 19 Apr 91 08:04:24 PDT
From: barbe@epsx25.SINet.SLB.COM (Claude Barbe - EPSchlumberger 33-1-4537-2171)
Message-Id: <9104191504.AA27691@sjosu1.sinet.slb.com>
To: info-vax@sri.com
X-Vms-To: PSI%SJOSU1::SRI.COM::INFO-VAX
X-Vms-From: BARBE        "Claude Barbe - EPSchlumberger 33-1-4537-2171"
Subject: FYI. DCL DECnet programming can fail for some calling PIDs

The following describes a problem that may happen any time with regular
DECnet programming.

SYMPTOM:

	Some processes will ALWAYS fail to communicate with a DECnet process
	that they create if the DECnet process is a DCL procedure that opens
	SYS$NET.  The calling process may be in DCL or in HLL using RMS.

	The NETSERVER.LOG shows:

		$ SET VERIFY
		$ CLOSE/NOLOG F			! Defensive programming
		$ OPEN/READ/WRITE F SYS$NET
		%DCL-E-OPENIN, error opening ALIAS::"0=USER/N"!@3
                                                TESTRTICOM" as input
		-RMS-F-SYN, file specification syntax error
		POOR_USER         job terminated at 1-APR-1991 12:34:56.00

	In another NETSERVER.LOG we included:
		$ A = F$TRNLNM("SYS$NET")
		$ SHOW SYMBOL A
		  A = "ALIAS::"0=USER/NA."!@3...............TESTRTICOM""

DIAGNOSIS:

	SYS$NET contains an isolated double-quote inside the quoted string
	The isolated quoted string is the ASCII representation of a byte
	of the PID of the calling process which happened to be 33402122
	which dumps in ASCII as "!@3.  22 is the problem (the french say
	22! the cops!!!).

TESTED FIX:

	Double all double-quotes after '::"' and before the final '"'
	like this:

 $ b = f$trnlnm("sys$net")
 $!show symbol b
 $ a = ""
 $ j = 0
 $lpa: i = f$locate("""",b)
 $   a = a + f$extract(0,i,b)
 $   if i.ge.f$length(b) then goto lpax
 $   b = f$extract(i+1,f$length(b)-i-1,b)        ! use the rest next time
 $   if j.eq.0   ! first " after :: is OK
 $   then
 $     if f$length(a).gt.2 then if f$extract(f$length(a)-2,2,a).nes."::" then -
 $     j = -1
 $     if j.lt.0 then -
       a = a + """"      ! double before :: (not sure how it would happen)
 $     a = a + """"      ! copy the " anyway
 $   else
 $     if f$length(b).ne.0 then -
       a = a + """"      ! do not double terminal "
 $     a = a + """"      ! copy the " anyway
 $   endif
 $   j = j + 1
 $ goto lpa
 $lpax:! show symbol a
 $ CLOSE/NOLOG F
 $ OPEN/READ/WRITE F &A

