CDWindows SDKGuide
CDWindows SDKGuide
Windows
Overview.....................................................................................................................................................4
Sterling Connect:Direct for Microsoft Windows SDK Overview.............................................................................................4
User Exits................................................................................................................................................................................39
Apply Enhanced Security........................................................................................................................................................39
Apply Automated File Opening...............................................................................................................................................41
Structure Types........................................................................................................................................43
Structure Types........................................................................................................................................................................43
NETMAP_DESC_STRUCT Structure....................................................................................................................................43
USER_STRUCT Structure......................................................................................................................................................44
MESSAGE_STRUCT Structure..............................................................................................................................................46
NETMAP_MODE_SNA Structure.........................................................................................................................................46
NETMAP_MODE_TCP Structure..........................................................................................................................................47
NETMAP_NODE_STRUCT Structure...................................................................................................................................47
NETMAP_PATH_STRUCT Structure....................................................................................................................................49
PROCESS_STRUCT Structure...............................................................................................................................................50
NODE_STRUCT Structure.....................................................................................................................................................52
STATISTICS_STRUCT Structure...........................................................................................................................................53
TRACE_STRUCT Structure...................................................................................................................................................54
TRANSLATE_STRUCT Structure.........................................................................................................................................55
Return Codes............................................................................................................................................57
C++ Class and the C API Functions Return Codes.................................................................................................................57
Notices.......................................................................................................................................................59
Notices.....................................................................................................................................................................................59
Distribute an Application
The following SDK files are required to be included when distributing an application developed with this SDK.
• For C++ applications:
• CdCore.dll
• For C applications:
If you are using the automation server, you must also register your Type Library files (.TLB) using regtlib.exe.
Regtlib.exe is distributed with Visual Studio 6 and above and has updates available in the service packs or in
other Microsoft Windows Library updates.
Note: CDCoreD.dll and CDCapiD.dll are debug versions and do not need to be be distributed with the
application.
Applications may also require the Microsoft Visual Studio Redistributable Runtimes. Not every system has
this installed by default.
For checking about required DLLs, Microsoft's Dependency Walker (depends.exe) is the tool to use. It lists
in detail all DLLs required by an application. The tool is included in the Resource Kit, Microsoft Windows
2000 Support Tools, Visual Studio and other packages.
Caution: Use the Sterling Connect:Direct Client Connection Utility to update Registry settings for Sterling
Connect:Direct API connections, rather than editing them directly.
You can view, edit, and update Sterling Connect:Direct for Microsoft Windows connection settings in the
Windows Registry with the Client Connection Utility. The connection settings enable communication between
the user interfaces and the Sterling Connect:Direct server. You can set up and update connection settings by:
• Adding a node
• Deleting a node
• Adding a user
• Deleting a user
• Updating node properties
• Defining a default node or user
To facilitate updating connection settings on multiple servers, you can import and export connection settings
using the Client Connection Utility. After you configure the connection for a server, you can export the server’s
settings for use on other servers. You can then import the settings into the target server’s Registry. You can
also print connection settings.
Add a Node
To add a Sterling Connect:Direct node:
1. Select File > New Node. The Node Properties dialog box displays:
Note: Changes made to node settings are not written to the Registry until you select Save.
Delete a Node
To delete a Sterling Connect:Direct node:
1. In the Client Connection Utility main window, select the node you want to delete.
2. Select Edit > Delete.
3. Click Yes to confirm the deletion.
4. Select File > Save to delete the node.
Note: Changes made to the node settings are not written to the Registry until you select Save.
The node is no longer displayed in the Client Connection Utility window.
Note: Changes made to node settings are not written to the Registry until you select Save.
Delete a User
1. If the user names are not displayed, click the plus (+) sign next to the node containing the user you want
to delete.
2. Select the user you want to delete.
3. Select Edit > Delete.
4. Click Yes to confirm the deletion.
Note: Changes made to node settings are not written to the Registry until you select Save.
Note: Changes made to node settings are not written to the Registry until you select Save.
Note: Changes made to node settings are not written to the Registry until you select Save.
Note: Importing a Registry settings file causes all current changes to the selected node to be lost if they
have not been saved.
4. Select the Registry settings file you want to import (.REX extension) and click OK. The imported Registry
settings are applied to the node you selected.
5. Select File > Save to save the settings.
Note: Changes made to node settings are not written to the Registry until you select Save.
Note: Additional node detail is provided if the node has been used at least once by the client software.
Activate Tracing
The Output window of the Microsoft Visual Studio displays trace messages.
The following table describes the tracing parameters. Use the trace parameters to activate tracing.
Standard C API
Overview
Use the Standard API functions to connect to a Sterling Connect:Direct node, execute Sterling Connect:Direct
commands, manage command response data, and retrieve error information.
The C API is implemented using the C++ Classes. This interface is used by C programmers.
Handles
Handles simplify object and memory management by referencing a particular object. Pass a handle to an API
to uniquely identify an object. The Sterling Connect:Direct C API uses the following types of object handles
to return node, Process, statistics, message, and trace information:
• Node Handles—Represent the Sterling Connect:Direct node that is the target of the operation. It is a virtual
connection to a Sterling Connect:Direct node. The node handle is a special type of object handle; it holds
information about the node but does not return data from the node.
A node handle is created by calling the CdConnect() function and passing it the node name, user ID, password,
and protocol within a NODE_STRUCT structure. After you finish with a node handle, you call the
CdCloseHandle() to close it. Closing the handle releases the virtual connection and any internal resources
associated with it. The node handle is no longer valid on subsequent operations.
Note: You are responsible for closing the node handle and for releasing any resources that you allocate.
• Process Handles—Handles returned from a submit command or from a Process object, which is created when
a select process, change process, or delete process command is executed. The following example demonstrates
the select process command returning a Process:
if (CdExecuteCommand (hNode, “SELECT PROCESS”, &hProc))
{
if (CdGetProcRec(hProc, &Proc))
{
printf("%d %s/n", Proc.ProcessNumber, Proc.ProcessName);
}
}
• Statistic Handles—Statistics objects that are returned after a select statistics command is executed.
• Message Handles—Message objects that are returned when a select message command is executed.
• Trace Handles—Trace objects that are returned when a traceon or traceoff command is executed.
Blocking
The C Application Programming Interface is synchronous; when an API that performs a complex function
(such as the CdConnect() or CdExecuteCmd() functions) is called, the caller’s thread is blocked until the
request is completed or until a failure occurs. The caller’s thread blocks while waiting for other threads to
finish the request.
If the CdConnect() function is called from a Microsoft Windows application, it should not be called from the
primary user interface (UI) thread. Calling the function from the UI thread causes the user interface of the
program to run slowly.
Note: You do not need to add the LIB to the LINK section of the project or makefile.
The CDCORED.lib and CDCORE.lib files contain the name of the DLL to dynamically load at run time and
class definitions for the linker to resolve the Sterling Connect:Direct SDK symbols included in the CDSDK.H
file. When a program executes or a DLL is loaded, the appropriate CDCORE.DLL is loaded. Applying.DLL
is dynamically loaded when a debug configuration is executed and to support a release configuration.
Manipulate Nodes
Component Group classes provide methods to make changes on a Sterling Connect:Direct node.
The Component Group classes represent Sterling Connect:Direct entities and provide methods to manipulate
an object to generate changes on the Sterling Connect:Direct node. Use the following classes to manipulate
nodes:
Class Description
CDNode Contains the high-level Sterling Connect:Direct functionality. It returns network map,
initialization parameters, and translation table information as well as User and Proxy
objects that maintain node information and execute command objects.
CDUser Contains the user functional authority information. Use to add, delete, and update
functional authorities on the Sterling Connect:Direct node, including Network map
Access Flags, Command Access Flags, Control Flags, Process Statement Flags,
and default directories.
CDProxy Contains the Sterling Connect:Direct proxy information. Use to add, delete, and
update proxy information on the Sterling Connect:Direct node. The remote user
proxy contains information for operations initiated from a remote Sterling
When using the C++ Class interface, no sequence must be followed when using the C++ classes. All objects
are self-contained and are not dependent on any other classes when fully constructed. Each object’s constructor
is different and some of the objects require another object to be built successfully.
The first and most important class is the CDNode class. This class is the first one to use when interacting with
any Sterling Connect:Direct node.
While the only prerequisite for constructing a class is the creation of the objects needed by the constructor,
the following example shows a possible sample execution sequence:
CDNode creation
CDSelectProcCommand creation
CDProcIterator creation
(Use the data)
CDProcIterator destruction
CDSelectProcCommand destruction
CDNode destruction
The Sterling Connect:Direct CDNode class serves as the virtual Sterling Connect:Direct node. It enables you
to manipulate and send commands to the actual Sterling Connect:Direct node. You manipulate this object
through the use of the CDNode methods and issue commands to the node using Command objects. Calling
these methods and using the objects sends KQV streams to the physical Sterling Connect:Direct node. See the
C++ API Reference Guide for more information.
The following two examples illustrate two different methods for creating a CDNode object. The first method
creates the CDNode object locally on the stack. The second example creates a dynamic allocation of a CDNode
object from the stack. Both methods then execute a SELECT PROCESS command using the CDNode object.
{
CDNode MyNode("MYNODE", "MYUSERID", "MYPASSWORD");
CDSelectProcCmd cmd;
//Execute the "SELECT PROCESS" command
CDProcIterator it = cmd.Execute(MyNode);
}
{
CDNode *pNode = new CDNode("MYNODE", "MYUSERID", "MYPASSWORD");
CDSelectProcCmd cmd;
//Execute the "SELECT PROCESS" command
CDProcIterator it = cmd.Execute(pNode);
delete pNode;
}
Manage Connections
Use the CDNode class to manage Sterling Connect:Direct connections. The CDNode class creates and deletes
connections to the Sterling Connect:Direct node as needed and deletes the connections if they are idle for a
specified period of time.
The connections are stored in an array and are created and assigned by the CDNode object when a command
requests a connection to the physical node. Connections are reused when they are idle and are deleted if they
remain idle for an extended period of time. Because each connection consumes resources on both the client
and the server, use them as efficiently as possible. The DisconnectAll member function is used to disconnect
all connections to all nodes.
View Information
Record Group classes allow you to view information about processes, statisitics, messages, and users.
CDStatistic
Provides two methods for holding statistics information.
GetAuditField() Method—Because audit data is optional, and different records have different KQV
keys, use a single method to access the data. To retrieve a value, call GetAuditField(), passing the
KQV key for the desired field.
The GetAuditMap() function retrieves all audit fields defined in the current record. An MFC
CMapStringToString object maps from KQV keywords to the corresponding values. This method
enables you to view each association in the map to determine what audit fields are available and to
ask the map for the value of the given field.
CDMessage Holds information about a specific message that is retrieved from the Sterling Connect:Direct node
CDUser Holds the user functional authority information to add, delete, and update functional authority information
on the Sterling Connect:Direct node.
Iterators
Commands that retrieve a single record from the server block the calling thread in the Execute() method until
the data arrives. The data is then put into a record object and returned. Other commands, like select statistics,
can potentially return hundreds of records. If the Execute() method blocks until all records are returned, it can
take longer to receive any feedback. If the records are all returned in one large block instead of being consumed
one at a time, the computer slows down.
To solve these problems, commands that potentially retrieve multiple records return an iterator object as soon
as the first record arrives. As data is returned, a background thread automatically appends to the iterator. The
iterator has a connection to the server and the command object is not involved. This method allows you to
process records as they arrive. The following example demonstrates the select process command returning a
process iterator:
CDSelectProcCmd cmd;
CDProcIterator it = cmd.Execute(node):
Note: You must always call HasMore() before calling GetNext(). It is not legal to call GetNext() if there are
no records.
• GetNext()—If HasMore() returns TRUE, obtain the next record in the list using this command. It removes
the next record from the list and returns it.
When all records are received from the server, the server notifies the iterator that the command is complete.
After all records are removed using GetNext(), HasMore() returns FALSE.
If the iterator’s list is empty, but the server has not notified the iterator that the command is complete, the
iterator cannot determine whether there are more records. In this case, HasMore() blocks until more records
are received from the server or a completion notification is received. Only then can the iterator return TRUE
or FALSE.
The following is an example of accessing statistics records using an iterator:
CDSelectStatCmd cmd;
CDStatIterator it = node.Execute (cmd);
while (it.HasMore()) {
CDStatistic stat = it.GetNext();
// use the statistics object }
CDSelectStatCmd Derived from the CDCommand base class, it enables you to set the SELECT STATISTICS
parameters. When you call the Execute() method, an iterator data object is dynamically created
and attached to the connection assigned by the CDNode object to execute the command.
CDChangeProcCmd Derived from the CDCommand base class, it enables you to set the CHANGE PROCESS
parameters. When the Execute() method is called, an iterator data object is dynamically created
and attached to the connection assigned to execute the command. A CDProcIterator is attached
to the iterator data and returned from the Execute() method.
CDDeleteProcCmd Derived from the CDCommand base class, it enables you to set the DELETE PROCESS
parameters. When the Execute() method is called, a CDProcData object is dynamically created
and attached to the connection assigned to execute the command. A CDProcIterator is attached
to the iterator data and returned from the Execute() method.
CDSelectMsgCmd Derived from the CDCommand base class, it enables you to set the SELECT MESSAGE
parameters. When you call the Execute() method, the command is executed and the resulting
message text is stored in the internal CDMessage object
CDStopCmd Derived from the CDCommand base class, it enables you to set the STOP parameter. When you
call the Execute() method, the command is executed.
CDSubmitCmd Used for submitting a Process object for execution on a node. It enables you to set the options
of the SUBMIT command and then execute the command on a node. When you call the Execute()
method, a CDProcess object is dynamically created and attached to the connection assigned to
execute the command. The following example demonstrates the CDSubmitCmd class:
.
.
.
CDSubmitCmd cmd;
cmd.SetFile ("myproc.cdp");
CDProcess proc = node.Execute(cmd);
proc.WaitForCompletion();
.
.
.
CDTraceOnCmd Derived from the CDCommand base class, it enables you to set and retrieve trace options from
the Sterling Connect:Direct node. The TraceOnCmd class handles all the options available from
the TRACEON command. The Execute() method returns a CDTrace object that contains the
current trace state.
CDTraceOffCmd Derived from the CDCommand base class, it enables you to clear trace options from the Sterling
Connect:Direct node. The CDTraceOffCmd class handles all of the options available from the
TRACEOFF command. You call methods to clear the desired trace parameters and then call the
Execute() method. The Execute() method returns a CDTrace object that contains the current
trace state.
CDLogonDlg
The Sterling Connect:Direct common logon dialog box enables you to write your own logon
applications. The CDLogon dialog box enables you to change the node, the user ID and
password to connect to the Sterling Connect:Direct node as well as enable the Remember
Password check box, click the Configure button to save new server logon information and
change the title.
Below are the components of the CDLogonDlg class:
Node—Specifies the Sterling Connect:Direct node to which the user wants to logon.
userid—Specifies the user ID for the Sterling Connect:Direct node.
Password—Specifies the password defined for the user ID.
Remember Password—Specifies whether the user wants the password to persist after the
user logs off. If the check box is enabled, the password is retrieved to set the password field
of the dialog box when the logon dialog is displayed. This prevents the user from having to
re-type the password information for the session. Enabling the check box also specifies
whether or not to write the password information as nonvolatile data. Nonvolatile keys persist
after the user logs off. If the user does not enable the Remember Password check box, the
password only persists until the user logs off.
The Sterling Connect:Direct Logon dialog box does not perform the logon. It captures the
entries and returns them to the calling program.
Normally, the programmer creates a CDLogon dialog box, sets the parameters, and calls the
DoModal() function to display and run the dialog box. If the user clicks the OK button, then
the CDLogonDlg class returns IDOK and a logon is attempted using the supplied connection
information. If the user clicks the Cancel button, the CDLogonDlg class returns IDCANCEL
and the logon is cancelled.
After a user successfully logs on to the Sterling Connect:Direct node, the connection
information is written to the Registry under the HKEY_CURRENT_USER key.
CDExceptionDlg Displays the exception dialog box. The dialog box displays the information in the exception
object
CDThread Coordinates the clean termination of threads and provides a thread class that can unblock
object
Terminate A Thread
In the preceding sample code, the only blocking that takes place is in the Execute() function. Execute() blocks
until the Process information returns from the server. To terminate the thread without waiting, call
CDThread::Exit, which signals any blocking CD objects in the thread to stop blocking and throw a thread exit
exception. In the previous example, if CDThread::Exit is called, an exception is thrown, and no return object
is returned from the Execute() function.
Note: It is not possible for one thread to throw an exception in another. CDThread::Exit sets flags in the
CDThread object that other CD objects use.
Caution: Do not call the Win32 TerminateThread. TerminateThread does not give the thread a chance to shut
down gracefully. Calling TerminateThread can corrupt the state of the CD objects. CD objects use critical
sections and other resources that must be managed carefully.
Submit Process
The Sterling Connect:Direct CDSubmit control is a command line control that submits Processes to the server.
Because submitting a Process can be a lengthy procedure, the Execute command returns immediately. When
a Process is submitted and the server responds, or a time-out occurs, the client is notified through the
SubmitStatus event. Additionally, the client can request notification when the Process has completed on the
server. Properties for the CDSubmit control follow:
Property Description
Node=nodename The name of the node that you want to connect to. The node name must be valid in the
Microsoft Windows system Registry.
User=userid The user ID used to log on to the Sterling Connect:Direct node.
Password=password The password used by the user ID to log on to the node.
Text=text The text of the Process.
Methods
Use the following methods to submit a process:
Method Description
Execute(BOOL bWait) Submits the Process to the server. An event is fired when the server responds to
notify the client of the status of the submit. If bWait is TRUE, another event is fired
when the Process completes on the server.
SetSymbolic(symbolic, value) Sets the symbolic value for symbolic. Call for each symbolic in the Process.
ClearSymbolics Clears all symbolics. Call before submitting a Process to clear the previous values.
Events
The following events are activated by the CDSubmit control:
Error
The standard error event. Possible codes are:
CTL_E_PERMISSIONDENIED—cannot log onto the node.
CTL_E_DEVICEUNAVAILABLE—cannot connect to the node.
CTL_E_OUTOFMEMORY—out of memory.
CTL_E_ILLEGALFUNCTIONCALL—an unknown error. The error message describes the
error.
Properties
The following table lists the CDStatistics control properties:
Property Description
ColCount=nnnnn The number of columns to display. The range for the ColCount value is 1–32,000.
Col=nnnnn The current column. The range for the Col value is 1–32,000.
ColWidth=nnnnn The width of the current column (Col) in pixels. The range for the ColWidth value
is 0–32,000.
Header The column header text for the current column. Provide text for the value or leave
it blank.
Row=nnnnn... The current row. If set to 0, the current row is the header. The range for the Row
value is 0–Infinity, where the number of rows is limited only by memory.
RowCount=positive integer The number of rows in the list, not including the header. This field is read-only and
is determined by the number of records returned by the server.
Node=node name The name of the node to which you want to connect. The node name must be
valid in the Microsoft Windows NT system Registry.
Password=password The password defined to allow the user ID to log onto the node.
Field The statistics structure field the current column is displaying. Valid values are
Process Name, Process Number, Condition Code, Feedback, MsgId, MsgText,
MsgData, LogDateTime, StartDateTime, StopDateTime, Submitter, SNode, RecCat,
and RecId.
ccode=(operator, code) Selects statistics records based on the completion code operator and return code
values associated with step termination. The condition code operator default is
eq. You must specify the return code. Refer to dfile=destination filename | (list)
below for valid operators and values.
pname=Process name | generic | (list) Selects Process statistics by Process name, a generic name, or a list of names.
The name can be 1–8 alphanumeric characters long.
pnumber=Process number | (list) Selects statistics by Process number or a list of Process numbers. Sterling
Connect:Direct assigns the Process number when the Process is submitted.
rnode=remote node name | generic | Selects statistics file records by remote node name, a generic node name, or a
(list) list of node names. The range for the remote node name is 1–16 alphanumeric
characters long.
sfile=filename | (list) Searches all copy Process Termination records (CAPR category, CTRC record
ID) to find those with a source file name matching the name or list of names you
specify.
recids=record id | (list)
Specifies selection by record ID or a list of record IDs. This parameter identifies
particular types of statistics records, such as a copy termination records or
initialization event records.
AUPR — Authorization file processing
CHGP — Change Process command issued
COAC — Communication activated
CMLT — CMGR listen thread terminated
CRHT — Sterling Connect:Direct copyright
CSTP — Child Process stopped
CTRC — Copy control record written
CTRM — Child Process terminated
CUKN — Child Process unknown status
CXIT — Child Process exited
DELP — Delete Process command issued
FLSP — Flush Process command issued
FMRV — Formatted Header (FMH) received
FMSD — Formatted Header (FMH) sent
GPRC — Get Process issued
IFED — If statement ended
IPPR — Initialization parameter processing
LIOK — Listen okay
NAUH — Node Authorization check issued
NMOP — Network map file opened
NMPR — Network map processing
NUIC — Sterling Connect:Direct Initialization complete
NUIS — Sterling Connect:Direct start initialization
NUT1 — Sterling Connect:Direct phase one termination complete status
NUT2 — Sterling Connect:Direct phase two termination complete status
NUTC — Sterling Connect:Direct termination complete
NUTR — Sterling Connect:Direct termination requested
NUTS — Sterling Connect:Direct termination started
PERR — Process error detected
BOOL Execute() Executes the SELECT STATISTICS command and stores the returned records in the control.
If the control was already retrieving records, the previous command is stopped and the old
records are removed from the control.
Clear Clears the existing records from the display. The Clear method does not stop retrieval.
Events
The following events are controlled by CDStatistics.
Method Description
Error
The standard error event. Possible codes are:
CTL_E_PERMISSIONDENIED—cannot log onto the node.
CTL_E_DEVICEUNAVALIABLE—cannot connect to the node.
CTL_E_OUTOFMEMORY—out of memory.
CTL_E_ILLEGALFUNCTIONCALL—an unknown error.
The Sterling Connect:Direct Automation Server Node provides the following methods:
Method Description
SelectStats(criteria) Criteria specifies the complete SELECT STATISTICS string.
SelectProc(criteria) Criteria specifies the complete SELECT PROCESS string.
Submit(text) The text specifies the Process to SUBMIT.
ProcessNumber Long The Process number assigned by Sterling Connect:Direct when the
Process is placed in the TCQ.
SchedDateTime Date The date and time the Process is scheduled to be submitted.
SubmitNode String The name of the node from which the Process was submitted.
Retain String Specifies whether the Process is to be retained in the TCQ for future
submission.
Queue String The logical queue where the Process is currently located (Execution,
Hold, Wait, or Timer).
LocalNode String Specifies whether the primary or secondary node is the local node
and has primary control.
FromNode String Specifies whether the primary or secondary node is the source node
in a copy.
ProcessNumber Long The Process number assigned by Sterling Connect:Direct when the Process is
placed in the TCQ.
GetAuditField String
Returns the audit field value.
The GetAuditField() function supports the following audit information field names:
"Step Name"
"Primary Node Name"
"Secondary Node Name"
"Link Fail"
"Translation"
"Status"
"Function"
"Member Name"
"Sysopts"
"Bytes Read"
"Records Read"
"Bytes Sent"
"RUs Sent"
"Bytes Written"
"Records Written"
"Bytes Received"
"RUs Received"
"RU Size"
"Local Condition Code"
"Local Message ID"
"Other Condition Code"
"Other Message ID"
"PNode Accounting Info"
"SNode Accounting Info"
"Local Node"
"Retain"
"Class"
"Priority"
"Execution"
"Standard Compression"
"Extended Compression"
"Checkpoint"
"Scheduled Date/Time"
"Start Date/Time"
"Stop Date/Time"
"Submit Date/Time"
"From Node"
"Queue"
"Restart"
"Function"
"Source File"
"Source Disposition #1"
"Source Disposition #2"
"Source Disposition #3"
"Destination File"
"Destination Disposition #1"
"Destination Disposition #2"
"Destination Disposition #3"
"Hold"
"Substitution String"
"Submitter Node"
To determine the node you want to connect to, set the properties of the factory object. Next, call CreateNode
to connect to the node. If the connection is successful, a node object returns. Otherwise, an error is thrown
indicating the cause of the problem.
factory.NodeName = “CD.Node1"
factory.UserId = “user1"
factory.Password = “password”
{
Dim node as Object
Set node = factory.CreateNode()
The node name refers to the name used by the Client Connection Utility. You must set up the nodes that you
want to connect to using the Client Connection Utility prior to using the Sterling Connect:Direct SDK.
Node Usage
The node object represents the connection to a Sterling Connect:Direct node. Using the node enables you to
select statistics or Processes.
Select Processes
To select Processes, you must first format a select Process command and pass it to the SelectProc method. The
records return as Process objects and are stored in the ProcCollection container. Because a background thread
populates the collection, it is returned to the caller before it is completely filled. Therefore, the only access
method available is using the For Each construct.
Note: The usual Count property is not available because the count is not known until all records are returned.
Dim procs as Object ; the process collection
Dim proc as Object ; each process record
Set procs = node.SelectProc ("SELECT PROCESS ")
For Each proc in procs
Debug.Print proc.ProcessName
Next proc
Select Statistics
To select statistics records, you must format a select statistics command and pass it on to the SelectStats method
of the node. The records return as Statistic objects stored in a StatCollection container. Because a background
thread populates the collection, it returns to the caller before it is completely filled. Therefore, the only access
method available is using the For Each construct.
Because the server can send records slowly, the interface can be jerky while reading records. Because records
are read using a background thread, it useful to select the statistics before time-consuming tasks like constructing
windows. This method enables the server to send records in background.
User Exits
You can customize Sterling Connect:Direct operations with user exits. User exits are user-defined dynamic
link libraries (DLLs) that are loaded and called when the user exit is enabled through an initialization parameter.
Two user exits are provided: one for enhanced security and one for automated file opening.
Structure Types
Following is a list of the common C and C++ Class interface structures, constants, and their descriptions.
• NETMAP_DESC_STRUCT Structure
• USER_STRUCT Structure
• MESSAGE_STRUCT Structure
• NETMAP_MODE_SNA Structure
• NETMAP_MODE_TCP Structure
• NETMAP_NODE_STRUCT Structure
• NETMAP_PATH_STRUCT Structure
• PROCESS_STRUCT Structure
• NODE_STRUCT Structure
• STATISTICS_STRUCT Structure
• TRACE_STRUCT Structure
• TRANSLATE_STRUCT Structure
All of the common C and C++ Class API structures are contained within the CONNDIR.H header file.
NETMAP_DESC_STRUCT Structure
The NETMAP_DESC_STRUCT structure contains the Netmap Node Description information. Use this
structure to retrieve and set the Netmap Node Description information.
Structure
struct Netmap_Desc_Struct
{
TCHAR Name[MAX_NODE_NAME_LEN+1];
TCHAR ContactPhone[MAX_PHONE_NUMBER+1];
TCHAR ContactName[MAX_CONTACT_NAME+1];
TCHAR Description[MAX_DESCRIPTION+1];
Members
Member Description
ContactPhone [MAX_PHONE_NUMBER+1] The phone number of the person responsible for this node.
ContactName [MAX_CONTACT_NAME+1] The name of the person responsible for this node.
USER_STRUCT Structure
The USER_STRUCT structure contains the User Functional Authority information. Use this structure to
retrieve and set user functional authorities.
Structure
struct User_Struct
{
TCHAR Name [MAX_OBJECT_NAME+1];
TCHAR UpdateNetmap;
TCHAR UpdateUser;
TCHAR UpdateProxy;
TCHAR ChangeProcess;
TCHAR DeleteProcess;
TCHAR SelectProcess;
TCHAR SubmitProcess;
TCHAR SelectStats;
TCHAR SecureRead;
TCHAR SecureWrite;
TCHAR Stop;
TCHAR Trace;
TCHAR SelectNetmap;
TCHAR SelectMessage;
TCHAR Refresh;
TCHAR ProcessCopy;
TCHAR ProcessRunJob;
TCHAR ProcessRunTask;
TCHAR ProcessSubmit;
TCHAR InheritRights;
TCHAR TrusteeAssign;
TCHAR UpdateACL;
TCHAR FileAttributes;
TCHAR SNodeId;
TCHAR ExecutionPriority;
TCHAR ProcessSend;
TCHAR ProcessReceive;
TCHAR UpdateTranslation;
Members
Member Description
SecureRead Gives a user permission to read Sterling Connect:DirectSecure Plus network map fields.
SecureWrite Gives a user permission to modify Sterling Connect:Direct Secure Plus network map
fields.
Stop Gives a user permission to issue the STOP Sterling Connect:Direct server command.
Trace Gives a user permission to start and stop Sterling Connect:Direct tracing.
SelectNetmap Gives a user permission to get the network map objects from the Sterling Connect:Direct
server.
SelectMessage Gives a user permission to get Sterling Connect:Direct message information from the
Sterling Connect:Direct server.
ProcessRunJob Gives a user permission to issue a RUN JOB command within a Process.
ProcessRunTask Gives a user permission to issue a RUN TASK command within a Process.
MESSAGE_STRUCT Structure
The MESSAGE_STRUCT structure contains the Sterling Connect:Direct message information. Use this
structure to retrieve the message information. It contains the unique message identifier.
Structure
struct Message_Struct
{
TCHAR MsgId[MAX_MESSAGE_ID+1];
int ConditionCode;
int Feedback;
TCHAR MsgText[MAX_MESSAGE_TEXT+1];
TCHAR MsgData[MAX_MESSAGE_DATA+1];
};
typedef struct Message_Struct MESSAGE_STRUCT;
Members
Member Description
MsgId [MAX_MESSAGE_ID+1] The message identifier that uniquely identifies this message.
NETMAP_MODE_SNA Structure
The NETMAP_MODE_SNA structure contains the Netmap SNA Mode information. This structure is part of
the NETMAP_MODE_STRUCT for SNA modes.
Members
Member Description
NETMAP_MODE_TCP Structure
The NETMAP_MODE_TCP structure contains the Netmap TCP/IP Mode information. This structure is part
of the NETMAP_MODE_STRUCT for TCP/IP modes.
Structure
struct Netmap_Mode_Tcp
{
long lBufferSize;
long lPacingSendCount;
long lPacingSendDelay;
char tcp_crc[4];
};
typedef struct Netmap_Mode_Tcp NETMAP_MODE_TCP;
Members
Member Description
NETMAP_NODE_STRUCT Structure
The NETMAP_NODE_STRUCT structure contains the Netmap node information. Use this structure to retrieve
and set the Netmap node information.
Members
Member Description
Structure
struct Netmap_Path_Struct
{
TCHAR Name[MAX_OBJECT_NAME+1];
BOOL bDetail;
int Transport;
int Adapter;
BYTE Address[MAX_ADDRESS];
char CustomQLLC[MAX_CUSTOM_ADDRESS+1];
int Protocol;
TCHAR SnaProfileName[MAX_PROFILE_NAME+1];
TCHAR SnaLocalNetId[MAX_LOCALNETID+1];
TCHAR SnaPUName[MAX_PUNAME+1];
TCHAR SnaLUName[MAX_LUNAME+1];
int SnaLULocAddr;
int SnaLUSessLimit;
int TCPMaxTimeToWait;
int DialupHangon;
char DialupEntry[MAX_DIALUP_ENTRY+1];
char DialupUserid[MAX_OBJECT_NAME+1];
char DialupPassword[MAX_OBJECT_NAME+1];
TCHAR ModeName[MAX_OBJECT_NAME+1];
};
typedef struct Netmap_Path_Struct NETMAP_PATH_STRUCT;
Members
Member Description
PROCESS_STRUCT Structure
The PROCESS_STRUCT structure contains the Sterling Connect:Direct Process information. This structure
is sent to the client from the Sterling Connect:Direct server upon accepting a Process for execution. It is also
sent in response to a SELECT PROCESS command. It contains the Process name, Process number, and queue.
Structure
struct Process_Struct
{
TCHAR ProcessName[MAX_PROCESS_NAME+1];
DWORD ProcessNumber;
int ConditionCode;
int Feedback;
TCHAR MsgId[MAX_MESSAGE_ID+1];
TCHAR MsgText[MAX_MESSAGE_TEXT+1];
TCHAR MsgData[MAX_MESSAGE_DATA+1];
time_t LogDateTime;
time_t SchedDateTime;
TCHAR SubmitNode[17];
TCHAR Submitter[65];
TCHAR PNode[17];
TCHAR SNode[17];
TCHAR Status[3];
TCHAR Retain;
TCHAR Hold;
int Class;
int Priority;
int ExecPriority;
TCHAR Queue[5];
TCHAR Function[6];
TCHAR StepName[9];
TCHAR LocalNode;
TCHAR FromNode;
BOOL bStandardCompression;
BOOL bExtendedCompression;
Members
Member Description
NODE_STRUCT Structure
The NODE_STRUCT structure contains the Sterling Connect:Direct node information. This structure contains
the node name, the login information, operating system information, and protocol information. This information
is stored in the Registry and is sent to the client after successfully logging on.
Structure
struct Node_Struct
{
TCHAR Name[MAX_NODE_NAME_LEN+1];
TCHAR CDName[MAX_NODE_NAME_LEN+1];
Members
Member Description
STATISTICS_STRUCT Structure
The STATISTICS_STRUCT structure contains the Sterling Connect:Direct statistics information for a Process.
This structure is sent to the client as a result of a SELECT STATISTICS command.
Structure
struct Statistic_Struct
{
TCHAR ProcessName[MAX_PROCESS_NAME+1];
DWORD ProcessNumber;
Members
Member Description
TRACE_STRUCT Structure
The TRACE_STRUCT structure contains the trace information. Use this structure to retrieve the trace
information.
Structure
struct Trace_Struct
{
TCHAR cMainLevel;
TCHAR cCommLevel;
Members
Member Description
TRANSLATE_STRUCT Structure
The TRANSLATE_STRUCT structure contains the translation table information. Use this structure to retrieve
and set the translation table information.
Structure
struct Translate_Struct
{
TCHAR Filename[MAX_OBJECT_NAME+1];
BYTE Table[256];
Members
Member Description
FileName [MAX_OBJECT_NAME+1] The name of the file where the translation information is stored.
CD_NODENAME_ERROR The Name field not set and the default not found.
CD_LOGON_ERROR Error while logging on to the Sterling Connect:Direct server. The user ID or
password may be invalid.
CD_CANCEL An error occurred creating the dialog box or retrieving the entered information.
CD_BUFFER_ERROR The buffer is not big enough to hold all of the items in the list.
Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area.
Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product, program, or service that does
not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility
to evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not grant you any license to these patents. You can send license inquiries, in
writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte character set (DBCS) information, contact the IBM Intellectual
Property Department in your country or send inquiries, in writing, to:
Intellectual Property Licensing
Legal and Intellectual Property Law
IBM Japan Ltd.
1623-14, Shimotsuruma, Yamato-shi
Kanagawa 242-8502 Japan
The following paragraph does not apply to the United Kingdom or any other country where such provisions
are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES
THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in