I have read that tagging behavior page and it makes sense when applied to files stored in the Unix file system. MVS datasets could just as easily just be considered always tagged as cp1047 (with an option to change the CCSID to 037 or one of the European EBCIDIC code pages) and then you just go on from there. Connecting to the MVS file system "under the covers" is the runtime implementor's job, not the application developer's job.
As to providing a package to specifically access MVS datasets, my first question is why IBM didn't provide one in the first place, or better yet build it into the python I/O subsystem from the start? Why does the community need to provide such a basic functionality? "zoautil_py" is one such implementation, but it is extraordinarily "heavyweight" and expensive to use, and is not an acceptable solution in a world where every second counts and costs real money. The lack of easy-to-use and efficient MVS file access may well discourage more widespread use of python on z/OS for everyday computing tasks. And yes, I can accept that my expectations are not realistic. It is just a shame that an easy-to-use and efficient access to MVS datasets isn't and won't be there unless the "community" provides it. IMHO it should have been part-and-parcel of the original language implementation, but I know what my opinions and expectations are worth. Peter -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of David Crayford Sent: Monday, October 3, 2022 1:48 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: IBM python documentation? [was: RE: IBM SMF Export with Python] On 3/10/22 07:18, Farley, Peter x23353 wrote: > Where, for instance, in the documentation that you linked to is there > information on whether the python "open()" function for files will or will > not support direct access to MVS datasets without transferring them down to > the Unix file system? I.E., are either of these calls to the open() > function valid or not: > > Myfile = open("//'MVS.DATA.SET.NAME", "rt", ccsid="1047") > > Myfile = open("//:DDNAME", "rt", ccsid="1047") # This of course > assumes that a call to "bpxunix" (or by other means) has been used to > establish a DD allocation in the AS where the python program is > executing This will *never* happen. If you read the doc WRT tagging behaviors you will understand why https://urldefense.com/v3/__https://www.ibm.com/docs/en/python-zos/3.9?topic=translation-tagging-behaviors__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!O2czdpcmZt_bBNIuRr4UXedStf34QpBfTBkZ-wQNwNFosWZR2zrDSP1nat8ZFfmZnRA9s7TVhDN6jaUYFy-CaGg$ . Rocket's Python port supported reading MVS data sets but it was not a documented feature and was used with great care. Patching the Python core I/O libraries to support MVS data sets is not a great idea. It's much better to write a specific library that *only* support MVS data sets and not z/OS UNIX files. A good reference implementation is the JZOS ZFile class. If you open an RFE IBM may do this. Or maybe the community can contribute? Either way it's going to be implemented as a specific package. Porting tools to support MVS data sets in trivial. They use open() because it's a low-level API and read/write support sockets, FIFO's, pipes etc. It's not just a case of replacing open with fopen(). Python implements a fdopen() https://urldefense.com/v3/__https://docs.python.org/3/library/os.html*os.fdopen__;Iw!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!O2czdpcmZt_bBNIuRr4UXedStf34QpBfTBkZ-wQNwNFosWZR2zrDSP1nat8ZFfmZnRA9s7TVhDN6jaUY6MzWLWc$ method for wrapping file descriptors. -- 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN