This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
OLACC01.jclsamp
262 lines (227 loc) · 20.6 KB
/
OLACC01.jclsamp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
//OLACC01 JOB (),'ME',REGION=0M,
// MSGCLASS=H,NOTIFY=&SYSUID
//*
/*JOBPARM S=*
//*
//MYPROCS JCLLIB ORDER=ZOS1B0.CBC.SCCNPRC
//*
//CMP EXEC EDCCB,
// CPARM='NOSEQ NOMAR SOURCE LIST RENT',
// LNGPRFX='ZOS1B0.CBC',
// LIBPRFX='CEE',
// OUTFILE='BOSS.OLA.SAMPLES.LOAD(OLACC01),DISP=SHR'
//*
//COMPILE.SYSLIB DD DSNAME=BOSS.OLA.SAMPLES.SRC,DISP=SHR
// DD DSNAME=CEE.SCEEH.H,DISP=SHR
// DD DSNAME=CEE.SCEEH.SYS.H,DISP=SHR
//COMPILE.SYSIN DD DATA,DLM=@@
/********************************************************************/
/* */
/* olacc01.c - Sample C program for demonstrating OLA APIs. */
/* */
/* Copyright IBM Corporation 2008,2014 */
/* */
/* LICENSE: Apache License */
/* Version 2.0, January 2004 */
/* http://www.apache.org/licenses/ */
/* */
/* This sample program calls BBOA1INV. */
/* */
/* OLACC01 is a basic C sample program which is used to */
/* demonstrate the use the of BBOA1INV API to invoke a simple */
/* EJB running in WAS. This sample program can be run in either */
/* z/OS Batch or CICS. */
/* */
/* The following code is sample code created by IBM Corporation. */
/* This sample code is not part of any standard IBM product and */
/* is provided to you solely for the purpose of assisting you in */
/* the development of your applications. The code is provided */
/* 'as is', without warranty or condition of any kind. IBM shall */
/* not be liable for any damages arising out of your use of the */
/* sample code, even if IBM has been advised of the possibility */
/* of such damages. */
/* */
/********************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <bboaapi.h>
/* The GETARG macro makes it easier to extract and validate input
arguments passed to this sample program. */
#define GETARG(varName, argNum, maxLen, padChar, dfltStr) \
if (sizeof(varName) != maxLen) \
{ \
printf("Variable must be of length %d\n", maxLen); \
return(-1); \
} \
memset(varName,padChar,maxLen); \
if (argc > argNum) \
{ \
if (strlen(argv[argNum]) > maxLen) \
{ \
printf("Passed argument %d is too long: \"%s\"\n", \
argNum,argv[argNum]); \
printf("Maximum length for this argument is %d",maxLen); \
return(-1); \
} \
memcpy(varName,argv[argNum],strlen(argv[argNum])); \
} \
else \
{ \
memcpy(varName,dfltStr, \
(strlen(dfltStr)<maxLen ? strlen(dfltStr):maxLen)); \
}
/********************************************************************/
/* */
/* OLACC01 parameters: */
/* argv[0] - program name */
/* argv[1] - WAS daemon group short name (max 8 chars) */
/* argv[2] - WAS node short name (max 8 chars) */
/* argv[3] - WAS server short name */
/* */
/********************************************************************/
#define serviceJNDIname "java:global/OLASampleLiberty/OLASampleLibert"\
"yEJB/EchoBean!com.ibm.websphere.ola.ExecuteL"\
"ocalBusiness"
int main(int argc, char *argv[])
{
char daemonGroupName[8];
char nodeName[8];
char serverName[8];
char registerName[12] = "OLACC01 ";
int minConn= 1;
int maxConn= 5;
_REGFLAGS regFlags= {0x00,0x00,0x00,0x00};
_UNREGFLAGS unregFlags= {0x00,0x00,0x00,0x00};
int requestType;
int requestServiceNameLen;
char requestServiceName[256];
char requestData[256];
void *requestDataPtr = NULL;
int requestDataLen;
char responseData[256];
void *responseDataPtr = NULL;
int responseLen;
int expected_responseLen;
int waittime = 0;
int rc = 0;
int rsn = 0;
int rv = 0;
int errorFlag = 0;
const char data2send[] =
"Sending this data to WAS using the OLA BBOA1INV (Invoke) API";
/* Handle input arguments. */
if (argc > 4)
{
printf("Too many arguments\n");
return(-1);
}
GETARG(daemonGroupName, 1, 8, 0x00, "SY1");
GETARG(nodeName, 2, 8, ' ', "SY1");
GETARG(serverName, 3, 8, ' ', "BBOS001");
/****************************************************************/
/* */
/* Setup and call the OLA Register API (BBOA1REG). */
/* */
/****************************************************************/
regFlags.reg_flag_trans = 0; /* Turn transaction off */
regFlags.reg_flag_W2Cprop = 0; /* Turn security off */
BBOA1REG ( &daemonGroupName
, &nodeName
, &serverName
, ®isterName
, &minConn
, &maxConn
, ®Flags
, &rc
, &rsn
);
if (rc != 0)
{
printf("Register error! rc: %d rsn: %d\n",rc,rsn);
return(-1);
}
/****************************************************************/
/* */
/* Setup and call the OLA Invoke API (BBOA1INV). */
/* */
/****************************************************************/
strncpy(requestServiceName,
serviceJNDIname,
sizeof(requestServiceName));
requestServiceNameLen = 0; /* Service name is null terminated */
strncpy(requestData, data2send, sizeof(requestData));
requestDataPtr = &requestData;
requestDataLen = strlen(data2send) + 1; /* + 1 for NULL char */
memset(responseData, 0x00, sizeof(responseData));
responseDataPtr = &responseData;
responseLen = requestDataLen;
expected_responseLen = requestDataLen;/* expect to get req back */
printf("Invoking service \"%s\"\n", requestServiceName);
requestType = 1; /* Request Type: EJB */
BBOA1INV ( ®isterName
, &requestType
, &requestServiceName
, &requestServiceNameLen
, &requestDataPtr
, &requestDataLen
, &responseDataPtr
, &responseLen
, &waittime
, &rc
, &rsn
, &rv
);
if (rc == 0)
{
if (rv == expected_responseLen)
{
printf("Invoke response length matches expected: %d\n",rv);
if (!memcmp(responseData, data2send, expected_responseLen))
{
printf("Invoke response data matches expected\n");
}
else
{
printf("Invoke error! Did not recv expected data\n");
errorFlag = -1;
}
}
else
{
printf("Invoke error! received %d bytes, expected %d\n",
rv, expected_responseLen);
errorFlag = -1;
}
}
else
{
printf("Invoke error! rc: %d rsn: %d rv: %d\n", rc, rsn, rv);
errorFlag = -1;
}
/****************************************************************/
/* */
/* Setup and call the OLA Unregister API (BBOA1URG). */
/* */
/****************************************************************/
BBOA1URG ( ®isterName
, &unregFlags
, &rc
, &rsn
);
if (rc != 0)
{
printf("Unregister error! rc: %d rsn: %d\n",rc,rsn);
return(-1);
}
return(errorFlag);
}
@@
//BIND.SYSLIB DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=MVSBUILD.CICSTS31.CICS.SDFHLOAD,DISP=SHR
// DD DSN=BOSS.OLA90902.SBBOLOAD,DISP=SHR
//BIND.SYSIN DD *
INCLUDE SYSLIB(DFHELII)
NAME OLACC01(R)
/*