Skip to main content
Dec 5, 2018 3:50 PM UTC

Opening an MVS file with Python

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 replies

    Dec 5, 2018 4:20 PM UTC

    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,

    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 */

    Alexander Klochkov
    Rocketeer
    Dec 6, 2018 3:06 AM UTC

    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,

    Hi Kent,

    You might want to read followed topics also:


    Thanks,
    Alexander