More about data sets and more Linux!
I’m on schedule! Last year I have only finished challenge 9 of part 2 on the fifth of october. This is day three 🙂 The blogs might lack in quality a bit but I’ll fix that once things have calmed down.
Data Sets, Unix Files, and Character Encoding
IBM Master the Mainframe 2019 Part Two – Challenge #09
This challenge will be short and simple, just how we like it! Again, I’ll just list the commands and whether they are primary or line commands.
Use TSO Unix interface, OMVS, to edit Unix file and copy in data from an MVS data set
First we need to open OMVS using the primary command TSO OMVS. After that we issue the oedit ascii command to create and edit a new file called ascii.
After submitting the oedit ascii command we return to our familiar editor interface. Inhere we need to copy a file, we do that using copy ‘zos.mtm2019.public.iso8859’ as primary command. To view the hexadecimal values we enter the primary command hex on.
Press F3 to save and return. Back inside the OMVS shell we type exit to exit back to the ISPF primary option menu.
Examine Unix File stream of bytes behavior
Well, they wanted us to go back to the ISPF primary option menu but now we need to go back? Whew. Let’s do that using TSO OMVS. Now we need to enter a sequence of commands to view the ascii file we previously created. The commands are explained by IBM on the challenge page.
- ls -TH ascii
- cat ascii
- iconv -t IBM-1047 -f ISO8859-1 ascii | more
I have executed said commands but there is a problem with the file. iconv to EBCDIC did not recognize newline (nl x’15’) as a valid EBCDIC character.
Change a Unix file character encoding tag
We need to change the ascii file tag to EBCDIC using the z/OS Unix chtag command. We can verify the success of this command by checking the tag again using the ls -TH ascii command. I have found a good resource on tagging here.
chtag -t -c IBM-1047 christmas.recipes the file christmas.recipes is tagged as an EBCDIC file. IBM-1047 is the code set for EBCDIC.
So I just need to change this command example to chtag -t -c IBM-1047 ascii and it should be ok. I’ll do that and check the tag. If you have the wrong tag, you can delete the tag using chtag -r ascii.
The tag looks good! Now we will list the tags of this file and pipeline it to a new file called taglist. We do that by using the ls -TH ascii > taglist command. We copy the contents of taglist by using the command cp taglist “//p2.output(#09)”. This copies the content from taglist to your ZOS environment, P2.OUPUT member #09.
I have copied the contents. Should we verify? Yes we should! exit omvs and navigate to our P2.OUTPUT(#09) member.
It’s there! We have changed the tag on the ascii file, piped the command output to taglist and then copied the content of taglist to our ZOS data member P2.OUTPUT(#09)!