BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Getting Started   |   Topic List   |   Previous   |   Next   |   Contents

   Tutorials for Developing a BEA Tuxedo Application

Step 2: Examining and Compiling the Client

How to Examine the Client

Review the client program source code.

$ more CSIMPCL.cbl

The output is shown in the following list.

Source Code for CSIMPCL.cbl


1      IDENTIFICATION DIVISION.
2 PROGRAM-ID. CSIMPCL.
3 AUTHOR. Tuxedo DEVELOPMENT.
4 ENVIRONMENT DIVISION.
5 CONFIGURATION SECTION.
6 WORKING-STORAGE SECTION.
7 *****************************************************
8 * Tuxedo definitions
9 *****************************************************
10 01 TPTYPE-REC.
11 COPY TPTYPE.
12 *
13 01 TPSTATUS-REC.
14 COPY TPSTATUS.
15 *
16 01 TPSVCDEF-REC.
17 COPY TPSVCDEF.
18 *
19 01 TPINFDEF-REC VALUE LOW-VALUES.
20 COPY TPINFDEF.
21 *****************************************************
22 * Log messages definitions
23 *****************************************************
24 01 LOGMSG.
25 05 FILLER PIC X(8) VALUE "CSIMPCL:".
26 05 LOGMSG-TEXT PIC X(50).
27 01 LOGMSG-LEN PIC S9(9) COMP-5.
28 *
29 01 USER-DATA-REC PIC X(75).
30 01 SEND-STRING PIC X(100) VALUE SPACES.
31 01 RECV-STRING PIC X(100) VALUE SPACES.
32 *****************************************************
33 * Command line arguments
34 *****************************************************
35 * Start program with command line args
36 ******************************************************
37
38 PROCEDURE
39 START-CSIMPCL.
40 MOVE LENGTH OF LOGMSG TO LOGMSG-LEN.
41 ACCEPT SEND-STRING FROM COMMAND-LINE.
42 DISPLAY "SEND-STRING:" SEND-STRING.
43
44 MOVE "Started" TO LOGMSG-TEXT.
45 PERFORM DO-TPINIT.
46 PERFORM DO-TPCALL.
47 DISPLAY "RECV-STRING:" RECV-STRING.
48 PERFORM DO-TPTERM.
49 PERFORM EXIT-PROGRAM.
50 *****************************************************
51 * Now register the client with the system.
52 *****************************************************
53 DO-TPINIT.
54 MOVE SPACES TO USRNAME.
55 MOVE SPACES TO CLTNAME.
56 MOVE SPACES TO PASSWD.
57 MOVE SPACES TO GRPNAME.
58 MOVE ZERO TO DATALEN.
59 SET TPU-DIP TO TRUE.
60
61 CALL "TPINITIALIZE" USING TPINFDEF-REC
62 USER-DATA-REC
63 TPSTATUS-REC.
64
65 IF NOT TPOK
66 MOVE "TPINITIALIZE Failed" TO LOGMSG-TEXT
67 PERFORM DO-USERLOG
68 PERFORM EXIT-PROGRAM
69 END-IF.
70
71 *****************************************************
72 * Issue a TPCALL
73 *****************************************************
74 DO-TPCALL.
75 MOVE 100 to LEN.
76 MOVE "STRING" TO REC-TYPE.
77 MOVE "CSIMPSRV" TO SERVICE-NAME.
78 SET TPBLOCK TO TRUE.
79 SET TPNOTRAN TO TRUE.
80 SET TPNOTIME TO TRUE.
81 SET TPSIGRSTRT TO TRUE.
82 SET TPCHANGE TO TRUE.
83
84 CALL "TPCALL" USING TPSVCDEF-REC
85 TPTYPE-REC
86 SEND-STRING
87 TPTYPE-REC
88 RECV-STRING
89 TPSTATUS-REC.
90
91 IF NOT TPOK
92 MOVE "TPCALL Failed" TO LOGMSG-TEXT
93 PERFORM DO-USERLOG
94 END-IF.
95
96 *****************************************************
97 * Leave Tuxedo
98 *****************************************************
99 DO-TPTERM.
100 CALL "TPTERM" USING TPSTATUS-REC.
101 IF NOT TPOK
102 MOVE "TPTERM Failed" TO LOGMSG-TEXT
103 PERFORM DO-USERLOG
104 END-IF.
105
106 *****************************************************
107 * Log messages to the userlog
108 *****************************************************
109 DO-USERLOG.
110 CALL "USERLOG" USING LOGMSG
111 LOGMSG-LEN
112 TPSTATUS-REC.
113
114 *****************************************************
115 *Leave Application
116 ******

Significant Lines in the CSIMPCL.cbl Source Code

Line(s)

File/Function

Purpose

11, 14, 17, 20

COPY

Command used to replicate files needed whenever BEA Tuxedo ATMI functions are used.

61

TPINITIALIZE

The ATMI function used by a client program to join an application.

84

TPCALL

The ATMI function used to send the message record to the service specified in SERVICE-NAME. TPCALL waits for a return message. STRING is one of the three basic BEA Tuxedo record types. An argument, LEN IN TPTYPE-REC, specifies the length of the record in USER-DATA-REC.

100

TPTERM

The ATMI function used to leave an application. A call to TPTERM is used to exit an application before performing a STOP RUN.

110

USERLOG

The function that displays the message returned from the server, the successful conclusion of tpcall.

How to Compile the Client

  1. Run buildclient to compile the client program.

    buildclient -C -o CSIMPCL -f CSIMPCL.cbl

    The output file is CSIMPCL and the input source file is CSIMPCL.cbl.

  2. Check the results.

    $ ls CSIMPCL*
    CSIMPCL CSIMPCL.cbl CSIMPCL.idy CSIMPCL.int CSIMPCL.o

    You now have an executable module called CSIMPCL.

See Also