Python: read an EBCDIC file
I try to read a sequential dataset (FB LRECL(1000)) by using this simple code:
# ==================================================
count = 0
thefilepath = "//'sa8sb22.resultfb'"
count = len(open(thefilepath, 'r', encoding="cp500").readlines( ))
print("There are ", count , " lines in the file")
# ==================================================
I have 133 records in the file, but the above code delivers 1 (one). I suppose, no read is executed.
I suppose it is realted to the encoding, but I don't find any better as the cp500.
The file is definitive EBCDIC (x'81' for 'a').
Any hints pls.?
------------------------------
Gabor Markon
Mainframe Architect
Self Registered
Budapest HU
------------------------------
# ==================================================
count = 0
thefilepath = "//'sa8sb22.resultfb'"
count = len(open(thefilepath, 'r', encoding="cp500").readlines( ))
print("There are ", count , " lines in the file")
# ==================================================
I have 133 records in the file, but the above code delivers 1 (one). I suppose, no read is executed.
I suppose it is realted to the encoding, but I don't find any better as the cp500.
The file is definitive EBCDIC (x'81' for 'a').
Any hints pls.?
------------------------------
Gabor Markon
Mainframe Architect
Self Registered
Budapest HU
------------------------------
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
