Object code control
#pragma target (C only)
Generates an object module for the targeted operating system or runtime library.
.-,------------------. | .-CURRENT--------. | V | .-LE--. | | >>-TARG--(----+-+-IMS-+--------+-+--)-------------------------->< '-+-zOSV1R12---+-' +-zOSV1R13---+ +-zOSV2R1----+ '-0xnnnnnnnn-'
TARGET(LE, CURRENT)
The following suboptions target the runtime environment:
The following suboptions target the release at program run time:
With the TARGET option, you can specify the runtime environment and release for your program’s object module that z/OS XL C/C++ generates. This enables you to generate code that is downward compatible with earlier levels of the operating system while at the same time disallowing you from using library functions not available on the targeted release. With the TARGET option, you can compile and link an application on a higher level system, and run the application on a lower level system.
If you specify a release that is out of service, the compiler issues a warning message and accepts the specified release.
The compiler generates a comment that indicates the value of TARGET in your object module to aid you in diagnosing problems in your program.
To use the TARGET option, select a runtime environment of either LE or IMS. Then select the required release, for example, zOSV1R12. If you do not select a runtime environment or release, the compiler uses the default of TARGET(LE, zOSV2R1).
TARGET() generates object code to run under the Language Environment runtime environment. It is the same as TARGET(LE,CURRENT).
If you specify more than one suboption from each group of suboptions (that is, the runtime environment, or the release) the compiler uses the last specified suboption for each group.
The compiler applies and resolves defaults after it views all the entered suboptions. For example, TARGET(LE,0x410C0000, IMS, zOSV1R12, LE) resolves to TARGET(LE, zOSV1R12). TARGET(LE, 0x410C0000, IMS, zOSV1R12) resolves to TARGET(IMS, zOSV1R12). TARGET(LE, 0x410C0000, IMS) resolves to TARGET(IMS, 0x410C0000).
The default value of the ARCHITECTURE compiler option depends on the value of the TARGET release suboption. For TARGET(zOSV2R1) and above, the default is ARCH(7).
The TARGET release suboptions (CURRENT, zOSV1R12, zOSV1R13 and zOSV2R1) help you to generate code that can be executed on a particular release of a z/OS system, and on subsequent releases.
In order to use these suboptions, you must use the z/OS V2R1 class library header files (found in the CBC.SCLBH.* data sets) during compilation.
See Prelinking and linking z/OS XL C/C++ programs for details on prelinking and linking applications.
The TARGET release suboptions will not allow you to exploit new functions provided on the newer release. Rather, they allow you to build an application on a newer release and run it on an older release.
The hexadecimal string literal suboption enables you to specify an operating system level. It is an advanced feature that is intended for library providers and vendors to test header files on future releases. Most applications should use the other release suboptions instead of this string literal. The layout of this literal is the same as the __TARGET_LIB__ macro.
The compiler checks that there are exactly 8 hexadecimal digits. The compiler performs no further validation checks.
If the level corresponds to a valid suboption name, the compiler behaves as though that suboption is specified. Otherwise, the compiler uses the next lower operating system suboption name. If there is no lower suboption name, the compiler behaves as though you have specified an unsupported release. Note that the compiler sets the __TARGET_LIB__ macro to the value that you specify, even if it does not correspond to a valid operating system level.
Only options or features that cannot be supported on that operating system level are disabled. For example, STRICT_INDUCTION is allowed on all operating system levels. An option or feature that is disabled by one operating system level is also disabled by all earlier operating system levels.
If you specify the TARGET option for any compilation unit in the IPA compile step, the compiler generates information for the IPA link step. This option also affects the regular object module if you request one by specifying the IPA(OBJECT) option.
When you are performing the IPA Compile to generate IPA Object files, ensure that you are using the appropriate header library files.
When you invoke the TARGET(OSVxRy) release suboptions, the compiler sets the __TARGET_LIB__ macro. See z/OS XL C/C++ Language Reference for more information about this macro.
The following information shows examples of using the hexadecimal string literal suboption: