FILETAG (C/C++ only)

Derivation: FILE TAGging

FILETAG controls automatic text conversion and automatic file tagging for z/OS UNIX files. It activates the automatic file tagging, on the first write, of new or empty files open with fopen() or freopen(), or upon the first I/O to a pipe created with popen().

Recommendation: To use the runtime option properly, be familiar with the concept of file tagging, automatic conversion, and the CCSID.
Non-CICS default
FILETAG=((NOAUTOCVT,NOAUTOTAG),OVR)
CICS® default
FILETAG is ignored under CICS.
AMODE 64 default
FILETAG=((NOAUTOCVT,NOAUTOTAG),OVR)
Read syntax diagramSkip visual syntax diagram FILETAG = ( ( NOAUTOCVTAUTOCVT , NOAUTOTAGAUTOTAG ) , OVRNONOVR )
NOAUTOCVT
Disables automatic text conversion. NOAUTOCVT is the default.
AUTOCVT
Enables automatic text conversion for untagged files that were opened by using fopen() or freopen(). The conversion for an untagged file is from the program CCSID to the EBCDIC CCSID as specified by the _BPXK_CCSIDS environment variable. If the environment variable is unset, a default CCSID pair is used. For more information about the _BPXK_CCSIDS environment variable, see Using environment variables in z/OS XL C/C++ Programming Guide.
Restriction: Automatic conversion for untagged UNIX files can only take place between IBM-1047 and ISO8859-1 code sets. Other CCSID pairs are not supported. By default, automatic conversion for untagged files applies only to files opened in text mode. An untagged file that was opened in binary mode is not converted automatically. You can control this by using the _EDC_AUTOCVT_BINARY environment variable. For more information about the _EDC_AUTOCVT_BINARY environment variable, see Using environment variables in z/OS XL C/C++ Programming Guide. .

This suboption also indicates that the standard streams should be enabled for automatic text conversion to the EBCDIC IBM-1047 code page when they refer to an untagged terminal file (tty).

This suboption does not affect untagged files that are automatically tagged by the AUTOTAG suboption. A file that is automatically tagged is already enabled for automatic text conversion.

Restriction: The automatic text conversion is performed only if one of the following situations is also true:
  • The _BPXK_AUTOCVT environment variable value is set to ON.
  • The _BPXK_AUTOCVT environment variable is unset and AUTOCVT(ON) was specified in the active BPXPRMxx member on your system.

For more information about the _BPXK_AUTOCVT environment variable, see Using environment variables in z/OS XL C/C++ Programming Guide.

NOAUTOTAG
Deactivates the automatic tagging of new or empty files. NOAUTOTAG is the default.
AUTOTAG
Activates the automatic file tagging, on the first write, of new or empty files open with fopen(), freopen(), or popen().
OVR
Specifies that the option can be overridden. OVR is the default.
NONOVR
Specifies that the option cannot be overridden.

z/OS® UNIX considerations

FILETAG applies to the enclave. Nested enclaves do not inherit the setting of this runtime option. UNIX file system files that are opened in the nested enclave are not affected.

Usage notes

  • Avoid these situations:
    • Setting this runtime option at the system or region levels.
    • Setting this runtime option by using _CEE_RUNOPTS in a default profile for the UNIX shell users.
    • Exporting _CEE_RUNOPTS that specifies this runtime option. It can cause unexpected behaviors for the unknowing user or application.
  • The application programmer should define this runtime option with the assumption that the application is coded to behave based on the option's setting.
  • The application programmer should use #pragma runopts specify this runtime option at compile time or at bind by using a CEEUOPT CSECT that was created previously.
  • The application user should not override this runtime option because it can change the expected behavior of the application.
  • The default CCSID pair is (1047,819), where 1047 indicates the EBCDIC IBM-1047 code page and 819 indicates the ASCII ISO8859-1 code page.
  • Automatic text conversion is enabled for the standard streams only when the application has been exec()ed. For example, when the UNIX shell gives control to a program entered on the command line, and the standard stream file descriptors are already open, untagged, and associated with a tty.
  • For the UNIX shell-owned standard streams that are redirected at program execution time, the shell includes added environment variables that control the tagging of redirected streams. For more information about the environment variables, see Commonly used environment variables in z/OS UNIX System Services Planning.
  • Automatic tagging for a file is done at first write by the LFS. The CCSID used for the tag is the program CCSID of the current thread. Both text and binary files are tagged.
  • When FILETAG(,AUTOTAG) is in effect, fopoen() or freopen() of a file fails if it cannot determine whether the file exists or if it cannot determine the size.