daveyc / pyzfile Goto Github PK
View Code? Open in Web Editor NEWA Python package for MVS data set I/O
License: MIT License
A Python package for MVS data set I/O
License: MIT License
Writing records to a z/OS PDS member the square bracket characters are stored as X'BA' and X'BB' rather than X'AD' and X'BD'.
I haven't checked the other "problematic" characters yet (cent sign, not sign, caret, unbroken and broken vertical bars).
It is kind of difficult to write json output to a z/OS file without the correct square bracket characters. Is there any other encoding that will give correct square brackets in a z/OS file?
Hi
I trying to read a file and writing it to another file.
My program:
from pyzfile import *
def main():
print("Read MVS-file")
outfile = ZFile("//'BC6608.TEST.QSAMOUT'","w,type=record,seek",encoding='cp1047')
print(outfile.info())
try:
with ZFile("//'BC6608.TEST.QSAM'","rb,type=record",encoding='cp1047') as infile:
for rec in infile:
print(rec)
except ZFileError as e:
print(e)
print(outfile.info())
print(infile.info())
print(file.info())
print("All records read")
if name == "main":
main()
The first print(outfile.info()) returns:
æ'access_method': 'UNSPEC', 'blksize': 4294967295, 'device': '', 'dsname': '', 'dsorgConcat': False, 'dsorgHFS': False, 'dsorgHiper': False, 'dsorgMem': False,'dsorgPDE': False, 'dsorgPDSdir': False, 'dsorgPDSmem': False, 'dsorgPO': False, 'dsorgPS': False, 'dsorgTemp': False, 'dsorgVSAM': False, 'maxreclen': 343758143136, 'mode': æ'append': False, 'read': False, 'update': False, 'write': Falseå, 'noseek_to_seek': 'NOSWITCH', 'openmode': 'TEXT', 'recfmASA': False, 'recfmB':False, 'recfmBlk': False, 'recfmF': False, 'recfmM': False, 'recfmS': False, 'recfmU': False, 'recfmV': False, 'vsamRKP': 343740737584, 'vsamRLS': 'NORLS', 'vsamkeylen': 471371242, 'vsamtype': 'NOTVSAM'å
So no dsname.
And if I add a outfile.write(rec) after the 'print(rec)' I will get an error:
raise Exception(f"Error writing to file 'æself.filenameå': æself.lib.zfile_strerror().decode('utf-8')å")
Exception: Error writing to file '//'BC6608.TEST.QSAMOUT'': EDC5113I Bad file descriptor.
The files are nothing special:
Organization . . . : PS Current Utilization
Record format . . . : FB Used tracks . . . . : 2
Record length . . . : 80 Used extents . . . : 1
Block size . . . . : 27920
1st extent tracks . : 15
Secondary tracks . : 15 Dates
Data set name type : Creation date . . . : 2023/12/20
Data set encryption : NO Referenced date . . : 2023/12/20
Expiration date . . : None
SMS Compressible . : NO
Am I doing anything wrong?
BR
Frank Allan Rasmussen
This is of great importance especially for opening PDS data sets for write.
I was asked how someone installs this if they cannot use pip on z/OS.
They managed it by
I managed to install it by downloading the zip file, uploading it to the zOS LPAR, unzipping it and then running the pip program against the pyzfile-1.0.0.post2-py3-none-any.whl in the pyzfile/dist folder.
It would be worth adding some words like this to this documentation
Colin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.