File tagging and conversion
In general, the file system knows
the contents of a file only as a set of bytes. Applications which
create and process bytes in a file know whether these bytes represent
binary data, text (character) data, or a mixture of both. File tags
are file metadata fields which describe the contents of a file. Enhanced
ASCII includes the following file tag fields:
- txtflag
- A flag indicating if a file consists solely of character data encoded by a single coded character set ID (CCSID).
- file ccsid
- A 16 bit field specifying the CCSID of characters in the file.
Applications can explicitly tag files using new
open()
or fcntl()
options,
or applications can allow the logical file system (LFS) to tag new
files on first write, fopen()
. A new environment variable, _BPXK_CCSID
,
is used to assign a program CCSID to an application, which LFS will
use to tag new files on first write. LFS also uses the program CCSID
derived from _BPXK_CCSID
to set up auto-conversion of pure
text datastreams. LFS attempts to set up auto-conversion when:
- Auto-conversion is enabled for an application by the
_BPXK_AUTOCVT
environment variable - The file txtflag flag is set indicating a pure text file
- The file and program CCSIDs do not match.
Automatic file conversion and file tagging include the following
facilities:
_OPEN_SYS_FILE_EXT
feature test macro. For more information, see z/OS XL C/C++ Runtime Library Reference ._BPXK_AUTOCVT
and_BPXK_CCSIDS
environment variables. For more information, see Using environment variables.- z/OS® Language Environment®
FILETAG
runtime option. For more information, see z/OS Language Environment Programming Reference. __chattr()
and__fchattr()
functions; F_SETTAG and F_CONTROL_CVT arguments for thefcntl()
function; options for thefopen(),
popen()
,stat()
,fstat()
, andlstat()
functions. For more information, see z/OS XL C/C++ Runtime Library Reference.