Hi Alexander, thanks for reporting this, we'll be investigating it. As a workaround, I'd recommend you use the zos_util package. You can obtain it in two ways:
1) Directly from the Python AI Toolkit for IBM z/OS
2) Install it from PyPI - you'll need a C compiler installed in your environment to build this package, and you may also find the following blog useful for Installing Packages with C Components on Python 3.12.
To use the package for your scenario, you can do the following:
import zos_util
zos_util.tag_binary('BINARY.TXT')
And you can find the documentation for this package here
------------------------------
Steven Pitman
------------------------------
Original Message:
Sent: Wed January 03, 2024 09:39 AM
From: Alexander Klochkov
Subject: unable to set binary tag to file using os.set_tagging
Hi, I'm trying to set binary tag using Python 3.12 and os.set_tagging , and looks like it's not working:
$ ls -T /u/user/tmp/BINARY.txt
- untagged T=off /u/user/tmp/BINARY.txt
$ python -c "import os; print(os.set_tagging('/u/user/tmp/BINARY.txt', 65535))"
-1
$ ls -T /u/user/tmp/BINARY.txt
- untagged T=off /u/user/tmp/BINARY.txt
but it's ok for iso-8859-1 and ebcdic ccsid:
$ python -c "import os; print(os.set_tagging('/u/user/tmp/BINARY.txt', 819))"
0
$ ls -T /u/user/tmp/BINARY.txt
t ISO8859-1 T=on /u/user/tmp/BINARY.txt
$ python -c "import os; print(os.set_tagging('/u/user/tmp/BINARY.txt', 1047))"
0
$ ls -T /u/user/tmp/BINARY.txt
t IBM-1047 T=on /u/user/tmp/BINARY.txt
Thanks,
Alexander
------------------------------
Alexander Klochkov
------------------------------