IBM 4J manual Introduction to Writing Custom Programs, Compiling Custom Programs

Page 65

Chapter 4. Writing Custom Programs

Introduction to Writing Custom Programs

The Sterling Connect:Direct Application Programming Interface (API) allows you to write custom programs in either C or C++ to use with Sterling Connect:Direct. With the C functions or the C++ classes, you can create programs to perform the following tasks:

vEstablish a connection to the Sterling Connect:Direct server

vDisconnect from the server

vReceive command responses from the server

vSend commands to the server

This topic describes the format of the Sterling Connect:Direct API functions and classes and provides samples of their use. Sample programs are provided that use the Sterling Connect:Direct API functions and classes to issue commands and receive responses from the Sterling Connect:Direct server.

Compiling Custom Programs

 

After you write a custom program, you must compile it, using a C or C++

 

compiler. Refer to the following information to determine what minimum C++

 

compiler version to use for each platform:

 

 

 

Platform

 

C++ Compiler

 

 

 

AIX

 

IBM XL C++ V8.0 for AIX

 

 

 

Sun Solaris

 

SPARC/x86 C++5.7

 

 

 

HP

 

aCC: HP ANSI C++ B3910B A.03.73

 

 

 

HP-Itanium

 

aCC: HP ANSI C++ B3910B A.06.07

 

 

 

Linux

 

c++ version 3.3.3

 

 

 

 

Use the commands defined in the following table to compile a custom C++

 

program using the C++ API calls:

 

Platform

C++ Compile Command

 

 

AIX

 

 

 

64-bit

/usr/vacpp/bin/xlC -q64 -qinline -I../include -+ -o sdksample sdksample.C ../lib/ndmapi64.a -lbsd -ldl

 

-lsrc -lpthreads

 

 

32-bit

/usr/vacpp/bin/xlC -qinline -I../include -+ -o sdksample sdksample.C ../lib/ndmapi.a -lbsd -ldl -lsrc

 

-lpthreads

 

 

Sun

 

32-bit

/opt/SUNWspro/bin/CC -DBSD_COMP -I../include -o sdksample sdksample.C ../lib/ndmapi.a -L/usr/ucblib -L/usr/lib -lsocket -lrpcsoc -lnsl -lelf -ldl

Note: If /usr/ucblib is not in the LD_LIBRARY_PATH variable, add -R/usr/ucblib to the compile command.

© Copyright IBM Corp. 1999, 2013

59

Image 65
Contents User Guide Page User Guide Copyright IBM Corporation 1999 Contents Iv Sterling ConnectDirect for Unix User Guide CLI Commands Overview of the Command Line InterfaceStarting the CLI Stopping the CLIOption Description Value Entry Sample CommandCdpnum CLI Job ControlOverview of Sterling ConnectDirect Commands CLI History CommandsCommand Command Abbreviation DescriptionParameter Abbreviation Abbreviations for Common Sterling ConnectDirect CommandsParameter Description Values Submitting a ProcessPname = A?PROD5 Parameter Description Values Id , pswd Username@hostname or user@localhostName nnnnn Name host name nnn.nnn.nnn.nnn orSnodeid field Id ,pswd ,newpswdSpecify retain=initial Following command submits the Process named copyfil Following command submits the Process named payrollChanging Process Parameters Following command submits the Process named copy.cdpParameter Description Value Name generic listNode specification, userid generic list Remote node specification generic listDeleting a Process from the TCQ Number list Removing a Process from the Execution Queue Stopping Sterling ConnectDirect Flush process command has the following optional parametersParameter Description Viewing a Process in the TCQPname Locate the Process to view EX HC HE HI HO HR HS PE Monitoring Process Status in the TCQ Following command displays the specified Process numberAll EX HC HE HI HO HR HS PE Output from the command is displayed in the following table Dest=/path/file name Determining the Outcome of a ProcessRecord id list Caev Capr CAEV, CaprParameter Description Value Parameter Description Value Parameter Description Value Date day , hhmmss ampm Srcf=/path/file nameGenerating a Detailed Output Report for a Process Generating a Summary Report for a Process Running System DiagnosticsSelect Statistics Recid LOG Timepname Pnumber Stepname Ccod Fdbk MsgidCOMM.TRC Smgr Trace smgr pnode tnode=ath3500ry level=2 file=Smgp.trc Overview of the Transmission Control Queue Command DefinitionScheduling Sterling ConnectDirect Activity Scheduling Parameter Queue CommentsProgression of a Process Through the TCQ Execution Queue Status Comment Wait QueueElement Comment Hold Queue Timer QueueHeld for Call indicates that the Process was Creating a Translation Table Introduction to Translation TablesExample-Creating a Translation Table Compiling a Translation Table Using the ndmxlt UtilityExample-Modifying a Model Translation Table Using Translation During File Transfer OperationsAccessing Sterling ConnectDirect Messages Translation Table Error MessagesMessage File Content Diagnostic Number DescriptionMessage File Record Format Following is a sample ndmmsg commandDisplaying Message Text Following are the parameters for the message file recordSterling ConnectDirect for Unix User Guide Following are the parameters for the cdsacomp utility Using the Standalone Batch Compression UtilityLevel-Compression level Memory-The amountNnnnn Source codepage, destinationCodepage Example-Precompress a Text File With Codepage Conversion Example-Precompress a Text FileExample-Precompress a Binary File Example-Decompress a Text FileExamples-csdacomp Command Help Configuration Reports Validate Configuration FilesCfgcheck command has the following arguments Argument DescriptionType the following command at a Unix prompt Generating a Configuration Report on the Base InstallationSterling ConnectDirect Utilities Following example shows an excerpt from a sample report Sterling ConnectDirect Utilities Sterling ConnectDirect for Unix User Guide Introduction to Writing Custom Programs Program using the C++ API callsCompiling Custom Programs Compiler version to use for each platformYou want to create such as apicheck Platform Compile Command++ Function Description Writing Custom C ProgramsNdmerrenth Ndmerror NdmnoerrorNdmapirecvrespc Receiving Responses Using ndmapirecvresp or ndmapirecvrespcNdmapirecvresp or Parameter Description Value PNOD-PNODE SNOD-SNODE Following is a sample ndmapirecvresp functionReturn Code Description TruncatedNdmapirecvresp or ndmapirecvrespc to retrieve Ndmapisendcmdc function call has the following return codes Writing Custom C++ ProgramsFollowing is a sample ndmapisendcmd function Selectstatistics or Selectprocess , the CLISterling ConnectDirect for Unix User Guide Cdfailure Method Description Parameter Return ValuesCdsuccess = 0, Cdfailure = Following is the ConnectDirectSession class headerWriting Custom Programs Sterling ConnectDirect for Unix User Guide User Exit Functions User Exit ProgramsProgram Description Chown root exitskeletonReturn Code Goodrc ErrorrcExitprogram Waiting for a Message Using recvexitmsg or recvexitmsgcHeader Following are the parameters for sendexitmsg or sendexitmsgcFile Open Exit Messages Overview of User Exit MessagesStatistics Exit Message Fileopenoutputreplymsg Security Exit MessagesValidatemsg Validatereplymsg GeneratemsgExit Log Files User Exit Stop MessageCopy Control Block Copyright IBM Corp IBM Corporation J46A/G4 Bailey Avenue San Jose, CA Trademarks Sterling ConnectDirect for Unix User Guide Index Special characters Generatemsg Generatereplymsg Validatemsg Validatereplymsg Page Sterling ConnectDirect for Unix User Guide Page Product Number 5725-C99