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

Discussion of the Co:Z Toolkit Dataset Pipes utilities
Post Reply
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

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

Post 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
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Post 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
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post 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.
Post Reply