Setting up Enhanced ASCII
Limit the enabling of automatic conversion to the smallest environment possible. One way to accomplish this is by using the _BPXK_AUTOCVT environment variable, optionally with the FILETAG runtime option.
It is important to understand that file tagging and enabling automatic conversion are independent operations. Because you can tag files without enabling automatic conversion, and vice versa, it is possible to have many tagged files without any conversion occurring. However, if you enable automatic conversion for the entire system by using the AUTOCVT statement in BPXPRMxx, each tagged file becomes subject to conversion by any program that reads from or writes to those tagged files. Thus, programs may be processing converted data even though they do not support it. (An example would be an EBCDIC program that expects to read an ASCII file as ASCII data.) For those reasons, it is a good idea to limit the enabling of automatic conversion to the smallest environment possible using _BPXK_AUTOCVT and, if applicable for the C run time environment, the FILETAG runtime option.
Before you begin: You need to have an overall understanding of the limitations of Enhanced ASCII, as explained in Converting files between code pages.
Perform the following steps to set up Enhanced ASCII.
- Set up Enhanced ASCII. Base your choice on your particular situation.
If this situation exists . . . Then use . . . The application is written in C/C++. The FILETAG runtime option with the _BPXK_AUTOCVT environment variable. The application is run in the z/OS® UNIX shell or BPXBATCH. The _BPXK_AUTOCVT environment variable. You are enabling automatic conversion for the z/OS UNIX environment. AUTOCVT(ON) statement in the BPXPRMxx parmlib member.
Tip: You can use the SETOMVS and SET OMVS operator commands to turn AUTOCVT on or off.
- Assign the appropriate file tag for each file that is to be converted.
Base your choice on your particular situation.
If you choose this method . . . Then this happens . . . Issuing the chtag command. Files are permanently tagged. Mounting a file system with the TAG parameter. Files are temporarily tagged. All untagged files in the file system that is being mounted are implicitly tagged. When the file system is unmounted, the tags are lost. Issuing the F_SETTAG subcommand of the BPX1FCT (fcntl) callable service from a program. Files are either temporarily or permanently tagged, depending on the input parameters. For more information about the subcommand, see fcntl (BPX1FCT, BPX4FCT) — Control open file descriptors in z/OS UNIX System Services Programming: Assembler Callable Services Reference. Issuing BPX1CHR (chattr) callable service from a program. Files are permanently tagged. For more information about BPX1CHR, see chattr (BPX1CHR, BPX4CHR) — Change the attributes of a file or directory in z/OS UNIX System Services Programming: Assembler Callable Services Reference. Issuing fopen() or popen() with the 'text' option and the C-RTL FILETAG(,AUTOTAG) runtime option. New or empty files are automatically tagged at first write(). Programs that use this form of opening a file are already set up for tagging, and require the least effort to set up automatic conversion.
- Assign a coded character set identifier (CCSID) to each program
or thread in the shell. By default, the initial CCSID for every thread
is IBM®-1047 (EBCDIC).
- For entire programs written in C/C++, use the ASCII compiler to change it to 819 (ISO8859-1 ASCII).
- For C/C++ threads, use the F_CONTROL_CVT subcommand of fcntl().
- For Assembler programs and threads, use the F_CONTROL_CVT subcommand of the BPX1FCT callable service. F_CONTROL_CVT sets the CCSID of the program associated with each opened file. (That is, the program CCSID can be different depending on which file is chosen.)
- Use the mapping macro BPXYTHLI to set field Thliccsid. IBM no longer recommends this method.
When you are done, you have set up Enhanced ASCII.