Hi,
I am working on a task that requires a few file conversions and copying / writing to other files.
- Use JCL to convert an MVS file to a text file.
- Executes a python program on the mainframe.
- The python program takes the text file as input, performs some operations on it and writes output to another text file.
- Resume to JCL which converts the new text file to another MVS file.
The problem I am having is that when the new text file is being converted / written to another MVS file, the newline character \n is not recognised.
Even when using ‘a+’ as such:
with open(‘file.txt’, ‘a+’ ) as f:
f.write(rowOutput)
The final MVS file keeps having all the content on one line, instead of each row of the text file on a separate line in the MVS file as desired.
I have tried adding code that appends “\n”, “\n” and even “\\n\n” at the end of every rowOutput. but the MVS file still shows all content as one line.
Output of text file using \\n\n:
{key1:value1, key2:value2}\n
{key3:value3, key4:value4}\n
Output of MVS file being written to using \\n\n:
{key1:value1,key2:value2}\n□{key3:value3,key4:value4)\n□
I assume the □ character is supposed to be the ‘\n’ in ‘\\n\n’.
The operations being performed are splitting the initial MVS file row content, and creating a dictionary using a key list and a value list, and writing the created dictionary for that row in the new text file.
There may be something to do with the encoding that I am unsure about.
Can anyone assist with this?
Hope this makes sense.