Character Encoding - Chtag

Contents

Character Encoding for USS

I recently installed IBM Z Open Automation Utilities and Python on z/OS and learned a new command I haven’t or needed to use before.

The chtag command for character encoding for EBCDIC.

After editing some Helloworld.py file using vi editor I recevied the follow error when I try to run the python code.

/home/#>python hello.py
SyntaxError: Non-UTF-8 code starting with '\x97' 

I needed to change the codeset to IBM-1047 for python to run correctly on USS z/OS.

Before the change:

/home/#>chtag -p hello.py

m IBM-1047 T=off hello.py

I issued chtag -tc 1047 hello.py to correct the issue.

/home/#>chtag -p hello.py

t IBM-1047 T=on hello.py

and now the hello.py works as expected.

/home/#>python hello.py

Hello World!

Tip
Using the ls -T will provide the same results as the chtag -p command used above

Links I used to install ZOAU using pax:

https://www.ibm.com/docs/en/zoau/1.4.x?topic=installing-zoau

The IBM Open Enterprise SDK Python:

https://www.ibm.com/products/open-enterprise-python-zos

https://www.ibm.com/docs/en/python-zos/3.14.0?topic=installation-configuration

Contents