Creating a 64-bit application under z/OS® batch is similar to creating a 31-bit application. There are, however, some subtle differences, which the following C++ example demonstrates.
As of z/OS C/C++ V1R6, new PROCs are available for binding and running with 64-bit applications. There are no new PROCs for a 64-bit compile (without binding or running) but you can use the previously existing C and C++ PROCs, along with the LP64 compiler option, to create 64-bit object files that can then be used with the new 64-bit enabled PROCs. Then, rather than using the regular binding PROCs (such as CBCB and EDCCBG), you need to use the new 64-bit PROCs for binding; for example, CBCQB and EDCQCBG.
#include <iostream>
void lp64_function() {
#ifdef _LP64
std::cout << "Hello World, z/OS has 64-bit programs now!" << std::endl;
#else
std::cout << "Uh oh, someone didn't compile this file with LP64" << std::endl;
#endif
}
HELLO2.C
void lp64_function();
int main() {
lp64_function();
}
//USERID JOB (641A,2317),'Programmer Name',REGION=128M,
// CLASS=B,MSGCLASS=S,NOTIFY=&SYSUID;,MSGLEVEL=(1,1)
//ORDER JCLLIB ORDER=(CBC.SCCNPRC)
//*---------------------------------------------------------------------
//* C++ Compile using LP64 compiler option
//*---------------------------------------------------------------------
//COMPILE EXEC CBCC,
// INFILE='USERID.LP64.SOURCE(HELLO1)',
// OUTFILE='USERID.LP64.OBJECT(HELLO1),DISP=SHR',
// CPARM='OPTFILE(DD:OPTIONS)'
//OPTIONS DD DATA,DLM='/>'
LP64
/>
//*---------------------------------------------------------------------
//* C++ 64-bit Compile, Bind, and Go Step
//*---------------------------------------------------------------------
//COBINDGO EXEC CBCQCBG,
// INFILE='USERID.LP64.SOURCE(HELLO2)',
// OUTFILE='USERID.LP64.LOAD(HELLO),DISP=SHR'
//BIND.SYSIN DD DATA,DLM='/>'
INCLUDE OBJECT(HELLO1)
/>
//OBJECT DD DSN=USERID.LP64.OBJECT,DISP=SHR