![]() |
![]() |
|
|
Step 3: Examining and Compiling the Server
How to Examine the Server
$ more CSIMPSRV.cbl
Source Code for CSIMPSRV.cbl
1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. CSIMPSRV.
3 AUTHOR. BEA Tuxedo DEVELOPMENT.
4 ENVIRONMENT DIVISION.
5 CONFIGURATION SECTION.
6 WORKING-STORAGE SECTION.
7 ******************************************************
8 * Tuxedo definitions
9 ******************************************************
10 01 TPSVCRET-REC.
11 COPY TPSVCRET.
12 *
13 01 TPTYPE-REC.
14 COPY TPTYPE.
15 *
16 01 TPSTATUS-REC.
17 COPY TPSTATUS.
18 *
19 01 TPSVCDEF-REC.
20 COPY TPSVCDEF.
21 ******************************************************
22 * Log message definitions
23 ******************************************************
24 01 LOGMSG.
25 05 FILLER PIC X(10) VALUE
26 "CSIMPSRV :".
27 05 LOGMSG-TEXT PIC X(50).
28 01 LOGMSG-LEN PIC S9(9) COMP-5.
29 ******************************************************
31 * User defined data records
32 ******************************************************
33 01 RECV-STRING PIC X(100).
34 01 SEND-STRING PIC X(100).
35 *
36 LINKAGE SECTION.
37 *
38 PROCEDURE DIVISION.
39 *
40 START-FUNDUPSR.
41 MOVE LENGTH OF LOGMSG TO LOGMSG-LEN.
42 MOVE "Started" TO LOGMSG-TEXT.
43 PERFORM DO-USERLOG.
44
45 ******************************************************
46 * Get the data that was sent by the client
47 ******************************************************
48 MOVE LENGTH OF RECV-STRING TO LEN.
49 CALL "TPSVCSTART" USING TPSVCDEF-REC
50 TPTYPE-REC
51 RECV-STRING
52 TPSTATUS-REC.
53
54 IF NOT TPOK
55 MOVE "TPSVCSTART Failed" TO LOGMSG-TEXT
56 PERFORM DO-USERLOG
57 PERFORM EXIT-PROGRAM
58 END-IF.
59
60 IF TPTRUNCATE
61 MOVE "Data was truncated" TO LOGMSG-TEXT
62 PERFORM DO-USERLOG
63 PERFORM EXIT-PROGRAM
64 END-IF.
65
66 INSPECT RECV-STRING CONVERTING
67 "abcdefghijklmnopqrstuvwxyz" TO
68 "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
69 MOVE "Success" TO LOGMSG-TEXT.
70 PERFORM DO-USERLOG.
71 SET TPSUCCESS TO TRUE.
72 COPY TPRETURN REPLACING
73 DATA-REC BY RECV-STRING.
74
75 ******************************************************
76 * Write out a log err messages
77 ******************************************************
78 DO-USERLOG.
79 CALL "USERLOG" USING LOGMSG
80 LOGMSG-LEN
81 TPSTATUS-REC.
82 ******************************************************
83 * EXIT PROGRAM
84 ******************************************************
85 EXIT-PROGRAM.
86 MOVE "Failed" TO LOGMSG-TEXT.
87 PERFORM DO-USERLOG.
88 SET TPFAIL TO TRUE.
89 COPY TPRETURN REPLACING
90 DATA-REC BY RECV-STRING.
$ more TPSVRINIT.cbl
Source Code for TPSVRINIT.cbl
1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. TPSVRINIT.
3 ENVIRONMENT DIVISION.
4 CONFIGURATION SECTION.
5 *
6 DATA DIVISION.
7 WORKING-STORAGE SECTION.
8 *
9 01 LOGMSG.
10 05 FILLER PIC X(11) VALUE "TPSVRINIT :".
11 05 LOGMSG-TEXT PIC X(50).
12 01 LOGMSG-LEN PIC S9(9) COMP-5.
13 *
14 01 TPSTATUS-REC.
15 COPY TPSTATUS.
16 *********************************************************
17 LINKAGE SECTION.
18 01 CMD-LINE.
19 05 ARGC PIC 9(4) COMP-5.
20 05 ARG.
21 10 ARGS PIC X OCCURS 0 TO 9999 DEPENDING ON ARGC.
22 *
23 01 SERVER-INIT-STATUS.
24 COPY TPSTATUS.
25 ***********************************************************
26 PROCEDURE DIVISION USING CMD-LINE SERVER-INIT-STATUS.
27 A-000.
28 MOVE LENGTH OF LOGMSG TO LOGMSG-LEN.
29 ***********************************************************
30 * There are no command line parameters in this TPSVRINIT
31 ***********************************************************
32 IF ARG NOT EQUAL TO SPACES
33 MOVE "TPSVRINIT failed" TO LOGMSG-TEXT
34 CALL "USERLOG" USING LOGMSG
35 LOGMSG-LEN
36 TPSTATUS-REC
37 ELSE
38 MOVE "Welcome to the simple service" TO LOGMSG-TEXT
39 CALL "USERLOG" USING LOGMSG
40 LOGMSG-LEN
41 TPSTATUS-REC
42 END-IF.
43 *
44 SET TPOK IN SERVER-INIT-STATUS TO TRUE.
45 *
46 EXIT PROGRAM.
A default is provided by the BEA Tuxedo system that writes a message to USERLOG indicating that the server has been booted.
How to Compile the Server
buildserver -C -o CSIMPSRV -f CSIMPSRV.cbl -f TPSVRINIT.cbl -s CSIMPSRV
The executable file to be created is named CSIMPSRV and CSIMPSRV.cbl and TPSVRINIT.cbl are the input source files. The service being offered by the server CSIMPSRV is indicated by -s CSIMPSRV.
$ ls
CSIMPCL CSIMPCL.int CSIMPSRV.cbl CSIMPSRV.o TPSVRINIT.int
CSIMPCL.cbl CSIMPCL.o CSIMPSRV.idy TPSVRINIT.cbl TPSVRINIT.o
CSIMPCL.idy CSIMPSRV CSIMPSRV.int TPSVRINIT.idy UBBCSIMPLE
You now have an executable module called CSIMPSRV.
See Also
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|