home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 14 Text
/
14-Text.zip
/
da2inf.zip
/
DA2LVL3.TXT
< prev
next >
Wrap
Text File
|
1994-02-16
|
48KB
|
1,600 lines
DISTRIBUTED APPLICATION/2
_________________________
INTRODUCING DISTRIBUTED APPLICATION/2
_____________________________________
Distributed Application/2 (DA/2) is a set of application programming inter-
faces (API's) that provide a simple and consistent way to access interprocess
and network communication functions under Operating System/2(*) (OS/2*) 2.0
and 2.1. DA/2 supplies a set of API's through the concepts of OPEN, WRITE,
READ, and CLOSE that provide an easy mechanism for communicating between a
server and a client. Additional event API's provide a mechanism for synchro-
nizing communication between a server and multiple clients.
SUPPORTED COMMUNICATIONS PROTOCOLS
DA/2 supports the following communication protocols:
o Advanced program-to-program communication (APPC)
- OS/2 to OS/2
- OS/2 to IMS
- OS/2 to CICS/MVS
- OS/2 to user written platforms
o NetBIOS
- IBM and Novel(**) networks
o OS/2 named pipes
By supporting multiple protocols, Distributed Application/2 API's can be used
to communicate between two processes in an application, two modules across a
network, or within a process on a single machine. You choose the protocol
you wish to use for each communication conversation at run-time without
changing or recompiling your code.
You can also use Distributed Application/2 to:
o Communicate with the native advanced program-to-program communication
(APPC) calls supported by the Information Management System (IMS) version
4.1 or IMS version 3 using the LU 6.1/LU 6.2 adapter for applications on
an MVS host system.
o Communicate with Customer Information Control System/MVS (CICS/MVS) or
Customer Information Control System/ESA (CICS/ESA) applications that do
not use CICS 3270 maps. This is accomplished with the use of a CICS
Access Tool that is provided with Distributed Application/2.
Communications with the Distributed Application/2 CICS Access Tool is
accomplished with a simple set of character string instructions.
---------------
(*) IBM, Operating System/2, and OS/2 are trademarks of the IBM Corporation
in the United States and other countries.
(**) Novell is a trademark of Novell, Inc.
IBM
o Communicate with user written native advanced program-to-program communi-
cation (APPC) applications on other platforms.
SUPPORTED LANGUAGES
Programmers have the flexibility to write distributed applications in mul-
tiple programming languages. The supported programming languages are:
o 32 bit C
o REXX
o Any other language that can call 32 bit C functions
IBM
MAJOR BENEFITS
______________
o It is simple, easy to learn but powerful. The API's are simple but they
also include features specifically designed to make synchronization
between components easier.
o API's hide the complexity of the supported communications protocols so
that the programmer only needs to focus on the programming interface.
o You select the communication protocol at run-time without changing or
recompiling your code.
o Because Distributed Application/2 totally hides the communication proto-
cols to the application, programmers can develop and test distributed
applications in a single machine. They can then distribute them to the
final running machines without program modifications.
MAJOR FUNCTIONS OF DISTRIBUTED APPLICATION/2
____________________________________________
o Transfers data with the concepts of OPEN, WRITE, READ, and CLOSE
- Interfaces are the same for all communication protocols
- READ and WRITE API's are asynchronous
o One server can manage concurrent conversations with multiple clients
o Full duplex communications between OS/2 client/server
o C and REXX languages are supported.
o Multiple IPC and network protocols are supported
o Communication protocol is selected at run time
o Connection definition tool exploits CUA '91 interfaces
o Reentrant programming allows concurrent clients
o Easy to use, graphical installation procedure.
o Extensive online guide and reference documentation.
o Easy to imbed DA/2 into your application.
- Customizable online help.
- Runtime module rename utility
IBM
SIMPLE CLIENT/SERVER COMMUNICATION TASKS
________________________________________
A distributed application consists of two or more programs that share data by
communicating with one another, usually across a network.
For two programs to communicate, they must perform four basic communication
tasks. Each of these functions is provided by one of the Distributed
Application/2 API's:
+--------------------------------------------------+------------------------+
| TASK | API |
+--------------------------------------------------+------------------------+
| Open a new communication channel between the two | DAOpen |
| programs. | |
+--------------------------------------------------+------------------------+
| Close the channel, terminating communication | DAClose |
| between the two programs. | |
+--------------------------------------------------+------------------------+
| Receive data sent by the communication partner. | DARead |
| | |
+--------------------------------------------------+------------------------+
| Send data to the communication partner. | DAWrite |
| | |
+--------------------------------------------------+------------------------+
USAGE
_____
After installing Distributed Application/2, you write a client or server
application program using the DA/2 API's. The server program may already
exist if you are communicating with an existing application using native
APPC, the IMS adapter or the CICS Access Tool.
Next, you choose and configure the communication protocol using the DA/2 con-
nection definition tool (see later section). After testing the application,
you package it together with the DA/2 runtime modules, connection definition,
and deliver it to your end-users.
EXAMPLE OF THE FLOW OF A SIMPLE CLIENT / SERVER USING DISTRIBUTED
APPLICATION/2
1. The client application establishes a connection to the server by issuing
the DAOpen API with the DA_INIT option as a parameter. The connection
name should match with the symbolic name of the connection profile.
2. The server program in the server machine can then accept the connection
by issuing the DAOpen API with DA_ACCEPT as the option.
3. After successful connection the client application can send data to the
server application by issuing the DAWrite call. The data can then be
received by the server using the DARead API.
IBM
4. After the server program obtains some data, the client and server appli-
cation can exchange the information by issuing the DAWrite and DARead
API's.
5. When there is no more need to communicate, the client and server can
close the connection with the DAClose API.
Many times a program needs to handle communication asynchronously--that is,
with the ability to continue processing while waiting for a communication
request to complete. Distributed Application/2 provides asynchronous communi-
cation through the DA_NOWAIT option in the DARead API.
SERVER COMMUNICATING WITH MULTIPLE CLIENTS
Distributed Application/2 provides a set of API's which will allow a single
instance of a server program to manage connection and data events coming from
multiple clients. They are:
+------------------------+--------------------------------------------------+
| API | DESCRIPTION |
+------------------------+--------------------------------------------------+
| DAIdentifyResource | Instructs Distributed Application/2 to associate |
| | the calling process with a symbolic name |
+------------------------+--------------------------------------------------+
| DAWaitOnEvent | Instructs Distributed Application/2 to notify |
| | the calling program of any events intended fr |
| | it. |
+------------------------+--------------------------------------------------+
| DATerminateResource | Instructs Distributed Application/2 to discon- |
| | tinue notification of events intended for |
| | thespecified symbolic name |
+------------------------+--------------------------------------------------+
IBM
CUSTOMIZING THE CONNECTION PROFILES OF DISTRIBUTED APPLICATION/2
________________________________________________________________
THE CONNECTION PROFILES
When two applications are to communicate to each other, a connection name is
referenced during run time for the type of communication protocol and other
related parameters to be used. The connection name information is kept in
connection profiles. These profiles are stored in a file called IBMDABB.CP.
The profile provides Distributed Application/2 with the details of how to
open the connection. When a new connection is opened, Distributed
Application/2 checks the connection profile for the specified destination to
determine:
o Which protocol to use
o Where the destination program is located
o How to start
The connection profile also contains protocol-specific information for the
protocol to be used.
The connection profile can be shared between the client (initiator) and the
server (acceptor) by putting it on a LAN server. This will ensure that both
sides are using the correct information for each connection.
CUSTOMIZING THE CONNECTION PROFILE
The connection profile editor is a tool that creates, changes, or deletes
information in the connection profile.
If you open the connection profile with the Connection Profile Editor, you
can customize the settings (see figures 1, 2, 3, and 4).
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Figure 1. Connection Profile Editor - Common Settings
Common information must be filled in for any protocol used. The required
information includes the following:
SYMBOLIC NAME Symbolic name of the destination of this con-
nection. This is the name the client will use to
identify the server in the DAOpen API.
COMMUNICATION PROTOCOL Selection of the communication protocol to be used
for this connection.
IBM
SECURITY If UPM is chosen, Distributed Application/2 will
use User Profile Management to make sure the user
is logged on before connection is made. Security is
performed differently for each protocol.
TIME OUT Number of milliseconds to wait for the connection
to be opened before there is a timeout error.
IBM
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Figure 2. Connection Profile Editor - Named Pipes/NetBIOS settings
NetBIOS or Named Pipes information is entered on this page of the connection
profile. If Named Pipes was the protocol selected on the common page, certain
fields would not be active for input. The required information for NetBIOS
or Named Pipes includes the following:
NETBIOS SERVER MACHINE The name of the server machine that the server
application is residing on.
NETBIOS MAXIMUM SESSIONS The maximum number of sessions that will be
accepted.
PROGRAM NAME The name and extension of the server program to
be run.
PROGRAM PARAMETERS Any parameters to pass to the server program.
PROGRAM OPERATING MODE Select foreground or background for program
operation field.
PROGRAM TYPE Select queued or non-queued for the server
type.
IBM
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Figure 3. Connection Profile Editor - APPC settings page 1 of 2.
The first page of the APPC information in the connection profile is the fol-
lowing:
TP NAME The name of the Transaction Program that will be
used in the server machine.
SNA MODE NAME SNA mode name to be used in the APPC connection.
LOCAL LU IDENTIFIER Choose whether a local LU alias is to be used or a
local LU pool.
PLU IDENTIFIER Choose whether a PLU alias name is to be used or a
fully qualified PLU name.
IBM
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Figure 4. Connection Profile Editor - APPC settings page 2 of 2.
The second page of the APPC information is the following:
PARTNER TYPE Choose partner type to be one of the following
o Application specific - both the client and
server programs are written using Distributed
Application/2
o Native APPC with No confirmation - if the server
program is native APPC program that does not use
confirmations.
o Native APPC with Confirmation - if the server
program is native APPC program that uses confir-
mations.
DATA CONVERSION Specify whether Distributed Application/2 should
perform the character conversion or not.
MILLISECONDS Milliseconds in send state while in idle
IBM
SAMPLE APPLICATION USING DISTRIBUTED APPLICATION/2
__________________________________________________
There are two C programs listed. One is the client program, the othe the
server. By creating an appropriate connection profile the client program can
communicate with the server program. (NOTE: The sample code is provided to
you solely for the purpose of assisting you in understanding the usage of
Distributed Application/2 Some of the function calls have no supporting code.
Below is an example:
The brief program logic is as follows:
1. The client program, when started will ask the user to input the con-
nection name to be made. Once the client obtains a valid conneciton name
it will initiate the connection by issuing the DAOpen call with DA_INIT
as the option.
2. Distributed Application/2 will search through the connection profiles to
get the detail information(e.g. protocols used, server program location,
etc.) from the connection profile matching the symbolic name that was
input by the user.
3. If at this time the server located in the server machine is not yet
started, it will be started according to the information put into the
connection profile(for NetBIOS and named pipes) or the TP definition in
the server machine (for APPC).
4. When the server is started it will first initialize itself and then issue
a DAIdentifyResource call to identify itself as one of the resources for
Distributed Application/2. After this it will go into an infinate loop
waiting to receive any event.
5. When the server receives a DAOpen request from a client it will issue a
DAOpen with DA_ACCEPT as the option to establish the connection. Muliple
clients can send a request to the server machine.
6. After the connection is made the client will enter a loop asking the user
to input a customer name. The customer name obtained will be sent to the
server using the DAWrite API. The server searchs the database for the
"balance" corresponding to that customer.
7. The server returns the requested "balance" to the client program also
using the DAWrite API.
8. The client receives the "balance" information with DARead.
9. If the client application receives an "END" from the user, it will send
the command to the server and close the connection using DAClose. The
server will also issue a DAClose to close the connection with the
requesting client.
10. If the client receives a "SERVEREXIT" from the user, it will send the
command to the server and close the connection using DAClose. The server
will also issue a DAClose to close the connection and then issue a
DATerminateResource to shutdown and end itself.
IBM
HEADER.H
________
1 /***************************************************************************/
2 /* HEADER.H */
3 /* Constants defined for use in the sample CLIENT and SERVER programs. */
4 /***************************************************************************/
5 #define READ_BUF_SIZE 30 /* Maximum buffer size for */
6 /* DARead */
7 #define CUST_INFO 30 /* Customer info buffer size */
8 #define NAME_SIZE 8 /* Size of the connection name */
IBM
CLIENT.C
________
1 /***************************************************************************/
2 /* CLIENT.C */
3 /* Sample Client program. */
4 /***************************************************************************/
5 #include <os2.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include "header.h"
10 #include "epfocrw.h"
11
12 USHORT ReadUserInput(PCHAR, USHORT); /* Reads user input to buffer */
13
14 INT main(VOID)
15 {
16 CHAR ConnectionName[NAME_SIZE+1]; /* Symbolic name for Connection */
17 /* Must match with Connection */
18 /* Profile. */
19 CHAR CustomerBalance[CUST_INFO+1]; /* Balance to be returned */
20 CHAR CustomerName[CUST_INFO+1]; /* Name of customer to search */
21 LHANDLE hConnection; /* Handle of the connection */
22 ULONG ulReadBuffersize= READ_BUF_SIZE; /* Read buffer for DARead */
23 USHORT usWriteOptions, usReadOptions; /* Options for DAWrite, DARead */
24 /* and DAWaitOnEvent */
25 USHORT usRC; /* return code */
26 ULONG ulBytesRead; /* Length of data in buffer */
27 ULONG ulRespID; /* Response ID */
28 ULONG ulDataStatus, ulConnStatus; /* Status of: DAWaitonEvent */
29 DAFEEDBACK DAFeedBack; /* Feed Back structure */
30
31 /**************************************************************************/
32 /* Establish connection to the server. */
33 /* 1) Request User to input the connection name as it is in the */
34 /* Connection profile. */
35 /* 2) Establish the connection with the server using DAOpen. */
36 /**************************************************************************/
37 While ( NoConnection )
38 {
39 memset( ConnectionName, '/0', sizeof(ConnectionName) );
40 printf("\nPlease enter the connection name: ");
41
42 /************************************************************************/
43 /* ReadUserInput would read the users typed in response to the */
44 /* connection prompt. The functions parameters are as follows: */
45 /* 1st parameter - PCHAR - : connection name input by user */
46 /* 2nd parameter - USHORT - : maximum number of characters allowed */
47 /* for the connection name */
48 /* Return code - 0 on successful completion. */
49 /* NOTE: This function is not coded in this example. */
50 /************************************************************************/
51 usRC = 0;
52 usRC = ReadUserInput(ConnectionName, NAME_SIZE);
53
54 if (usRC != 0)
IBM
55 printf("\nConnection name in error.");
56 else if ( strcmp(ConnectionName, "EXIT") == 0 )
57 {
58 printf("\nReceived request for EXIT. Connection not made.");
59 exit (1);
60 }
61 else
62 {
63 hConnection = (LHANDLE)0;
64 /* (O) == Output, (I) == Input */
65 DAOpen( &hConnection, /* (O), communications handle */
66 ConnectionName, /* (I), logical connection name */
67 DA_INIT, /* (I), DA_INIT or DA_ACCEPT */
68 &DAFeedBack ); /* (O), error information */
69
70 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
71 printf("\nConnection Error. Please input connection name again.");
72 else NoConnection = FALSE;
73 }
74 }
75
76 /**************************************************************************/
77 /* Continuous Loop does the following: */
78 /* 1) Prompts user for customer name. */
79 /* 2) Check Customer input for commands: */
80 /* a) Customer name - Name of customer for server to query. */
81 /* b) "END" - user request to end the connection. Client stopped. */
82 /* c) "SERVEREXIT" - user request to stop server and client. */
83 /* 3) Send the customer name to the server with DAWrite. */
84 /* 4) Wait for server to return the "balance" for the customer. The */
85 /* DARead used in this example uses the DA_WAIT option. This causes */
86 /* the program to wait indefinately for the reply from the server. */
87 /* Using the DA_NOWAIT option would provide aysnchronous execution. */
88 /**************************************************************************/
89 While (TRUE)
90 {
91 printf("\nEnter the name of the customer for balance information: ");
92 usRC = 0;
93 memset( CustomerName, '/0', sizeof(CustomerName) );
94 usRC = ReadUserInput(CustomerName, CUST_INFO);
95
96 if (usRC != 0)
97 printf("\nCustomer Name in error.");
98 else
99 {
100 usWriteOptions = DA_WRITE_DATA;
101 /* (O) == Output, (I) == Input */
102 DAWrite( hConnection, /* (I), communications handle */
103 CustomerName, /* (I), data area to be written */
104 strlen(CustomerName), /* (I), length of write buffer. */
105 usWriteOptions, /* (I), write options: */
106 /* DA_WRITE_DATA, */
107 /* DA_WRITE_ERROR, */
108 /* DA_WRITE_CONFIRMED, */
109 /* DA_RSVP, or DA_HOLD. */
110 &ulRespID, /* (I/O), response ID */
IBM
111 &DAFeedBack ); /* (O), error information */
112
113 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
114 printf("\nError while writing information.");
115 else if ( strcmp(CustomerName, "SERVEREXIT") == 0 )
116 {
117 printf("\nSERVEREXIT received.");
118 DAClose = hConnection, &DAFeedBack);
119 printf("\nConnection closed. Request sent to server.");
120 exit (1);
121 }
122 else if ( strcmp(CustomerName, "END") == 0 )
123 {
124 DAClose = hConnection, &DAFeedBack);
125 printf("\nEND received. Connection closed.");
126 exit (1);
127 }
128 else
129 {
130 usReadOptions = DA_WAIT;
131 /* (O) == Output, (I) == Input */
132 DARead( hConnection, /* (I), communications handle */
133 CustomerBalance, /* (O), received data goes here */
134 ulReadBuffer, /* (I), length of buffer area. */
135 usReadOptions, /* (I), read options: */
136 /* DA_WAIT or DA_NOWAIT */
137 &ulRespID, /* (I/O), response ID */
138 &ulBytesRead, /* (O), number of bytes returned */
139 &ulDataStatus, /* (O), data status info: */
140 /* DA_NONE, DA_COMPLETE, or */
141 /* DA_INCOMPLETE */
142 &ulConnectionStatus, /* (O), connection status info: */
143 /* DA_NONE, DA_CLOSE, */
144 /* DA_WRITE, DA_ERROR, */
145 /* DA_CONFIRM_WRITE, or */
146 /* DA_CONFIRM_CLOSE */
147 &DAFeedBack ); /* (O), error information */
148
149 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
150 printf("\nError while reading information.");
151 else
152 printf("\nBalance for %s was %s", CustomerName, CustomerBalance);
153 }
154 }
155 }
156
157 } /* End of Sample Client Program */
IBM
SERVER.C
________
1 /***************************************************************************/
2 /* SERVER.H */
3 /* Sample Server Program. */
4 /***************************************************************************/
5 #include <os2.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include "header.h"
10 #include "epfocrw.h"
11
12 VOID GetInfo(PCHAR, PCHAR, PCHAR); /* Function to get balance */
13
14 INT main(INT argc, PCHAR argv[])
15 {
16 CHAR ConnectionName[NAME_SIZE+1]; /* Symbolic name for Connection */
17 /* Should match with Connection */
18 /* Profile. */
19 CHAR CustomerBalance[CUST_INFO+1]; /* Balance to be returned */
20 CHAR CustomerName[CUST_INFO+1]; /* Name of customer to search */
21 CHAR ReadBuffer[READ_BUF_SIZE+1]; /* Buffer for DARead call */
22 LHANDLE hConnection; /* Handle of the connection */
23 ULONG ulReadBuffersize= READ_BUF_SIZE; /* Read buffer for DARead */
24 USHORT usWriteOptions, usReadOptions; /* Options for DAWrite, DARead */
25 /* and DAWaitOnEvent */
26 USHORT usWaitEventType, usWaitOptions; /* Events types to be used by */
27 /* DAWaitOnEvent API. */
28 USHORT usRC; /* return code */
29 ULONG ulBytesRead, ulDataLength; /* Length of data in buffer */
30 ULONG ulRespID; /* Response ID: not implemented */
31 ULONG ulDataStatus, ulConnStatus; /* Status of: DAWaitonEvent */
32 DAFEEDBACK DAFeedBack; /* Feed Back structure */
33
34 /**************************************************************************/
35 /* Check the input argument for the connection name. */
36 /**************************************************************************/
37 if (argc != 2)
38 {
39 printf("\nConnection name required to start the server.Server stopped.");
40 exit (1);
41 }
42 else if ( strlen(argv[1]) > NAME_SIZE )
43 {
44 printf("\nCorret connection name and try again. Server stopped.");
45 exit (1);
46 }
47
48 /**************************************************************************/
49 /* Instruct Diestributed Application/2 to associate the sample program */
50 /* with the symbolic connection name from the argument. */
51 /**************************************************************************/
52 strcpy(ConnectionName, argv[1]);
53 DAIdentifyResource(ConnectionName, &DAFeedBack);
54 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
IBM
55 {
56 printf("\nError occurred while identifying resource. Server stopped.");
57 exit (1);
58 }
59 else
60 printf("\nServer identified for connection: %s", ConnectionName);
61
62 /**************************************************************************/
63 /* Enter infinate loop, wait for event to arrive and handle the request. */
64 /* The option, DA_ALL_EVENTS is used in the DAWaitOnEvent to cause the */
65 /* server to receive all events sent. */
66 /* Event type values for WaitOnEvent(.): */
67 /* DA_CONNECTION - an allocation event */
68 /* DA_DATA - a data event not associated with a response ID. */
69 /* DA_ID_DATA - a data event assocated with a response ID. */
70 /* DA_ALL_EVENTS - all of the above three events. */
71 /* Although this example uses the option DA_ALL_EVENTS, only DA_DATA */
72 /* and DA_CONNECTION are the only event types that are implemented here. */
73 /* */
74 /* The hConnection returned on DAWaitOnEvent will be different for each */
75 /* client connection. */
76 /**************************************************************************/
77 while (TRUE)
78 {
79 usWaitOptions = DA_ALL_EVENTS;
80 /* (O) == Output, (I) == Input */
81 DAWaitOnEvent( ConnectionName, /* (O), logical connection name */
82 &hConnection, /* (O), communications handle */
83 usWaitOptions, /* (I), events to wait on: */
84 /* DA_DATA, DA_CONNECTION, */
85 /* and/or DA_RESPONSE_DATA */
86 &usWiatEventType, /* (O), type of event returned: */
87 /* DA_DATA, DA_CONNECTION, */
88 /* or DA_RESPONSE_DATA */
89 &ulDataLength, /* (O), length (data event only) */
90 &ulRespID, /* (O), response ID (valid for */
91 /* DA_RESPONSE_DATA event) */
92 &DAFeedBack ); /* (O), error information */
93
94 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
95 {
96 printf("\nError occurred while waiting for an event.");
97 printf("\nServer is continuing to wait for events.");
98 }
99 else
100 {
101 /**********************************************************************/
102 /* After event occurs, check the type of event. This program only */
103 /* handles DA_CONNECTION (other events include: */
104 /* and otherwise data is sent from the client. If CONNECTION is */
105 /* requested, issue a DAOpen with DA_ACCEPT to accept and establish */
106 /* a connection. */
107 /**********************************************************************/
108 if ( usWaitEventType == DA_CONNECTION )
109 {
110 DAOpen( &hConnection,
IBM
111 ConnectionName,
112 DA_ACCEPT,
113 &DAFeedBack );
114 if ( DAFeedBack.MsfNo != RETURN_CODE_OK )
115 {
116 printf("\nError occurred while accepting connection for: %s",
117 ConnectionName);
118 printf("\nServer waiting for another event.");
119 }
120 else printf("\nConnection %s is made", ConnectionName);
121 }
122 else
123 /**********************************************************************/
124 /* If it is not a connection event, then data was sent by the */
125 /* client. Issue a DARead to read the data from the client. The */
126 /* client program does not send data which is associated with a */
127 /* response ID, so DA_RESPONSE_DATA is not implemented in the DARead */
128 /* example given here. */
129 /**********************************************************************/
130 {
131 memset( ReadBuffer, ' ', sizeof(ReadBuffer) );
132 usReadOptions = DA_WAIT;
133 ulRespID = 0;
134 DARead( hConnection,
135 ReadBuffer,
136 ulReadBufferSize,
137 usReadOptions,
138 &ulRespID,
139 &ulBytesRead,
140 &ulDataStatus,
141 &ulConnectionStatus,
142 &DAFeedBack );
143
144 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
145 printf("\nError occurred while accepting connection for: %s",
146 else if ( strcmp(ReadBuffer, "SERVEREXIT") )
147 {
148 printf("\nSERVEREXIT received from client.");
149 DAClose(hConnection, &DAFeedBack);
150 printf("\nConnection ended and Server stopped.");
151 DATerminateResource(arv[1], &DAFeedBack);
152 exit (1);
153 }
154 else if ( strcmp(ReadBuffer, "END") )
155 {
156 printf("\nEND received from client");
157 DAClose(hConnection, &DAFeedBack);
158 printf("\nConnection %s ended", ConnectionName );
159 }
160 else
161 {
162 /******************************************************************/
163 /* GetInfo function do the following: */
164 /* 1) Extract the customer name from the read buffer. */
165 /* 2) Using the input customer name as the search data, */
166 /* return the customers balance. */
IBM
167 /* NOTE: This function is not coded in this example. */
168 /******************************************************************/
169 usRC = 0;
170 usRC = GetInfo( ReadBuffer, CustomerName, CustomerBalance );
171
172 if (usRC != 0)
173 printf("\nError processing customer name.");
174 else
175 {
176 /****************************************************************/
177 /* Send the customer balance information back to the client */
178 /* using the DAWrite API. */
179 /****************************************************************/
180 usWriteOptions = DA_WRITE_DATA;
181 ulRespID = 0;
182 DAWrite( hConnection,
183 CustomerBalance,
184 strlen(CustomerBalance),
185 usWriteOptions,
186 &ulRespID,
187 &DAFeedBack );
188 if ( DAFeedBack.MsgNo != RETURN_CODE_OK )
189 printf("\nError while writing balance information for: %s"
190 CustomerName );
191 }
192 }
193 }
194 }
195 } /* End of Sample Server Program */
IBM
OPERATING ENVIRONMENT FOR DISTRIBUTED APPLICATION/2
___________________________________________________
MACHINE REQUIREMENTS
o A personal computer running OS/2 Version 2.0 or above.
NOTE: For more information on the OS/2 Version 2.0 or 2.1 machine
requirements, refer to the IBM OS/2 Version 2.0 or 2.1 Information and
___________________________________________
Planning Guide (G326-0160).
______________
o 1 MB of hard disk space above that required by OS/2 Version 2.0 or 2.1.
o .5 MB of memory above that required by OS/2 Version 2.0 or 2.1.
o 2-button mouse or other pointing device.
PROGRAM REQUIREMENTS
o For IBM OS/2 2.0
- IBM OS/2 Version 2.0 operating system with ServicePak XR06055.
- IBM Developers Toolkit for OS/2 Version 2.0 for OS/2
o For IBM OS/2 2.1
- IBM OS/2 Version 2.1 operating system.
o To use Distributed Application/2 with NetBIOS, you need one of the
following:
- The LAN Requester feature of OS/2 LAN Server Version 2.0 or LAN
Server Version 3.0. Any NetBIOS communication partners must also
have an IBM LAN requester installed.
- Novell(**) NetWare(***) with the Novell NetBIOS emulator. Any
NetBIOS communication partners must also have the Novell NetWare
requester installed.
o To use Distributed Application/2 with APPC, you also need Communication
Manager/2 or IBM Extended Edition.
o To access CICS, you will need the following in your MVS host system:
- VTAM 3.2 or above
- CICS version 2.1.2 or above.
---------------
(**) Novell is a trademark of Novell, Inc.
(***) NetWare is a trademark of Novell, Inc.
IBM
IBM
+-------------------------------------------------------+
| TABLE DEFINITIONS |
+-------------------------------------------------------+
ID FILE PAGE REFERENCES
__ ____ ____ __________
BASIC DA2LVL3 SCRIPT
4 4
ADVANCE DA2LVL3 SCRIPT
5 5
+-------------------------------------------------------+
| PROCESSING OPTIONS |
+-------------------------------------------------------+
Runtime values:
Document fileid ........................ DA2LVL3 SCRIPT
Document type .......................... USERDOC
Document style ......................... DEFAULT
Profile ................................ EDFPRF30
Service Level .......................... 0029
SCRIPT/VS Release ...................... 4.0.0
Date ................................... 94.02.16
Time ................................... 15:47:46
Device ................................. 3270
Number of Passes ....................... 2
Index .................................. NO
SYSVAR S ............................... 1
Formatting values used:
Annotation ............................. NO
Cross reference listing ................ YES
Cross reference head prefix only ....... NO
Dialog ................................. LABEL
Duplex ................................. YES
DVCF conditions file ................... (none)
DVCF value 1 ........................... (none)
DVCF value 2 ........................... (none)
DVCF value 3 ........................... (none)
DVCF value 4 ........................... (none)
DVCF value 5 ........................... (none)
DVCF value 6 ........................... (none)
DVCF value 7 ........................... (none)
DVCF value 8 ........................... (none)
DVCF value 9 ........................... (none)
Explode ................................ NO
Figure list on new page ................ YES
Figure/table number separation ......... YES
Folio-by-chapter ....................... NO
Head 0 body text ....................... (none)
Head 1 body text ....................... (none)
Head 1 appendix text ................... Appendix
Hyphenation ............................ YES
Justification .......................... NO
Language ............................... ENGL
Layout ................................. 1
Leader dots ............................ NO
Master index ........................... (none)
Partial TOC (maximum level) ............ 4
Partial TOC (new page after) ........... INLINE
Print example id's ..................... NO
Print cross reference page numbers ..... YES
Process value .......................... (none)
Punctuation move characters ............ .,
Read cross-reference file .............. (none)
Running heading/footing rule ........... NONE
Show index entries ..................... NO
Table of Contents (maximum level) ...... 3
Table list on new page ................. YES
Title page (draft) alignment ........... RIGHT
Write cross-reference file ............. (none)
+-------------------------------------------------------+
| Imbed Trace |
+-------------------------------------------------------+
Page 12 SAMPLE
STARTING PASS 2 OF 2.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 12.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 13.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 14.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 15.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 16.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 17.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 18.
TEXT EXCEEDS RIGHT PAGE BOUNDARY ON PAGE 19.