I am writing a C# program to parse a Connect:Direct file and extract from it source and destination information.
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.
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.
NDMHGM30 PROCESS SNODE=MYSNODE PACCT='G,HG1' -
&SUBS=SUBSYS(ESP2) -
&DMNDH=ESPM2D.DEMANDH -
&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=("&SUBS NOSTACK;AJ USERREQ.GHG30GOD &APPL COMPLETE;END"))
ELSE
STEP1B RUN TASK (PGM=ESP, -
PARM=("&SUBS NOSTACK;TR &DMNDH USER1('GHG30BAD');END"))
EIF
Any wrong assumptions so far?
Given that, I would expect that the above path would be invalid because it would be interpreted as
\\MyServerName\IMDATA\CLASS_SOURCE\SYSTEM_INPUTS\\CDB\ACCOUNT.TXT
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
\\MyServerName\IMDATA\CLASS_SOURCE\SYSTEM_INPUTS\CDB\ACCOUNT.TXT
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?
From the documentation (IBM Sterling Connect:Direct for z/OS User Guide):
Combine that with this reference (Sterling Connect:Direct for Microsoft Windows System Guide - it is probably also detailed elsewhere in the Windows documentation for Connect:Direct)
The line you want to understand is this:
On each of those two lines, the first and last backslashes (\) are for this reason:
and
Sterling Connect:Direct will resolve it to this:
Windows will be presented with
And Windows will then do its escape-processing, giving you this:
This particular use of the backslash (\) is due to the presence of the continuation character (the - as the last character on the line) and the presence of special characters (what those are is listed in the documentation), not due to the use of the concatenation (||) (which, for information, is whatever symbol in the character-set you are using is X'4F', which is not necessarily the | symbol).
All the Sterling Connect:Direct documentation, for all platforms, is freely available from IBM's Information Centre, either usable directly online or downloadable as PDFs. Your choice. Just pick your favourite search-engine, and find the documentation for your versions of the product.