Gil is correct, only Unix utilities that use the underlying C function 
“fopen(…)” can read or write "//'userid.TEMP.OUT2'".  Since shell redirection 
means the writing program is the shell itself (/bin/sh) and that program does 
NOT support MVS datasets directly, you cannot do that.

Some Unix utilities like “awk” do in fact directly support MVS datasets as 
input or output, BUT it is NOT documented to do so (as gil has rightly said 
several times when I have brought up this “awk” behavior), so letting any 
important work depend on that observed-but-not-documented fact could be risky.

Instead, you could try to pipe your command output to the “cp” command (which 
IS documented to support MVS datasets) and tell “cp” to write to 
"//'userid.TEMP.OUT2'" like this:

(your command(s) here) | cp - "//'userid.TEMP.OUT2'"

The first operand to “cp” of “-“ (minus sign or hyphen) tells “cp” to use stdin 
as the input source and the second operand "//'userid.TEMP.OUT2'" as the output 
destination.

HTH

Peter

From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Paul Gilmartin
Sent: Monday, September 15, 2025 8:13 PM
To: [email protected]
Subject: Re: Why MVS data set read-only from UNIX?


On Mon, 15 Sep 2025 18:09:38 -0500, Charles Mills wrote:



>I run a UNIX shell command from TSO OMVS and redirect its output with

>    >"//'userid.TEMP.OUT2'"

>I get the error

>FSUM7343 cannot open "//'userid.TEMP.OUT2'" for output: EDC5141I Read-only 
>file system.

>

in: 
<https://urldefense.com/v3/__https://www.ibm.com/docs/en/zos/3.1.0?topic=zusscr-specifying-mvs-data-set-names-in-shell-environment__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!LnoKnTbxp1bsEOmh4sQAe9kalliGNp23PfK4LEApmaUu7vvpdBPmOLI6yNsiEqAZz274uiRc4juRzpN1-qHYz_AGkUhynHwslcghXU6T$<https://urldefense.com/v3/__https:/www.ibm.com/docs/en/zos/3.1.0?topic=zusscr-specifying-mvs-data-set-names-in-shell-environment__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!LnoKnTbxp1bsEOmh4sQAe9kalliGNp23PfK4LEApmaUu7vvpdBPmOLI6yNsiEqAZz274uiRc4juRzpN1-qHYz_AGkUhynHwslcghXU6T$>>:

    Only functions whose individual descriptions mention "data sets" support

    classic data sets. For example, automount, mv, and pax support the use

    of MVS file names. If there are limitations or exceptions for those 
utilities

    that support MVS data set names, they are noted in the description of those 
utilities.



I'd be astonished if shell redirection supports Classic data sets.  Does

the doc of "sh" mention such support?



I call "Read-only" misleading.  What is the result of input redirection.



Alternative I've tried: pipe  (yes!) into "cp", which supports Classic data 
sets.



--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to