Page 1 of 1

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

Posted: Wed Sep 15, 2010 2:47 pm
by sctebnt
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

Posted: Wed Sep 15, 2010 4:14 pm
by sctebnt
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

Posted: Wed Sep 15, 2010 4:19 pm
by dovetail
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.