I have discussed in another article how you can convert data from one codepage to another.
Also I have described a method to copy unix files to MVS datasets.
This article summarizes a method to copy an MVS dataset to Windows, while keeping records and converting from ebcdic to the utf8 codepage.
This job copies the MVS dataset to a UNIX files, indicating to keep record indicators with the Windows CR character (UNIX uses the CRLF typically as record / line separators). The dataset below ‘YOUR.TEST.PS’ should be a PS – physical sequential – dataset or a PDS(E) member.
//STEP1 EXEC PGM=BPXBATCH
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD DUMMY
//* Values in STDENV below are kept but have no meaning for this function
//STDENV DD *
JAVA_HOME=/usr/lpp/java/J8.0_64
PATH=/usr/lpp/mqm/web/bin:/bin:/usr/sbin
LIBPATH=/usr/lpp/mqm/java/lib
//STDPARM DD *
SH cp -v -F cr "//'YOUR.TEST.PS'" /your/unixdir/tst.txt
You can now convert the EBCDIC data to UTF-8 as follows:
iconv -f 37 -t 1208 /your/unixdir/tst.txt > /your/unixdir/utf8-tst.txt
Now you can transfer the file to Windows. Transfer the file in binary mode, otherwise another unwanted code page conversion will happen.