000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. COBTHD1.
000030 DATA DIVISION.
000040 WORKING-STORAGE SECTION.
000050 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
000060 01 SQLSTATE PIC X(5).
000070 01 SQLMSG PIC X(255).
000080 01 G1.
000090 02 HOST1 PIC S9(4) BINARY.
000100 02 HOST2 PIC N(10).
000110 02 HOST3 PIC S9(9) BINARY.
000120 02 HOST4 PIC S9(4) BINARY.
000130 01 G2.
000140 02 IND PIC S9(4) BINARY OCCURS 4.
000150 EXEC SQL END DECLARE SECTION END-EXEC.
000160
000170 PROCEDURE DIVISION.
000180 INITIALIZE SQLSTATE.
000190 INITIALIZE SQLMSG.
000200 INITIALIZE G1.
000210 INITIALIZE G2.
000220*
000230*
000240* CONNECT
000250 DISPLAY "CONNECT TO DEFAULT"
000260 EXEC SQL
000270 CONNECT TO DEFAULT
000280 END-EXEC.
000290*
000300 EXEC SQL
000310 SELECT COL01, COL02, COL03, COL04
000320 INTO :G1 :G2
000330 FROM SCH.TBL
000340 WHERE COL = 100
000350 END-EXEC.
000360*
000370 DISPLAY "COL1=" HOST1.
000380 DISPLAY "IND= " IND(1).
000390 DISPLAY "COL2=" HOST2.
000400 DISPLAY "IND= " IND(2).
000410 DISPLAY "COL3=" HOST3.
000420 DISPLAY "IND= " IND(3).
000430 DISPLAY "COL4=" HOST4.
000440 DISPLAY "IND= " IND(4).
000450*
000460* DISCONNECT
000470 EXEC SQL
000480 DISCONNECT DEFAULT
000490 END-EXEC.
000500*
000510 EXIT PROGRAM. |