Copying a File from zOS to Microsoft Windows using Substitution in a Destination Path:

This example shows how to use symbolic substitution to specify Microsoft Windows path names in a COPY statement.

In this example, the z/OS data set TEST.DATASET is copied to the Microsoft Windows file STERLING\CD\CDWIN\TEMP\TEST.TXT

  1. Create a batch command that signs on to IBM® Connect:Direct®, submits a Process that creates the variables, and signs off:
      SIGNON USERID=(userid,)
         SUBMIT PROC=EXNTDIR      -
         &FROMDSN=TEST.DATASET    -
         &DIR1=CDWIN              -
         &DIR2=TEMP               -
         &FILENAME=TEST.TXT
      SIGNOFF

    This Process creates the following variables:

    Variable Value Description
    &FROMDSN
    TEST.DATASET The name of the source data set.
    &DIR1
    CDWIN Third level of the destination path.
    &DIR2
    TEMP Fourth level of the destination path.
    &FILENAME
    TEST.TXT The destination file name.
  2. Create the following Process to copy the file:
    NTDIRPTH  PROCESS                                               -
              SNODE=STERLING.WINDOWS                                -
              &DIR1=,                                               -
              &DIR2=,                                               -
              &FILENAME=,
       SYMBOL &S1 = STERLING
       SYMBOL &S2 = CD
       SYMBOL &TODSN = \'\\\ || &S1 || \\ || &S2 || \\ ||           -
          &DIR1 || \\ || &DIR2 || \\ || &FILENAME || \'\
    STEP01   COPY  FROM (PNODE                                      -
                         DSN=&FROMDSN                               -
                         DISP=SHR)                                  -
                   TO   (DSN=&TODSN                                 -
                         SYSOPTS="DATATYPE(TEXT)"                   -
                         DISP=(RPL))

    This Process defines the following symbolic values:

    Variable Value Description
    &S1
    STERLING First level of the destination path.
    &S2
    CD Second level of the destination path.
    &TODSN
    \'\\\ . . . &FILENAME || \'\ The full destination path.

    The following table shows how the &TODSN variable resolves (two vertical bars [ || ] indicate concatenation).

    Value Resolves to . . .
    \'\\\
    '\
    &S1
    STERLING
    \\
    \
    &S2
    CD
    \\
    \
    &DIR1
    CDWIN
    \\
    \
    &DIR2
    TEMP
    \\
    \
    &FILENAME
    TEST.TXT
     \'\

    As a result, the &TODSN variable resolves to

    ‘\STERLING\CD\CDWIN\TEMP\TEST.TXT’