Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using 2 files in one python script #4

Open
ccc13481 opened this issue Dec 20, 2023 · 0 comments
Open

Using 2 files in one python script #4

ccc13481 opened this issue Dec 20, 2023 · 0 comments

Comments

@ccc13481
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant