Connect:Direct syntax on IBM z/OS Mainframe
<p>I am writing a C# program to parse a Connect:Direct file and extract from it source and destination information.</p>

<p>I am not very fluent with Mainframe code. In particular, I am trying to understand the syntax of the destination Windows path.  The following is my interpretation but there are holes that I want to fill in order to write a parser that is able to handle any valid syntax variation that I may encounter.</p>

<p>The backslash character must be an escape character, so that two backslashes represent one. However the concatenation operation, || , seems to throw a monkey wrench in that. I presume that the slash character is the line continuation character. The quoted path also is enclosed with a backslash on each side. I'm not sure what this indicates. I'm guessing that it may mean that the enclosed string contains escape characters, suggesting that two backslashes should equal one.</p>

<pre><code>NDMHGM30 PROCESS  SNODE=MYSNODE PACCT='G,HG1'                  -
 &amp;SUBS=SUBSYS(ESP2)                                                 -
 &amp;DMNDH=ESPM2D.DEMANDH                                              -
 &amp;APPL=APPL(STHG102M.0)
STEP1  COPY FROM (PNODE DSN=GIO.HG1.CDB.ACCTEXT.T1(0)               -
               DISP=SHR)                                            -
       COMPRESS EXT                                                 -
       TO (SNODE                                                    -
 DSN=\'\\\\MyServerName\\IMDATA\\CLASS_SOURCE\\SYSTEM_INPUTS\   ||  -
     \\\CDB\\ACCOUNT.TXT'\                                      -
       SYSOPTS="STRIP.BLANKS(NO)"                                   -
               DISP=RPL)
   IF ( STEP1=0 ) THEN
STEP1A   RUN TASK (PGM=ESP,                                         -
 PARM=("&amp;SUBS NOSTACK;AJ USERREQ.GHG30GOD &amp;APPL COMPLETE;END"))
    ELSE
STEP1B   RUN TASK (PGM=ESP,                                         -
 PARM=("&amp;SUBS NOSTACK;TR &amp;DMNDH USER1('GHG30BAD');END"))
   EIF
</code></pre>

<p>Any wrong assumptions so far?</p>

<p>Given that, I would expect that the above path would be invalid because it would be interpreted as </p>

<pre><code>\\MyServerName\IMDATA\CLASS_SOURCE\SYSTEM_INPUTS\\CDB\ACCOUNT.TXT
</code></pre>

<p>In other words, there would be an extra backslash in one of the levels. But I know that the Connect Direct works and correctly interprets the path as </p>

<pre><code>\\MyServerName\IMDATA\CLASS_SOURCE\SYSTEM_INPUTS\CDB\ACCOUNT.TXT
</code></pre>

<p>How does the concatenation operator and/or line continuation impact the number of slashes that are needed here? What other syntax variables might also be valid that would result in the same valid Windows path?</p>