September 14, 2007 This readme file contains the latest information about the "C/C++ without Debug Tool" optional feature of z/OS V1R7 that was not previously available for our documentation. 1. The following information applies to the ARCHITECTURE compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide. ARCHITECTURE(7): Produces code that uses instructions available on the 2094-xxx models in z/Architecture mode. Specifically, the ARCHITECTURE(7) option instructs the compiler that it may generate instructions from the extended-immediate facility where appropriate. For further information on this facility, refer to z/Architecture Principles of Operation. ======================================================================== 2. The following information applies to the TUNE compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide. TUNE(7): This option generates code that is executable on all models, but is optimized for the 2094-xxx models. ======================================================================== 3. Continuing to use OS/390 V2R10 C/C++ Compiler in z/OS V1R7 with no support: This readme section describes the material and procedures required to copy and install the OS/390 V2R10 C/C++ compiler, which is shipped with z/OS V1.4, z/OS V1.5, and z/OS V1.6. Complete the sections below named "COPY INSTRUCTIONS" and "INSTALLATION INSTRUCTIONS". ABSTRACT AND DESCRIPTION OF RELATED APAR PK05324 ABSTRACT: ABILITY TO CONTINUE USING OS/390 V2R10 C/C++ COMPILER IN Z/OS V1R7 WITH NO SUPPORT DESCRIPTION: The z/OS V1R2 C/C++ compiler introduced support for the ISO Standard C++ language level. The OS/390 V2R10 level of the C/C++ compiler was included in the z/OS C/C++ optional priced feature, from z/OS V1R2 up to and including z/OS V1R6, to help clients migrate code from the previous C++ language level to the new ISO Standard C++ language level. The OS/390 V2R10 level of the C/C++ compiler is not included in z/OS V1R7. For clients who have not completed their migration to the newer ISO C/C++ compiler, the following information can be used to continue using the OS/390 V2R10 level of the C/C++ compiler in z/OS V1R7. The following conditions apply: 1. You must be licensed to the C/C++ feature of z/OS V1R7. 2. Your use of the OS/390 V2R10 C/C++ compiler is for migration purposes only. 3. Your use of the OS/390 V2R10 compiler on z/OS V1R7 is not formally supported. The license agreement and support terms, along with all other terms and conditions for the OS/390 V2R10 level of the C/C++ compiler associated with the release of z/OS where this component originated, continue to apply. Support is limited to replication of the defects in the originating release of z/OS and will terminate when support is withdrawn for that release of z/OS. PROGRAM MATERIALS The program number for the OS/390 V2R10 compiler is 5647-A01 PSP BUCKET : UPGRADE(OS390R10) SUBSET(OS3CCPP) FMID: HLB7703,JLB7713 and JLB7723 COMPID : 56551210A RETAIN Release : 703 SERVICE INFORMATION APARs: PQ39325 PQ38787 PQ40360 PQ41677 PQ45010 PQ44898 PQ43130 PQ45007 PQ45014 PQ45016 PQ42934 PQ45353 PQ47140 PQ47255 PQ47269 PQ48558 PQ48121 PQ50138 PQ50139 PQ50140 PQ47475 PQ48428 PQ48919 PQ50052 PQ49592 PQ50050 PQ50637 PQ46920 PQ48939 PQ51706 PQ51753 PQ52535 PQ52963 PQ52065 PQ53056 PQ54950 PQ55583 PQ52331 PQ56138 PQ56738 PQ56745 PQ57714 PQ57918 PQ58926 PQ59724 PQ59919 PQ56945 PQ61610 PQ48214 PQ62894 PQ63361 PQ62251 PQ67387 PQ67238 PQ67347 PQ65893 PQ67239 PQ66492 PQ67240 PQ66749 PQ67175 PQ67179 PQ68571 PQ68016 PQ67865 PQ68916 PQ69304 PQ70215 PQ70263 PQ71117 PQ70983 PQ71796 PQ74224 PQ74500 PQ74949 PQ75052 PQ67295 PQ75265 PQ76273 PQ75476 PQ77149 PQ77435 PQ76748 PQ77692 PQ78785 PQ86889 PQ87652 PQ90268 PQ95873 PQ97142 PQ97555 PTFs UQ44516 UQ44517 UQ45776 UQ45777 UQ47178 UQ47179 UQ50384 UQ50385 UQ52848 UQ52849 UQ55535 UQ55536 UQ56118 UQ53291 UQ56769 UQ58575 UQ58491 UQ61158 UQ61159 UQ61993 UQ63206 UQ65124 UQ65403 UQ66776 UQ54235 UQ68260 UQ68261 UQ70901 UQ70902 UQ72409 UQ72410 UQ74247 UQ75943 UQ75944 UQ77854 UQ77855 UQ78286 UQ78770 UQ79374 UQ79375 UQ80399 UQ89571 UQ95381 COPY INSTRUCTIONS All of the following sample jobs are located in the CBC.SCCNSAM data set after you have applied PTF UK05554. 1. ACCEPT all OS/390 V2R10 C/C++ compiler service PTFs if not already done 2. Modify and run CCNJPNCH - to allocate SMPPUNCH data set 3. Modify and run CCNJBMCS - to create MCS and JCLIN INSTALLATION INSTRUCTIONS If you decide to install the OS/390 OSV2R10 C/C++ compiler into its own SMP/E environment, you will need to create and initialize your own SMPCSI and SMP/E control data sets, therefore complete steps one through eight below. If you decide to install the OS/390 OSV2R10 C/C++ compiler into an existing SMP/E environment, only complete steps three through eight. All of the following sample jobs are located in the CBC.SCCNSAM data set after you have applied PTF UK05554 except for the IVT jobs CBC3JIV1 and CBC3JIV2. 1. Modify and run sample job CCNJSMPA - to define and initialize a new SMPCSI library 2. Modify and run sample job CCNJSMPI - to allocate SMP/E data sets 3. Modify and run sample job CCNJDDF - to define DDDEF entries 4. Modify and run sample job CCNJALL - to allocate target and distribution libraries 5. Modify and run sample job CCNJRECV - to receive OS/390 V2R10 C/C++ 6. Modify and run sample job CCNJAPPY - to APPLY OS/390 V2R10 C/C++ Note: OS/390 V2R10 C/C++ uses the CALLLIBS function provided in SMP/E to resolve external references during the installation. Before you run this sample job, ensure that the SCEELKED SMP/E DDDEF entry exits. 7. Modify and run sample IVT jobs CBC3JIV1 and CBC3JIV2 to verify the new installation of the OS/390 V2R10 C/C++ compiler. The jobs are located in HLQ.SCBCJCL data set. 8. Modify and run sample job CCNJACCP - to ACCEPT OS/390 V2R10 C/C++ ======================================================================== 4. The following information applies to the keywords listed in Chapter 2 of the z/OS V1R7 XL C/C++ Language Reference: In addition to the list of keywords specified in the "Keywords for language extensions" section, z/OS C++ also reserves the following for use in language extensions: _Pragma __const__ __inline__ ======================================================================== 5. The following information applies to the "Configuration file attributes" section of Chapter 19 of the z/OS V1R7 XL C/C++ User's Guide. The decription for ld_c has been changed to: The path name to be used for the binder when only C sources appear on the command line. The default is:/bin/c89. The decription for ld_cpp has been changed to: The path name to be used for the binder when at least one C++ source appears on the command line. The default is: /bin/cxx. ======================================================================== 6. The following information applies to the LANGLVL compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide. For C++, a new LANGLVL suboption has been introduced named NEWEXCP. This option determines whether or not the C++ operator new throws an exception. When LANGLVL(NEWEXCP) is specified, the standard exception std::bad_alloc is thrown when the requested memory allocation fails. This option does not apply to the nothrow versions of the new operator. The default setting is NONEWEXCP. This option governs the behavior of the default versions of the standard new operators. Class-specific new operators, user defined new operators, and new operators with placement arguments are not affected by the option. ======================================================================== 7. The following information from the #pragma langlvl description in Chapter 18 of the z/OS V1R7 XL C/C++ Language Reference is incorrect: Note that #pragma langlvl has no effect in the z/OS UNIX System Services environment. In z/OS UNIX System Services, you must use the compiler option LANGLVL instead of the pragma. This limitation applies only if the user exports the environment variable {_NOCMDOPTS}. Refer to the z/OS V1R7 XL C/C++ User Guide for more information on {_NOCMDOPTS}. ======================================================================== 8. The following information applies to the end of the "Invocation commands" section of Chapter 19 of the z/OS V1R7 XL C/C++ User's Guide: Notes: 1. Suffixes are used as a naming convention and do not enforce behavior. 2. When compiling and linking a C++ application using a single command line invocation, the application will be correctly link edited with any stanza if at least one C++ source file is specified on the command line. If only object files or a mix of C sources and C++ object files are specified on the command line, a C++ stanza must be used to correctly link edit the application. ======================================================================== 9. The following information applies to Chapter 15 of the z/OS V1R7 XL C/C++ Compiler and Run-Time Migration Guide for the Application Programmer: In z/OS V1R7, the compiler adds support for array bound checking. As a result of this checking, the following code example, which uses an array member inside a structure, will cause a compiler diagnostic message to be issued: #include #include #include struct A { int length; char name[2]; }; int main () { int i; struct A* a; a = (struct A*)malloc(10); a->length = 6; memcpy (a->name, "hello!", a->length); printf ("%c\n", a->name[5]); return 0; } The correct usage, which incorporates using the C99 flexible array member feature, is shown below: #include #include #include struct A { int length; char name[]; }; int main () { int i; struct A* a; a = (struct A*)malloc(10); a->length = 6; memcpy (a->name, "hello!", a->length); printf ("%c\n", a->name[5]); return 0; } ======================================================================== 10. The following information applies to Chapter 15 of the z/OS V1R7 XL C/C++ Compiler and Run-Time Migration Guide for the Application Programmer: #pragma linkage NOSTACK in LP64, when using int parameter: The OS linkage passes parameters via the argument area. An array of pointers points to a temporary variable containing the value of the argument to be passed. char or short are widened to int before they are passed. This means that char, short, or int arguments are copied to a temporary variable of size 4 bytes, effectively an int, and then the address of this temporary int is passed in the argument area. A error occurs under LP64, when char, short, or int are copied to a temporary variable of size 8 bytes (effectively a long type), and the address of this temporary long variable is passed. Since the high-order 4 bytes in the temporary area is always zero, if the callee follows the OS calling convention, the arguments appear to be zero. To avoid this problem for existing LP64 programs using the OS linkage, do not use char, short, or int in the prototype of OS functions. Use the long (or unsigned long) type instead. The caller can still pass arguments as char, short, or int. Implicit conversion will handle the parameters correctly. Code on the callee side should expect a long (or unsigned long) parameter. Note that if an existing program follows the above procedures to work around this problem, there will be no migration hit when the compiler applies this fix. After this fix, the LP64 program will be able to use char, short, or int in function prototypes. ======================================================================== 11. The following information applies to the FLOAT compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide: FLOAT(AFP(VOLATILE|NOVOLATILE)) The AFP(VOLATILE) suboption for the FLOAT compiler option enables you to flag the AFP registers 8-15 as volatile, which means they are not expected to be preserved by the called program. Note: The AFP registers are 1, 3, 5, 7 and 8-15. However, the AFP registers 0-7 are always considered volatile. The AFP(VOLATILE) suboption prevents AFP registers from becoming corrupted if the application runs in a CICS environment where the AFP registers are not preserved across task switching. When AFP(VOLATILE) is specified, the compiler generates extra code to protect the values in these registers. When no suboption is specified for AFP, the default is NOVOLATILE, which is exactly the same as specifying FLOAT(AFP). Notes: 1. The option FLOAT(AFP(VOLATILE)) is not supported by IPA. If the option FLOAT(AFP(VOLATILE)) is passed to the IPA compile or link phase, then the IPA phase will emit a severe diagnostic message. 2. The use of the AFP(VOLATILE) sub-option to save the contents of AFP registers across calls could have an impact on performance. The user should evaluate the performance costs prior to using this suboption. The following information applies to the z/OS V1R7 XL C/C++ Compiler and Run-Time Migration Guide for the Application Programmer: The FLOAT(AFP) option instructs the compiler to generate code which makes use of the full complement of 16 floating point registers. These include the four original floating-point registers, numbered 0, 2, 4, and 6, and the Additional Floating Point (AFP) registers, numbered 1, 3, 5, 7 and 8 through 15. FLOAT(AFP) supports the VOLATILE | NOVOLATILE suboption. The default is NOVOLATILE. The NOVOLATILE suboption instructs the compiler to treat AFP registers 8-15 as non-volatile, i.e., the compiler assumes that any called subroutines will preserve the values in these registers. This convention is followed by code generated by the XL C/C++ compiler. It is safe to use NOVOLATILE under most environments. You can instruct the compiler to treat AFP registers 8-15 as volatile by specifying FLOAT(AFP(VOLATILE)), i.e., the compiler will generate instructions to save and restore the values in these registers across function calls. If you have C/C++ code which uses floating-point data types and which is to run under CICS, there is potential risk of data corruption or data loss or the program abending if the code is not compiled with the appropriate FLOAT sub-options. If the code is compiled with the old FLOAT(AFP) option or the new FLOAT(AFP(NOVOLATILE)) option, the code is at risk. The Load Module Analyzer (LMA) tool, described at http://www-1.ibm.com/ support/docview.wss?rs=1083&context=SSGMGV&dc=D400&uid= swg24010925&loc=en_US&cs=UTF-8&lang=en&rss=ct1083other can be used to identify which parts of the module are exploiting AFP registers 8-15. These parts should then be recompiled with FLOAT(AFP(VOLATILE) to correct the problem. Note that parts compiled with FLOAT(AFP(VOLATILE)) will be identified by LMA as using AFP registers 8-15. This is normal - the tool is detecting that the compiler has generated code to save and restore the registers, and there's no need to recompile code which is already built FLOAT(AFP(VOLATILE)). If the code is later changed, care must be taken to avoid introducing the potential risk of data corruption, etc., i.e., if floating point data types are added to the code, the parts containing the changed code must be compiled with FLOAT(AFP(VOLATILE)). CICS does its own task switching and does not preserve the AFP registers 8 through 15. CICS programs that have floating-point operations and use the AFP option must therefore set the VOLATILE suboption explicitly. There are no other environments known to have this issue, such as batch programs, since the full set of AFP registers are saved by the operating system during task switching. ======================================================================== 12. The following information applies to Example 5 for SEARCH(LIB1.*,LIB2.+,LIB3) #include in Chapter 7 of the z/OS V1R7 XL C/C++ User's Guide: The following information is incorrect: second opt in SEARCH PDS = userid.SYS(NAME@1) It should be the following: second opt in SEARCH PDS = userid.LIB2.SYS(NAME@1) ======================================================================== 13. The following information applies to the XPLINK compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide: The following information is incorrect: When compiling using the XPLINK option, the compiler uses the following options as defaults: - CSECT() - GOFF - LONGNAME - RENT RENT should be NORENT in the information listed above. ======================================================================== 14. z/OS XL C support for IBM DB2 UDB for z/OS V8 coprocessor: As of PTFs UK10240 and UK10241, the z/OS XL C compiler supports the IBM DB2 UDB for z/OS V8 coprocessor. For information on DB2 UDB for z/OS V8, refer to the DB2 Application Programming and SQL Guide. ======================================================================== 15. The following information applies to the "Anonymous unions" description in Chapter 3 of the z/OS V1R7 XL C/C++ Language Reference: The following information is incorrect: z/OS XL C supports anonymous unions only when you use the LANGLVL(COMMONC) compiler option. It should be the following: z/OS XL C supports anonymous unions only when you use the LANGLVL(COMMONC) or LANGLVL(EXTENDED) compiler options. ======================================================================== 16. The following information applies to the XPLINK compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide: The following information is incorrect: In addition, the XPLINK option requires that the value of ARCH must be 2 or greater. The compiler issues a message if you specify ARCH(0) or ARCH(1) with XPLINK and forces ARCH to 2. It should be the following: In addition, the XPLINK option requires that the value of ARCH must be 2 or greater. The compiler issues a message if you specify ARCH(0) or ARCH(1) with XPLINK and forces ARCH to the default value. ======================================================================== 17. Macro redefinition and z/OS XL C: As of z/OS V1R7, the XL C compiler will issue a severe error message (CCN3343) instead of a warning message when a macro is redefined to a value that is different from the first definition. For example: #define FOO 1 #define FOO 2 /* error */ For more information on preprocessor directives, refer to the z/OS XL C/C++ Language Reference. ======================================================================== 18. z/OS XL C++ support for IBM DB2 UDB for z/OS V7 and V8 coprocessor: As of PTFs UK19090 and UK19157, the z/OS V1R7 XL C++ compiler supports the IBM DB2 UDB for z/OS V7 and V8 levels of the coprocessor. For information on DB2 UDB for z/OS V7 and V8, refer to the DB2 Application Programming and SQL Guide. ======================================================================== 19. The following information relates to Chapter 4 of the z/OS V1R7 XL C/C++ Language Reference in "The _Packed qualifier (C only)": The following note is incorrect and should be ignored: Note: The compiler aligns pointers on their natural boundaries, 4 bytes, even in packed structures and unions. The correct information is: When the _Packed qualifier is used, the compiler removes padding between members of structures or unions, regardless of the member type. ======================================================================== 20. The following information relates to Chapter 19 of the z/OS V1R7 XL C/C++ Language Reference in the description for the __BOOL__ predefined macro: NOKEYWORD(BOOL) is incorrect. NOKEYWORD(bool) should be used instead. ======================================================================== 21. The following information relates to the OBJECTMODEL compiler option description in Chapter 4 of the z/OS V1R7 XL C/C++ User's Guide: When you compile with the OBJECTMODEL(IBM) option, and the dynamic_cast operator is used in a constructor, a destructor, or in functions called from a constructor or destructor, the dynamic_cast operator has the following behavior: - Does not return a pointer or a reference to the derived object from the class for the constructor or destructor. - Returns NULL. When you compile with the LP64 compiler option, the OBJECTMODEL(IBM) compiler option is specified along with XPLINK.