Get PDS member using //DD:ddname(member)

Discussion of Dovetailed Technologies Dataset Pipes tools
Post Reply
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Get PDS member using //DD:ddname(member)

Post by sctebnt » Wed Sep 15, 2010 2:47 pm

Is there a way to execute a command like the following successfully using the //DD: parameter?

//MYPDS DD DISP=SHR,DSN=@17171.T.PARMLIB
//STDIN DD *
fromdsn //DD:MYPDS(TMP) > tmp.dat
fromdsn //DD:MYPDS(MORE) > more.dat



Thanks,
Scott

sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Post by sctebnt » Wed Sep 15, 2010 4:14 pm

After reviewing the fopen() documentation a bit closer and the error messages I made the following changes (added quotes) and received the expected results.

//MYPDS DD DISP=SHR,DSN=@17171.T.PARMLIB
//STDIN DD *
fromdsn "//DD:MYPDS(TMP)" > tmp.dat
fromdsn "//DD:MYPDS(MORE)" > more.dat

dovetail
Site Admin
Posts: 1848
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Wed Sep 15, 2010 4:19 pm

What you have will work fine except for a minor problem...

If you execute these commands under the z/OS Unix shell, you will get the following error (I assume that this JCL fragment is running under COZBATCH, which runs your STDIN DD input using the z/OS Unix shell)

Code: Select all

fromdsn //DD:MYPDS(TMP) > tmp.dat 
FSUM7332 syntax error: got (, expecting Newline
This is because '(' is a special meta character to the shell. You can avoid this by quoting or escaping the argument. For example:

Code: Select all

fromdsn '//DD:MYPDS(TMP)' > tmp.dat 
fromdsn "//DD:MYPDS(TMP)" > tmp.dat 
fromdsn //DD:MYPDS\(TMP\) > tmp.dat 
Note that in the above examples, the single quote, double quote, and backslash characters are processed by the shell and not actually passed as input to the fromdsn command.

Post Reply