General z/OS UNIX · Troubleshooting

ASCII vs. EBCDIC file tagging after git checkout on z/OS UNIX

Updated

When you clone a Git repository on z/OS UNIX (or unpack a tarball transferred from Linux), files often arrive untagged. Standard z/OS tools such as make, /bin/sh, and IBM compilers treat untagged text files as EBCDIC (IBM-1047), which causes make to spin or fail on Makefiles and shells to reject build scripts.

Check current tags

Use ls -T to inspect the CCSID and text flag on files in a repository:

ls -T Makefile README.md

An ASCII file tagged properly for automatic conversion looks like:

t ISO8859-1   T=on  Makefile

An untagged file shows - untagged T=off.

Tag the repository sources

Projects like ztop provide a make tag target that tags all ASCII source files in one step:

make tag

If you need to tag a directory tree manually after an untagged checkout:

chtag -R -tc ISO8859-1 .

Avoid recursively tagging binary artifacts (.o, .a, compiled binaries). Run chtag on a clean source tree before building, or tag source extensions explicitly.

Enable automatic conversion in your shell

Make sure automatic conversion is enabled in your z/OS UNIX environment (for example in ~/.profile):

export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="${_CEE_RUNOPTS:+$_CEE_RUNOPTS }FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"

Choosing ASCII vs. EBCDIC builds for zash

zash defaults to ASCII mode (following the zopen convention) for both IBM Open XL C/C++ and IBM z/OS XL C. If your shop runs purely in EBCDIC without autoconversion, clear the ASCII macro at build time:

# Open XL C/C++ (EBCDIC)
make zos OXL_ASCII=

# XL C (EBCDIC)
make xlc XLC_ASCII=

Still need help?

Open a public issue on GitHub or send us a note directly via the contact page.