Example: This example shows you how to IPA Compile both a C source file and a C++ source file in 64-bit mode, then IPA Link them, bind them (in 64-bit mode), and run the resulting load module.
//SYSIN DD DATA,DLM='/>'
INCLUDE OBJECT(HELLO)
INCLUDE SYSLIB(C64,IOSX64)
INCLUDE SYSLIB(CELQSCPP,CELQS003)
/>
//OBJECT DD DSN=USER.TEST.OBJECT,DISP=SHR
//USERID JOB (641A,2317),'Programmer Name',REGION=128M,
// CLASS=B,MSGCLASS=S,NOTIFY=&SYSUID;,MSGLEVEL=(1,1)
//ORDER JCLLIB ORDER=(CBC.SCCNPRC)
//*---------------------------------------------------------------------
//* 64-bit C IPA Compile
//*---------------------------------------------------------------------
//IPACOMP1 EXEC EDCC,
// OUTFILE='USERID.IPA.LP64.OBJECT(OBJECT1),DISP=SHR',
// CPARM='OPTFILE(DD:OPTIONS)'
//SYSIN DD DATA,DLM='/>'
#include <time.h>
#include <string.h>
int get_time_of_day(char* output) {
time_t time_val;
struct tm* time_struct;
char* time_string;
if ( -1 != time(&time_val;) ) {
time_struct = localtime(&time_val;);
if ( NULL != time_struct ) {
time_string = asctime(time_struct);
if ( NULL != time_string ) {
strcpy(output, time_string);
output[strlen(output) - 1] = 0;
return 0;
}
}
}
return 1;
}
/>
//OPTIONS DD DATA,DLM='/>'
IPA(NOOBJECT,NOLINK) LP64 LONGNAME OPT
/>
//*---------------------------------------------------------------------
//* 64-bit C++ IPA Compile with very high optimization
//*---------------------------------------------------------------------
//IPACOMP2 EXEC CBCC,
// OUTFILE='USERID.IPA.LP64.OBJECT(OBJECT2),DISP=SHR',
// CPARM='OPTFILE(DD:OPTIONS)'
//SYSIN DD DATA,DLM='/>'
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::string;
extern "C" int get_time_of_day(char*);
int main() {
char* tod;
tod = new char[100];
if ( 0 == get_time_of_day(tod) ) {
cout << "The current time is: " << tod << endl;
} else {
cout << "Error: Could not determine the time" << endl;
}
delete tod;
return 0;
}
/>
//OPTIONS DD DATA,DLM='/>'
IPA(NOOBJECT,NOLINK) LP64 OPT(3)
/>
//*---------------------------------------------------------------------
//* 64-bit C++ IPA Link
//*---------------------------------------------------------------------
//IPALINK EXEC CBCQI,
// OUTFILE='USERID.IPALINK.LP64.OBJECT(IPAOBJ),DISP=SHR',
// IPARM='IPA(LEVEL(2),MAP) LONGNAME'
//SYSIN DD DATA,DLM='/>'
INCLUDE OBJECT(OBJECT1)
INCLUDE OBJECT(OBJECT2)
INCLUDE SYSLIB(C64,IOSX64)
INCLUDE SYSLIB(CELQSCPP,CELQS003)
/>
//OBJECT DD DSN=USERID.IPA.LP64.OBJECT,DISP=SHR
//*---------------------------------------------------------------------
//* C++ 64-bit Bind and Go Step
//*---------------------------------------------------------------------
//BINDGO EXEC CBCQBG,
// INFILE='USERID.IPALINK.LP64.OBJECT(IPAOBJ)',
// OUTFILE='USERID.LP64.LOAD(FINALEXE),DISP=SHR'
//SYSIN DD DATA,DLM='/>'
INCLUDE OBJECT(IPAOBJ)
/>
//OBJECT DD DSN=USERID.IPA.LP64.OBJECT,DISP=SHR