z/OS Tools & Language

Expand all | Collapse all

Opening an MVS file with Python

  • 1.  Opening an MVS file with Python

    Posted 12-05-2018 15:50

    I’m attempting to open an MVS file with Python.

    I can do a:

    cat “//‘XXX.YYY’”

    and display the file just fine.

    However, I’m having trouble opening the file with Python.
    Pretty sure it has something to with needing to ESCAPE some of the characters in the file name

    Any ideas?

    Thanks,



  • 2.  RE: Opening an MVS file with Python

    Posted 12-05-2018 16:20

    Hi Kent,

    Not sure which version (2.7 or 3.6) of Python you are using. But, It worked fine for me in 2.7…having the same issue in 3.6…Let us know if you get any solution to this problem.

    Below is the code used in .py file
    f2=open(’//DD:DDIN’,‘r’) /*DDIN - //DDIN DD DISP=SHR,DSN=AAAAAA.BBBB.CCCCC(DDDDD) in JCL */



  • 3.  RE: Opening an MVS file with Python

    Posted 12-06-2018 03:06

    Hi Kent,

    You might want to read followed topics also:


    Thanks,
    Alexander