ibm 开发嵌入式sql应用程序


IBM DB2 10.1 for Linux, UNIX, and Windows *"6k= SQL &CLr S151-1763-00  IBM DB2 10.1 for Linux, UNIX, and Windows *"6k= SQL &CLr S151-1763-00  "b 9CKE"0d'VDz70,kHDAZ 195 3D=< B, :yw;BD#fE"# ^)fyw KD5|, IBM DyP(E"#|ZmI-iPa),R\f((D#$#>vfoP|,DE";|(TNNz7D #$,Ra)DNNod<;h*gKbM# zIZ_r(}1XD IBM zm&): IBM vfo# v *Z_):vfo,k*A IBM vfoPD,x7*:http://www.ibm.com/shop/publications/order v *iR1XD IBM zm&,k*A IBM +r*5K?<,x7*:http://www.ibm.com/planetwide/ *S@zrSCsD DB2 P!Mz[?): DB2 vfo,kBg 1-800-IBM-4YOU(426-4968)# z"ME"x IBM s,4Zh IBM G@<(^,IBM IT4|O*J1DNN==9CrV"zya)DNNE"x ^kTzP#NNpN# © Copyright IBM Corporation 1993, 2012. ?< Z 1 B 6k= SQL ri .......1 ZwoTP6k SQL od ..........2 C M C++ &CLrPD6k= SQL od ...2 FORTRAN &CLrPD6k= SQL od ...3 COBOL &CLrPD6k= SQL od ....4 REXX &CLrPD6k= SQL od .....5 6k= SQL &CLry'VD*"m~ .....7 hC6k= SQL *"73 ..........7 Z 2 B hF6k= SQL &CLr ...9 6k= SQL DZ("bBn .........9 Z6k= SQL &CLrP4P2,M/, SQL od 10 6k= SQL /,od ..........10 7(N1Z6k= SQL &CLrPT2,r/, ==4P SQL od...........11 6k= SQL &CLrDT\.........13 T6k= SQL &CLrD 32 ;M 64 ;'V...13 PX6k= SQL &CLrD^F .......14 9C C M C++ xP6k= SQL &CLr`L1 PXV{/D^F ...........14 9C COBOL xP6k= SQL &CLr`L1D ^F ................15 9C FORTRAN xP6k= SQL &CLr`L 1D^F ..............15 9C REXX xP6k= SQL &CLr`L1D ^F ................16 PX9C XML M XQuery *"6k= SQL &C LrD(i .............16 6k= SQL &CLrPD""BqM`_L}]b CJ .................16 PX9C`v_LD(i .........18 `_L UNIX &CLrDzk3T0zRrXxz k"bBn .............19 T`_L6k= SQL &CLrxPJOoO ..19 Z 3 B 6k= SQL &CLr`L ...21 6k= SQL 4D~............21 9C C oTD6k= SQL &CLr#e ....22 6k= SQL &CLryhD|,D~M(e ...24 C M C++ 6k= SQL &CLrD|,D~ ..25 COBOL 6k= SQL &CLrD|,D~ ...27 FORTRAN 6k= SQL &CLrD|,D~ ..29 ywCZxPms&mD SQLCA .......31 9C WHENEVER odxPms&m ......32 Z6k= SQL &CLrP,S= DB2 }]b...33 6k= SQL &CLrP3d= SQL }]`MD}] `M .................34 C M C++ 6k= SQL &CLrPD\'V SQL }]`M ..............34 COBOL 6k= SQL &CLrPD\'V SQL }]`M ..............42 FORTRAN 6k= SQL &CLrPD\'V SQL }]`M ..............45 REXX 6k= SQL &CLrPD\'V SQL } ]`M ...............47 6k= SQL &CLrPDwd? .......49 Z6k= SQL &CLrPywwd?.....51 9C db2dclgn ywzIw4ywwd? ....51 6k= SQL &CLrPDP}]`MMwd?..52 Z6k= SQL &CLrPyw XML wd? ..53 Z SQLDA Pj6 XML 5 ........54 9C null 8>{d?4j6 null SQL 5 ...54 Z6k= SQL &CLrP|( SQLSTATE M SQLCODE wd? ...........56 Z6k= SQL &CLrP}Cwd?.....57 >}:Z6k= SQL &CLrP}C XML wd ? ................57 C M C++ 6k= SQL &CLrPDwd? ..58 COBOL PDwd?...........83 FORTRAN PDwd?..........93 REXX PDwd? ...........99 Z6k= SQL &CLrP4P XQuery mo= . . 105 Z6k= SQL &CLrP4P SQL od ....106 6k= SQL &CLrPD"M ......106 Z6k= SQL &CLrP4P2, SQL od 107 Z6k= SQL &CLrPS SQLDA a9lw wd?E" .............108 (}9CN}jG*/,4PD SQL oda)d ?dk...............118 Z6k= SQL &CLrPwC}L .....119 Z6k= SQL &CLrPA!Mv/a{/ . . 120 Z6k= SQL &CLrPlwms{" ...125 k6k= SQL &CLrO*,S ......128 Z 4 B 9(6k= SQL &CLr . . 129 9C PRECOMPILE |n4$`k6k= SQL &C Lr ................130 TCJ`v}]b~qwD6k= SQL &CLr xP$`k .............132 6k= SQL &CLrDLr|MCJ=8 ...132 9C CURRENT PACKAGE PATH (CDfwx PLr|#=^( ...........133 $`kwzID1dAG.........135 $`k6k= SQL &CLr1zIDmsM/f 136 `kM4S|,6k= SQL D4D~ .....136 +6k= SQL Lr|k}]bs( ......137 DYNAMICRULES s(!nT/, SQL D0l 137 9C(CDfw4XFod`k73 .....139 9C BIND |nMVPs(D~4XB4(Lr | ................139 9C REBIND |n4XBs(VPLr| ...140 s("bBn ............140 © Copyright IBM Corp. 1993, 2012 iii Vi"bBn ............141 SYs(DEc............141 9C BIND |nD REOPT !n1DT\Dx 141 s(&CLrM5CLr(DB2 Connect ~qw) 142 Lr|Df"k,$ ...........145 Lr|f>XF............145 T4^(Dm{xPbv.........146 9Cy>9(E>49(6k= SQL &CLr . . 146 msli5CLr ...........148 9(9C C M C++ `4D&CLrM}L . . 149 9(9C COBOL `4D&CLrM}L ...162 9(MKP9C REXX `4D6k= SQL &C Lr ...............176 S|nP9(6k= SQL &CLr ......178 9(9C C r C++ `4D6k= SQL &CL r(Windows) ............178 Z 5 B ?pMKP6k= SQL &CL r ................181 PX4S= libdb2.so D^F ........181 Z 6 B tC(Ff]T&\ .....183 =< A. DB2 SQL 4,oz ......189 CJ;,f>D DB2 E"PD .......189 |B20ZFczrZ?x~qwOD DB2 E"P D .................190 V/|B20ZFczrZ?x~qwOD DB2 E "PD................191 DB2 LL...............193 DB2 JOoOE"............193 E"PDunMu~ ...........193 =< B. yw ............195 w} ...............199 iv *"6k= SQL &CLr Z 1 B 6k= SQL ri 6k= SQL }]b&CLr,S=}]b"4P6k= SQL od#6k= SQL o d6kZwoT&CLrP#6k= SQL }]b&CLr'VT2,r/,==44 P SQL odD6k# z I T 9 C B P w ` L o T * DB2® * " 6 k = SQL &CL r : C " C++"COBOL"FORTRAN M REXX# ":(iz;*9C FORTRAN M REXX T6k= SQL D'V,K'V+#V&Z DB2 Universal Database™ V5.2 6p# 9(6k= SQL &CLr1,XkZ`kM4S&CLr04P=vX*D=h# v 9C DB2 $`kw4<8|,6k= SQL odD4D~# PREP (PRECOMPILE) |nCZwC DB2 $`kw,s_A!4zk,bv6k= SQL od"+d*;* DB2 KP1~q API wC,ns+dv4k-}^DDB4D ~#$`kw+zI SQL odDf!=8,b)f!=8TLr|N=;pf"Z }]bP# v +&CLrPDodk?j}]bs(# 1!ivB,Z$`k(PREP |n)Zd4Ps(#g{*SYs((}g,TsK P BIND |n),G4XkZ4P PREP 18( BINDFILE !nTczIs(D~# Z$`k"s(6k= SQL &CLr.s,4I9CX(ZwoTD*"$_Tdx P`kM4S# *Koz*"6k= SQL &CLr,zITN<6k= SQL #e (C)#mb,9I TZ %DB2PATH%\SQLLIB\samples ?&CLrD>}# ":%DB2PATH% G8 DB2 20?<# 2,M/, SQL IT(}=V==PD;V44P SQL od:2,==r/,==# T2,==4PD SQL od TZT2,==4PD SQL odxT,o(Z$`k1Qj+7(#zXkj +X8( SQL odDa9,CodEa;O*G2,od#}g,odP}C DPMmD{FZ$`k1Xkj+7(#(;ITZKP18(DE"GC ody}CDNNwd?D5#+G,TXkTwd?E"(}g}]`M) xP$`k#kZKP&CLr.0$`k"s(M`kT2,==4PD SQL od#2, SQL nJOZ3FE";asy|DD}]b# T/,==4PD SQL od T/,==4PD SQL odI&CLrZKP19(M4P#JOZ/, SQL DivD;v;m>}G,a>nUC'dk SQL odX|?V(}g*Qw DmMPD{F)D;%=&CLr# © Copyright IBM Corp. 1993, 2012 1 ZwoTP6k SQL od a9/i/oT(SQL)G;Vj}5wgN9Cwd? stmt1 T/,=="v SQL od: strcpy(stmt1, "CREATE TABLE table1(col1 INTEGER)"); EXEC SQL EXECUTE IMMEDIATE :stmt1; Z C M C++ &CLrP4P6k= SQL od1,BP= 0) EXEC SQL FETCH c1 INTO :hv; v (Z}EPDV{.IT|,X5{";P{MFm{#SQL $`kw+#tb)V {;d# 2 *"6k= SQL &CLr v ;*9C #include od4|(G)|, SQL odDD~#53+Z`k#i0T SQL odxP$`k#$`kw+vT #include od#xG,k9C SQL INCLUDE od4zkDYw: EXEC SQL SELECT "NA\ ME" INTO :n FROM staff WHERE name=’Sa\ nders’; Zw* SQL od+]=}]b\mwDV{.P,;|(NNBPV{(}gX5 {M;P{)# v UqV{(}gP2{MFm{)Df;gBy>: – 1|GvVZ}Eb?+Z SQL odZ?1,P2{MFm{;f;*%vU q# – 1|GvVZ}EZ1,P2{+{',u~GV{.TZ C Lr\;}7XS x#Fm{;a;^D# "b,f=(;,,CwP2{MFm{D5JV{2+Pyd/#}g,yZ UNIX M Linux D539C;P{# FORTRAN &CLrPD6k= SQL od FORTRAN &CLrPD6k= SQL odIBfb}v*XiI: }7D FORTRAN *Xo( odu: – ;JmZ EXEC k SQL .d|("M# – ZT/,==4PDodP,;Jm|("M# – Z6k= SQL odP,;'VZP29C ! 4`k FORTRAN "Mb;)9& \# v Z SQL odP8(5}#?1,k9C8}m>(#}]b\mw+ SQL odP |,!}cD}VV{.bM*.xF#?,x;GbM*5}#?# v ZZ;vI4PD FORTRAN od.0D SQL odP,odE^'#g{ SQL o dP`X*DodE,G4$`kw+ZC SQL odt0fzIxPjED CON- TINUE od# v Z SQL odP}Cwd?1,kj+4UywD==49Cwd?# v UqV{(}gP2{MFm{)Df;gBy>: – 1|GvVZ}Eb?+Z SQL odZ?1,P2{MFm{;f;*%vU q# – 1|GvVZ}EZ1,P2{+{',u~GV{.TZ FORTRAN Lr\; }7XSx#Fm{;a;^D# "b,f=(;,,CwP2{MFm{D5JV{2+Pyd/#}g,yZ Win- dows D=(9CX5{/;P{w*P2{,xyZ UNIX M Linux D=(;9C ;P{# COBOL &CLrPD6k= SQL od COBOL &CLrPD6k= SQL odIBfb}v*XiI: }7D COBOL *Xo( odu: – ;JmZ EXEC k SQL .d|("M# – ZT/,==4PDodP,;Jm|("M# v SQL odk COBOL oTq-`,DPSxfr#+G,k;*9 EXEC SQL o du: – 1|GvVZ}Eb?+Z SQL odZ?1,P2{MFm{;f;*%vU q# – 1|GvVZ}EZ1,P2{+{',u~GV{.TZ COBOL Lr\;} 7XSx#Fm{;a;^D# "b,f=(;,,CwP2{MFm{D5JV{2+Pyd/#}g,yZ Win- dows D=(9CX5{/;P{w*P2{,xyZ UNIX M Linux D53;9C ;P{# REXX &CLrPD6k= SQL od REXX &CLr9C API,b9|G\;9C }]b\mw API M SQL a)Ds? V&\#k9C`kMoT`4D&CLr;,,REXX &CLr;h*xP$`k# xG,/, SQL &mLr&myP SQL od#(}+ REXX kb)IwCD API `aO,zITCJs`}}]b\mw &\#d; REXX ";9C6k= SQL 4 1S'V3) API,+ITS REXX &CLrP9C DB2 |nP&mw4CJb) API# Z 1 B 6k= SQL 5 IZ REXX GbMMoT,za"V,k`kMwoT`H,*"MwT REXX &C Lr-M|*]W#d;9C REXX `kD}]b&CLrDT\;g9C`kMo TD}]b&CLr,+|G9z;XxP$`k"`kM4Sr_9Cd{m~M \4(}]b&CLr# 9C SQLEXEC }L4&myP SQL od#SQLEXEC }LDV{.Td?ITB* XiI: v SQL X|V v $HywDj6 v odwd? (}+P'D SQL od+]x SQLEXEC }L4"v?vks#k9CTBo(: CALL SQLEXEC ’od’ SQL odITg`P#odD?;?V<&C(Z%}EP,"RXkC:ET=SD odD>xP(g,gBy>: CALL SQLEXEC ’SQL D>’, ’=SD>’, . . . ’nUD>’ TBzkGZ REXX P6k SQL odD>}: statement = "UPDATE STAFF SET JOB = ’Clerk’ WHERE JOB = ’Mgr’" CALL SQLEXEC ’EXECUTE IMMEDIATE :statement’ IF ( SQLCA.SQLCODE < 0) THEN SAY ’Update Error: SQLCODE = ’ SQLCA.SQLCODE ZK>}P,+li SQLCA a9D SQLCODE VNT7(|BGqI&# BPfrJCZ6k= SQL od:Z REXX &CLrP v IT+BP SQL od1S+]= SQLEXEC }L: – CALL – CLOSE – COMMIT – CONNECT – CONNECT TO – CONNECT RESET – DECLARE – DESCRIBE – DISCONNECT – EXECUTE – EXECUTE IMMEDIATE – FETCH – FREE LOCATOR – OPEN – PREPARE – RELEASE – ROLLBACK – SET CONNECTION 6 *"6k= SQL &CLr TZd{ SQL odxT,Xk(}+ EXECUTE IMMEDIATE r_ PREPARE M EXECUTE odk SQLEXEC }LdO9C4/,XxP&m# v ;\Z REXX PD CONNECT M SET CONNECTION odP9Cwd?# v k4gB==$(eNj{Mod{F: c1 = c100 Nj{,c1 = c50 D6'CZyw148( WITH HOLD !nDNj,c51 = c100 CZyw18(K WITH HOLD !nDNj# Nj{j6CZ DECLARE"OPEN"FETCH M CLOSE od#|j6 SQL ksP9CDNj# s1 = s100 od{F,6'G s1 = s100# od{Fj6k DECLARE"DESCRIBE"PREPARE M EXECUTE odd O9C# $HywDj6XkCZNj{Mod{F#;JmCZd{{F# v ywNj1,Nj{Mod{FZ DECLARE odP&C`%T&#}g,g{+ c1 CwNj{,G4Xk9C s1 w*od{F# v k;*Z SQL odP9C"M# ":REXX ;'V`_L}]bCJ# 6k= SQL &CLry'VD*"m~ DB2 }]b53'VBPYw53PCZ6k= SQL &CLrD`kw"bMwM` X*"m~: v AIX® v HP-UX v Linux v Solaris v Windows ITy]6k= SQL 4zk49( 32 ;M 64 ;6k= SQL &CLr# BPwoT*s9CX(D`kw4*"6k= SQL &CLr: v C v C++ v COBOL v Fortran v REXX hC6k= SQL *"73 ZIT*<9(6k= SQL &CLr.0,k20CZ*"&CLrDwoTy'V D`kw"hC6k= SQL 73# Z 1 B 6k= SQL 7 *<.0 v Z\'VD=(O20 DB2 }]~qw v 20 DB2 M'z v 20\'VD6k= SQL &CLr*"m~ - kND}]b&CLr*"kEPD :20\'VD6k= SQL &CLr*"m~; XZKNq Z(C'"v PREP |nM BIND |n# *i$GqQ}7XhC6k= SQL &CLr*"73,k"T9(MKPTBwb PD6k= SQL &CLr#e:6k= SQL &CLr#e(C)# 8 *"6k= SQL &CLr Z 2 B hF6k= SQL &CLr hF6k= SQL &CLr1,Xk9CT2,==r/,==4PD SQL od#2 , SQL odP=Vgq:;|,wd?Dod(w*CZu}) M9CKwd?Dod#/, SQL od2P=Vgq:|GIT;|,N}jG(CLP .`DSZDdMiv),2IT|,N}jG(b9&CLr|*in)# !qG9CT2,==4PDod9GT/,==4PDod!vZn`rX,dP |(:6k= SQL &CLrDIF2T"T\M^F# 6k= SQL DZ("bBn Z(JmC'ri4P#fNq,}g,S=}]b"4(mr\m53#X(9C 'riP(T8(==CJ;vX(D}]bTs#DB2® 9C;iX(*zZdPf "DE"a)#$# s`} SQL od*sTCody{CD}]bTs_P3V`MDX(#s`} API wC(#;*sTCwCy{CD}]bTs_PNNX(,+G,m` API *sz5 PXhD(^E\+dt/#zIT9C DB2 API S&CLrP4P DB2 \m&\# }g,*Z;h*s(D~DivBXB4(}]bPf"DLr|,IT9C sqlarbnd(r REBIND)API# ia)K;Vc{D=(*;iC'4PZ(,x;XpvX*?vC'Zhr7z X(#4P/, SQL od1,+01'6=.,rK|h*Z"E=.'11"vwV SELECT o d#PAYROLL Xk\;CJ?v01D=.#BUDGET :p7('6=.yhDp n#+G,BUDGET ;&\;i4NNX(01D=.# © Copyright IBM Corp. 1993, 2012 9 IZ PAYROLL "vm`;,D SELECT od,rK,z* PAYROLL hFD&C LrI\as?9C/, SQL#/, SQL +*s PAYROLL T STAFF m_P SELECT X(#r* PAYROLL h*TmxP+fCJ,yTKn*s;GJb# +G,BUDGET ;&PCJ?;01=.D(^#bb6E,z;&+ STAFF mD SELECT X(Zh BUDGET#IZ BUDGET h*CJ STAFF mPyP=.D\F, rK,zIT9(;v2, SQL &CLr44P SELECT SUM(SALARY) FROM STAFF,s(C&CLr"+C&CLrDLr|D EXECUTE X(Zh BUD- GET#b+9 BUDGET \;q!XhDE",x;a+CE"86x;&i4CE" D BUDGET# Z6k= SQL &CLrP4P2,M/, SQL od Z6k= SQL &CLrP,H'V4P2, SQL od2'V4P/, SQL od# v(GT2,9G/,==4P SQL od*sKbLr|"gNZKP1"v SQL o d"wd?"N}jGT0b)Z]k&CLrT\DX5# 6k= SQL LrPD2, SQL BfGT2,=="vD C odD>}: /* 9C2, SQL SmP!q5T+d3hwd?,;sxPr! */ EXEC SQL SELECT id, name, dept, salary INTO :id, :name, :dept, :salary FROM staff WHERE id = 310; 6k= SQL LrPD/, SQL BfGT/,=="vD C odD>}: /* 9C/, SQL 4|BmPDP */ strcpy(hostVarStmtDyn, "UPDATE staff SET salary = salary + 1000 WHERE dept = ?"); EXEC SQL PREPARE StmtDyn FROM :hostVarStmtDyn; EXEC SQL EXECUTE StmtDyn USING :dept; 6k= SQL /,od /, SQL odS\V{.wd?Mod{w*Td?#wd?|,*T/,==xP &mD SQL od(D>N=)#$`k&CLr1,;aTodD>xP&m#5J O,odD>Z&CLr$`kZd;XfZ#xG,C SQL od;S*wd?Tc xP$`k,Cd?+Z&CLr4PZd;}C# *+|, SQL D>Dwd?*;*I4PN=,h*9C/, SQL 'Vod#"R, /, SQL 'Vod(}}Cod{Twd?4PYw#b)'Vod|(: EXECUTE IMMEDIATE <8"4P49CNNwd?Dod#KodICZfz PREPARE M EXECUTE od# }g,k= 100"); EXEC SQL EXECUTE IMMEDIATE :qstring; PREPARE +V{.N=D SQL od*;*CodDI4PN=,8(od{,"+XZ CodDE"Ek SQLDA a9(I!)# 10 *"6k= SQL &CLr EXECUTE 4PH0<8D SQL od#ITZ;v,SP444PCod# DESCRIBE +XZQ<8DodDE"Ek SQLDA# }g,kM$w7 3#;7(1,nCDv(GH+odw*2, SQL xPbT,;sYw*/, SQL xPbT"HOnp# m 1. HO2, SQL k/, SQL SQL odT0od`kZdq!D?#TZyPX4T/, SQL &CLr,b VV/|,CZ7(;mHDli#g{lb=;mH* 64 ;, G4+hC;inbD*XTxPX*D|D# DB2 }]b53Z>ZTsP>D 32 ;M 64 ;f>Yw53O\'V#Zs`}i vB,Zb)Yw53OD 32 ;M 64 ;73P9(6k= SQL &CLr1,fZ ;)np# v AIX Z 2 B hF 13 v HP-UX v Linux v Solaris v Windows Z DB2 f> 9 P\'VD 32 ;5};P: v yZ x86 D Linux v yZ x86 D Windows v yZ x64 D Windows(9CCZyZ x86 D Windows D DB2 203q1) Z DB2 f> 9 P\'VD 64 ;5};P: v AIX v Sun v HP IPF v yZ x64 D Linux v yZ POWER® D Linux v yZ System z® D Linux v yZ x64 D Windows(9CCZ x64 D Windows 203q1) v yZ IPF D Windows v yZ IPF D Linux DB2 }]b53'VZ} Linux IA64 M Linux System z TbDyP\'V 64 ;Y w5373PKP 32 ;&CLrM}L# TZ?VwoT,Z 32 ;M/r 64 ;=(PI\nC9Cwd?#kND?V`Lo TDwV}]`M# PX6k= SQL &CLrD^F ?V\'VDwoT^F#COBOL P;ifr4oz9CfrTsD COBOL &CLr#FORTRAN P;)+a0l=$`k}LDP$lr,x REXX Z 3)lr(}goT'V)Py^F# 9C C M C++ xP6k= SQL &CLr`L1PXV{/D^ F "GyP|L R((E“}” BP}V8JITZ C r C++ 4LrPDd{;CvV: }V8J (e ??= "PjG“#” ??/ 41\“\” ??’ ekjG“^” ??! z_“|” ??– &/t{E“~” 9C COBOL xP6k= SQL &CLr`L1D^F COBOL &CLrP API wCD^F# COBOL &CLrP API wCD^F|(: v Xk9C USAGE COMP-5 Sd4ywyPCw API wCPD5N}D{}d?# ZfrTsD COBOL LrP: v ;\Z`k%*PDZ;vLrr`P9C SQL od#fZK^FD-rG,$` kw+Z|yv=DZ;v$wf"ZPekY1$w}]# v ?v|, SQL odD`: v 6k= SQL T REXX D'VQZ DB2 (C}]bf> 5 P(M,RG4F.+ 4TdxPv?#}g,REXX ^(&m$H,} 18 vVZD SQL Tsj6(} gm{)#*9C DB2 }]b53Zf> 5 .s}kD&\,}g$H* 19 = 128 vVZDm{,zXk9C} REXX TbDoT4`4&CLr# v Z REXX/SQL P,;'V4O SQL# v REXX ;'V2, SQL# v ZUor1ePD EUC 73P,;'V REXX &CLr# PX9C XML M XQuery *"6k= SQL &CLrD(i Z6k= SQL &CLrP9C XML M XQuery 1,BP(iM^FJC# v &CLrXkTrP/V{.q=4CJyP XML }]# – XkTrP/V{.q=4m>yP}],|(}V}]MUZ1d}]# v b?/D XML }]^$ 2GB# v yP|, XML }]DNj`M# v TB(iM^FJCZ2, SQL: – ;\Z SELECT INTO YwP9CV{wd?M~xFwd?4lw XML 5# – ZZ{+ XML }]`MCZdk1,9C CHAR"VARCHAR"CLOB M BLOB wd?+Kz&CNGD;)hF G'V""Bq# ZT DB2 }]b4PD_L&CLrD1!5VP,}]bCJrP/I}]b API ?F5)#g{;v_L4P}]bwC,G4d{_LxPDwC+;h{=Z; vwCjI*9,49sxwCCJkZ;vwC^XD}]bTs`gK#mb, xLPDyP_L2md5wCr#;\(}@"DxLr_(}9C>wbPhv D API 45Vf}D}]b""CJ# DB2 }]b53a)KICZVdM&m@"73(OBD)D API,Tc'V9C} ]b API M6k= SQL#?vOBDXC'(} TP `Sw(TCP/IP)4KP=WNd5,G4 DB2 Connect™ 2 P“,S};\,} 10 v”b;^F# zIT9C AIX 73d? EXTSHM 4vSxLIT,SD2mZfNDns}?# *+ EXTSHM k DB2 }]b53dO9C,k4UTBPvD=hYw: ZM'za0P: export EXTSHM=ON Zt/ DB2 ~qw1: export EXTSHM=ON db2set DB2ENVLIST=EXTSHM db2start ZVx}]b73O,9&r userprofile r usercshrc D~mSTBP: EXTSHM=ON export EXTSHM m;V=(G,+>X}]br DB2 Connect FAm;(zw"T6L==Tdx PCJ,r_(}+>X}]br DB2 Connect }]b`?*_P>Xzw TCP/IP X7D6LZc4hz TCP/IP XM&\TdxPCJ# PX9C`v_LD(i S`_L&CLrPCJ}]b1,kq-BPZvJCZ C M C++ 6k= SQL &CLr# Z AIX"Solaris M HP-UX O,TCZ}]b,SDzk3T0zR/Xxrxrzk 4PKP1i/1,9CD/}VZ_P_L2+T#+G,b)/}I\aZ9C Ks?""}]b,SD`_L&CLrP}p;)x(yC"}#g{&CLrD=vOB D.d,1fZ&CLr@5X5M}]b@5X5,G4C&CLrI\a "z@x#g{3)@5X5Z}]b\mwb?,G4C@x+;a;lb =,rKC&CLr+]RrRp# $@`vOBD.d"z@x# r* }]b\mw ^(lb=_L.dD@x,yTkT\b@xD==`k &CLr# Z 2 B hF 19 }G,&CLrP=vOBD, "Rb=vOBDCJ,;v}]a9#*K\bb=vOBD,1|DC} ]a91"zJb,C}]a9IEja)#$#Cy>OBDT>*TB1 k: OBD 1 SELECT * FROM TAB1 FOR UPDATE.... UPDATE TAB1 SET.... q!Ej CJ}]a9 MEEj COMMIT OBD 2 q!Ej CJ}]a9 SELECT * FROM TAB1... MEEj COMMIT Y(Z;vOBDI&X4P SELECT M UPDATE od,xZ~vOBDq !Ej"CJ}]a9#VZ,Z;vOBD"Tq!CEj,+|IZZ~ vOBD}}PI\"zD@x# v Zq!Ej0MEyPx(# |DOBD 1 Dzk,TcZq!Ej04Pd5# v ;*ZEjy#$DZP`k SQL od# |DOBD 2 Dzk,TcZ4P SELECT 0MEEj# v ZEjP`kyP SQL od# |DOBD 1 Dzk,TcZKP SELECT od0q!Ej#d;bV< uP',+";?R(iICKZ(}>}4hvCZ\b@xD*|(Z SQL odPD5 v ,S=}]4 v 4P SQL od v &mk SQL odD4P`XD SQL msM/f v k}]4O*,S PKj{D6k= SQL &CLr.s,zMQ<8C`kMKP&CLr:`k6k = SQL &CLr# 6k= SQL 4D~ Z*"|,6k= SQL D4zk1,h*q-?V\'VwoTDX(D~|{<(# C M C++ DdkMdvD~ 1!ivB,4&CLrIT_PBP)9{: .sqc CZyP\'VYw53OD C D~ .sqC CZ UNIX M Linux Yw53OD C++ D~ .sqx CZ Windows Yw53OD C++ D~ 1!ivB,`&D$`kwdvD~_PBP)9{: .c CZyP\'VYw53OD C D~ .C CZ UNIX M Linux Yw53OD C++ D~ .cxx CZ Windows Yw53OD C++ D~ zIT9C OUTPUT $`k!n42G-}^DDdv4D~D{FM76#g{9C TARGET C r TARGET CPLUSPLUS $`k!n,G4dkD~;h*X(D)9{# COBOL DdkMdvD~ 1!ivB,4&CLr_PTB)9{: © Copyright IBM Corp. 1993, 2012 21 .sqb CZyPYw53OD COBOL D~ +G,g{9CK TARGET $`k!n(TARGET ANSI_COBOL"TARGET IBMCOB r TARGET MFCOB),G4dkD~IT_Pz!qDNN)9{# 1!ivB,`&D$`kwdvD~_PBP)9{: .cbl CZyPYw53OD COBOL D~ +G,zIT9C OUTPUT $`k!n48(-}^DDdv4D~DB{FM76# FORTRAN DdkMdvD~ 1!ivB,4&CLr_PTB)9{: .sqf CZyPYw53OD FORTRAN D~ +G,g{+ TARGET $`k!nk FORTRAN !ndO9C,G4dkD~IT _Pz!qDNN)9{# 1!ivB,`&D$`kwdvD~_PBP)9{: .f CZ UNIX M Linux Yw53OD FORTRAN D~ .for CZ Windows Yw53OD FORTRAN D~ +G,zIT9C OUTPUT $`k!n48(-}^DDdv4D~DB{FM76# 9C C oTD6k= SQL &CLr#e bG;vr%D6k= SQL &CLr,CZbT6k= SQL *"73T0ozzK b6k= SQL &CLrDy>a9# 6k= SQL &CLrXk_PTBa9: v |(XhD7D~ v *|(Z SQL odPD5Dwd?yw v }]b,S v 4P SQL od v &mk SQL odD4P`XD SQL msM/f v >}}]b,S TB4zk]>9C C `4D6k= SQL &CLrDy>a9# y>Lr:template.sqc #include 1 #include #include #include #include EXEC SQL BEGIN DECLARE SECTION; 2 short id; char name[10]; short dept; double salary; char hostVarStmtDyn[50]; 22 *"6k= SQL &CLr EXEC SQL END DECLARE SECTION; int main() { int rc = 0; 3 EXEC SQL INCLUDE SQLCA; 4 /* ,S=}]b */ printf("\n Connecting to database..."); EXEC SQL CONNECT TO "sample"; 5 if (SQLCODE <0) 6 { printf("\nConnect Error: SQLCODE = goto connect_reset; } else { printf("\n Connected to database.\n"); } /* 9C2, SQL 44P SQL od(i/);+%;a{PD54F=wd? */ EXEC SQL SELECT id, name, dept, salary 7 INTO :id, :name, :dept, :salary FROM staff WHERE id = 310; if (SQLCODE <0) 6 { printf("Select Error: SQLCODE = } else { /* +wd?5r!=jLr:template.sqc D"M: "b hv 1 |,D~:K18n+;vD~|(=4&CLrP# 2 ywZ:ywwd?,b)wd?CZfE C &CLrD SQL odP}CD5# 3 V?d?yw:Kiyw*Z&CLrP9CDV?d?#b)d?;Gwd?# 4 |( SQLCA a9:4P?v SQL ods,<+|B SQLCA a9#K#e&C Lr9C3) SQLCA VNxPms&m# 5 ,S=}]b:9C}]bDu<=hG,kC}]b(",S#bo,(}4P SQL od CONNECT 4(",S# 6 ms&m:liGqQ"zms# 7 4Pi/:(}4PK SQL od,+my5XD}]3hwd?#Z4P SQL o ds9CD C zk+wd?PD5r!=j}}]b,S# 6k= SQL &CLryhD|,D~M(e |,D~CZa)bP9CD/}M`M#Xk|(b)D~,LrE\9Cb/ }#1!ivB,b)D~+20Z $HOME/sqllib/include D~PP#?VwoT<( }T:D=(4|(D~,"9C;,DD~)9{#y]y8(oTD;,,Xk I!X(D$@k),}g8(D~76# 24 *"6k= SQL &CLr C M C++ 6k= SQL &CLrD|,D~ X(ZwoTD C M C++ |,D~(7D~)DD~)9{* .h#zIT(}=V =(4|(D~:EXEC SQL INCLUDE odM #include j#$`kw+vT #include, x;&m(} EXEC SQL INCLUDE od|(DD~#*KR=9C EXEC SQL INCLUDE |(DD~,DB2 C $`kw+HQw10?<,;sQw DB2INCLUDE 73d?y8 (D?<#k}: v EXEC SQL INCLUDE payroll; g{4+ INCLUDE odP8(DD~}Z}EP(gOy>),G4 C $`kw+ Z|iRD?v?),G4;aTCD~{mS)9{# g{}EPDD~{4|,xT76,G4+9C DB2INCLUDE DZ]4QwD~(K Z];mS= INCLUDE D~{P8(DNN76.0)#}g,Z UNIX M Linux Yw53O,g{+ DB2INCLUDE hC*“/disk2:myfiles/c”,G4 C r C++ $` kw+@NQw“./pay/payroll.h”"“/disk2/pay/payroll.h”M“./myfiles/c/pay/ payroll.h”#CD~D5J76+T>Z$`kw{"P#Z Windows Yw53O, k+TO>}PD41\ (\) f;*}1\# "b,g{$`kw!n COMPATIBILITY_MODE hC* ORA,G4I9C+} E8(|,D~{F,}g,EXEC SQL INCLUDE "abc.h";#DB2 }]b\mwa) K&\G*K=cSd{}]b53(F6kD SQL C &CLr# ":|nP&mw+T DB2INCLUDE DhCxP_Y:f#*Z"vNN CLP |ns |D DB2INCLUDE DhC,kdk TERMINATE |n,;sXB,S=}]b"xP$` k# *Koz9`kwmsXBk-<4zk`X,$`kw+ZdvD~PzI #line j# b+Jm`kw9C4zkr_y|(4D~DD~{MPE(x;G$`kDdv 4D~PDPE)4(fms# +G,g{8(K PREPROCESSOR !n,G4$`kwzIDyP #line j<+}Cb ? C $&mwyzID$&mD~#3)+a94zkkTszk`XDwTwMd{ $_^(mIDivB9C# SQLE819A(sqle819a.h) g{}]bDzk3G 819(ISO Latin-1),G4KrP+y]wz CCSID 500(EBCDIC zJ)~xF{m3rTG FOR BIT DATA V{.xPEr# KD~I CREATE DATABASE API 9C# SQLE819B(sqle819b.h) g{}]bDzk3G 819(ISO Latin-1),G4KrP+y]wz CCSID 037(EBCDIC @z"o)~xF{m3rTG FOR BIT DATA V{.xPEr# KD~I CREATE DATABASE API 9C# SQLE850A(sqle850a.h) g{}]bDzk3G 850(ASCII Latin-1),G4KrP+y]wz CCSID 500(EBCDIC zJ)~xF{m3rTG FOR BIT DATA V{.xPEr#K D~I CREATE DATABASE API 9C# SQLE850B(sqle850b.h) g{}]bDzk3G 850(ASCII Latin-1),G4KrP+y]wz CCSID 037(EBCDIC @z"o)~xF{m3rTG FOR BIT DATA V{.xPEr# KD~I CREATE DATABASE API 9C# SQLE932A(sqle932a.h) g{}]bDzk3G 932(ASCII Uo),G4KrP+y]wz CCSID 5035(EBCDIC Uo)~xF{m3rTG FOR BIT DATA V{.xPEr# KD~I CREATE DATABASE API 9C# SQLE932B(sqle932b.h) g{}]bDzk3G 932(ASCII Uo),G4KrP+y]wz CCSID 5026(EBCDIC Uo)~xF{m3rTG FOR BIT DATA V{.xPEr# KD~I CREATE DATABASE API 9C# SQLJACB(sqljacb.h) KD~* DB2 Connect SZ(e#?"a9MXFi# SQLSTATE(sqlstate.h) KD~* SQLCA a9D SQLSTATE VN(e#?# SQLSYSTM(sqlsystm.h) KD~|,}]b\mw API M}]a9y9CDX(Z=(D(e# 26 *"6k= SQL &CLr SQLUDF(sqludf.h) KD~(eCZ`4C'(eD/} (UDF) D#?MSZa9# SQLUV(sqluv.h) KD~*l=AU> API T0m0kM6X)&Ly9CD API (ea9" #?M-M# COBOL 6k= SQL &CLrD|,D~ X(ZwoTD COBOL |,D~DD~)9{* .cbl#g{z9C IBM® COBOL `kwD“System/390® w}]`M'V”&\?~,G4&CLrD DB2 |,D~ZT B?D~49( DB2 y>Lr,G4Xk+E>D~P8(D|, D~76|D* cobol_i ?,G4&CLrD DB2 |,D~ZTB?}: v EXEC SQL INCLUDE payroll END-EXEC. g{4+ INCLUDE odP8(DD~}Z}EP(gH0>}y>),G4$`k w+Z|iRD?v?),G4;aTCD~{mS)9{# g{}EPDD~{4|,xT76,G4+9C DB2INCLUDE DZ]4QwD~ (KZ];mS= INCLUDE D~{P8(DNN76.0)#}g,TZCZ AIX D DB2 }]b53xT,g{ DB2INCLUDE hC*“/disk2:myfiles/cobol”,G 4$`kw+@NQw“./pay/payroll.cbl”"“/disk2/pay/payroll.cbl”M“./ myfiles/cobol/pay/payroll.cbl”#CD~D5J76+T>Z$`kw{"P# Z Windows =(O,k+T0T>D>}PD41\ (\) f;*}1\# ":DB2 |nP&mw+T DB2INCLUDE DhCxP_Y:f#*Z"vNN CLP |ns|D DB2INCLUDE DhC,kdk TERMINATE |n,;sXB,S=}] b"xP$`k# BfhvITZ&CLrP9CD|,D~: SQLCA(sqlca.cbl) KD~(e SQL (Ex(SQLCA)a9#SQLCA |,}]b\mwy9CD d?,b)d?*&CLra)XZ SQL odM API wCD4PivDms E"# SQLCA_92(sqlca_92.cbl) KD~|, SQL (Ex(SQLCA)a9D FIPS SQL92 kE6`]f>#Z `4{O FIPS SQL92 kE6j}: v EXEC SQL INCLUDE payroll g{4+ INCLUDE odP8(DD~}Z}EP(gH0D>}y>),G4$` kw+Z|iRD?v?),G4;aTCD~{mS)9{#(TZ Windows Yw53,&C+D~8(* ’pay\payroll.for’#) g{}EPDD~{4|,xT76,G4+9C DB2INCLUDE DZ]4QwD~ (KZ];mS= INCLUDE D~{P8(DNN76.0)#}g,TZCZ UNIX M Linux Yw53D DB2,g{ DB2INCLUDE hC*“/disk2:myfiles/ fortran”,G4$`kw+@NQw“./pay/payroll.f”"“/disk2/pay/ payroll.f”M“./myfiles/cobol/pay/payroll.f”#CD~D5J76+T>Z$` kw{"P#Z Windows Yw53O,k+H0T>>}PD41\ (\) f;*} 1\,"+)9{“for”f;*“f”# ":DB2 |nP&mw+T DB2INCLUDE DhCxP_Y:f#*Z"vNN CLP |ns|D DB2INCLUDE DhC,kdk TERMINATE |n,;sXB,S=}] b"xP$`k# xP DB2 }]b&CLr*"yhD 32 ; FORTRAN 7D~H0Z $INSTHOME/ sqllib/include P,VZrGZ $INSTHOME/sqllib/include32 P# Z 3 B `L 29 Zf> 8.1 P,b)D~Z $INSTDIR/sqllib/include ? 9.1 P,$DB2DIR/include +|,yP|,D~(32 ;M 64 ;),x $DB2DIR/ include32 ;|, 32 ; FORTRAN D~M;vTvD~,T8>} FORTRAN Tb, 32 ;|,D~k 64 ;|,D~`,# ;PZ AIX"Solaris"HP-PA M HP-IPF O,EfZ $DB2DIR/include32 ?<# ITZ&CLrP9CBP FORTRAN |,D~# SQLCA(sqlca_cn.f M sqlca_cs.f) KD~(e SQL (Ex(SQLCA)a9#SQLCA |,}]b\mwy9CD d?,b)d?*&CLra)XZ SQL odM API wCD4PivDms E"# a)K=vCZ FORTRAN &CLrD SQLCA D~#1!D~ sqlca_cs.f T IBM SQL f]q=4(e SQLCA a9#9C SQLCA NONE !nxP$` kD sqlca_cn.f D~T\;a_T\Dq=4(e SQLCA a9# SQLCA_92(sqlca_92.f) KD~|, SQL (Ex(SQLCA)a9D FIPS SQL92 kE6`]f>#Z `4{O FIPS SQL92 kE6j"mszkMoOE"# Z4P?v SQL od.s,53+Z SQLCODE M SQLSTATE P5X;v5Xk# SQLCODE G{}5,|a)PXod4PivD**E";SQLSTATE GV{VN, |a) IBM DwvX5}]bz7D+2mszk#SQLSTATE 9{O ISO/ANS SQL92 M FIPS 127-2 j<# ":FIPS 127-2 G8}]boT SQL D@z*nE"&mjQ"zms,"R4&mCod#g{ SQLCODE sZ 0,G4m>Q"v/f,+T&mCod# Z 3 B `L 31 TZ9C C r C++ `4D DB2 &CLr,g{C&CLrI`v4D~iI,G4 &C;PdP;vD~|, EXEC SQL INCLUDE SQLCA odT\b`N(e SQLCA#d`4D~Xk9CBPwP: #include "sqlca.h" extern struct sqlca sqlca; }L *yw SQLCA,kZLrP`k INCLUDE SQLCA od: v TZ C r C++ &CLr,k9C: EXEC SQL INCLUDE SQLCA; v TZ Java &CLr,;\T=X9C SQLCA#xG,9C SQLException 5}= (4q! SQLSTATE M SQLCODE 5# v TZ COBOL &CLr,k9C: EXEC SQL INCLUDE SQLCA END-EXEC. v TZ FORTRAN &CLr,k9C: EXEC SQL INCLUDE SQLCA B;=v24 gG&CLrXk{O ISO/ANS SQL92 r FIPS 127-2 j<,k;*9COvodr INCLUDE SQLCA od# 9C WHENEVER odxPms&m WHENEVER od&CLrZ4PZd"zms"v V/frR;=P1*A8(DjE#WHENEVER od+0lsxyPI4PD SQL od,1=m;v WHENEVER odDdbViv*9# WHENEVER odP}Vy>q=: EXEC SQL WHENEVER SQLERROR Yw EXEC SQL WHENEVER SQLWARNING Yw EXEC SQL WHENEVER NOT FOUND Yw Zb)odP: SQLERROR j6 SQLCODE < 0 DNNiv# SQLWARNING j6 SQLWARN(0) = W r SQLCODE > 0 +;HZ 100 DNNiv# NOT FOUND j6 SQLCODE = 100 DNNiv# Z?VivP,action ITG CONTINUE r GO TO }4zk FORTRAN include ’sqldact.f’ integer*2 sqlvar1 parameter ( sqlvar1 = sqlda_header_sz + 0*sqlvar_struct_sz ) C ywdv SQLDA -- 1 vd? character out_sqlda(sqlda_header_sz + 1*sqlvar_struct_sz) character*8 out_sqldaid ! 7 integer*4 out_sqldabc integer*2 out_sqln integer*2 out_sqld integer*2 out_sqltype1 ! Z;vd? integer*2 out_sqllen1 integer*4 out_sqldata1 integer*4 out_sqlind1 integer*2 out_sqlnamel1 character*30 out_sqlnamec1 equivalence( out_sqlda(sqlda_sqldaid_ofs), out_sqldaid ) equivalence( out_sqlda(sqlda_sqldabc_ofs), out_sqldabc ) equivalence( out_sqlda(sqlda_sqln_ofs), out_sqln ) equivalence( out_sqlda(sqlda_sqld_ofs), out_sqld ) equivalence( out_sqlda(sqlvar1+sqlvar_type_ofs), out_sqltype1 ) equivalence( out_sqlda(sqlvar1+sqlvar_len_ofs), out_sqllen1 ) equivalence( out_sqlda(sqlvar1+sqlvar_data_ofs), out_sqldata1 ) equivalence( out_sqlda(sqlvar1+sqlvar_ind_ofs), out_sqlind1 ) equivalence( out_sqlda(sqlvar1+sqlvar_name_length_ofs), + out_sqlnamel1 ) equivalence( out_sqlda(sqlvar1+sqlvar_name_data_ofs), + out_sqlnamec1 ) C ywCZfEy5XD}]DV?d?# real*8 salary integer*2 sal_ind C u}GkT 32 ; FORTRAN `4D# Z;'V/,ZfVdDoTP,XkZwoTPw7yw|,yh}?D SQLVAR * XD SQLDA#k7#y]&CLrDh*ywc;D SQLVAR *X# Z/,4PD SQL LrP9C SQLDA a94+d}] XZKNq 9C SQLDA +d}]H9Cwd?Pm+d}]|*in#}g,IT9C SQLDA 4+dZ>zwoTP;PH,}]D}],}g C oTPD DECIMAL }]# Z 3 B `L 115 k9CBmw*;f}CPm,KPm5w}V5k{E{F.dDX5# m 17. DB2 SQLDA SQL `M SQL P`M SQLTYPE }V5 SQLTYPE {E{F1 DATE 384/385 SQL_TYP_DATE / SQL_TYP_NDATE TIME 388/389 SQL_TYP_TIME / SQL_TYP_NTIME TIMESTAMP 392/393 SQL_TYP_STAMP / SQL_TYP_NSTAMP ;JC2 400/401 SQL_TYP_CGSTR / SQL_TYP_NCGSTR BLOB 404/405 SQL_TYP_BLOB / SQL_TYP_NBLOB CLOB 408/409 SQL_TYP_CLOB / SQL_TYP_NCLOB DBCLOB 412/413 SQL_TYP_DBCLOB / SQL_TYP_NDBCLOB VARCHAR 448/449 SQL_TYP_VARCHAR / SQL_TYP_NVARCHAR CHAR 452/453 SQL_TYP_CHAR / SQL_TYP_NCHAR LONG VARCHAR 456/457 SQL_TYP_LONG / SQL_TYP_NLONG ;JC3 460/461 SQL_TYP_CSTR / SQL_TYP_NCSTR VARGRAPHIC 464/465 SQL_TYP_VARGRAPH / SQL_TYP_NVARGRAPH GRAPHIC 468/469 SQL_TYP_GRAPHIC / SQL_TYP_NGRAPHIC LONG VARGRAPHIC 472/473 SQL_TYP_LONGRAPH / SQL_TYP_NLONGRAPH FLOAT 480/481 SQL_TYP_FLOAT / SQL_TYP_NFLOAT REAL4 480/481 SQL_TYP_FLOAT / SQL_TYP_NFLOAT DECIMAL5 484/485 SQL_TYP_DECIMAL / SQL_TYP_DECIMAL INTEGER 496/497 SQL_TYP_INTEGER / SQL_TYP_NINTEGER SMALLINT 500/501 SQL_TYP_SMALL / SQL_TYP_NSMALL ;JC 804/805 SQL_TYP_BLOB_FILE / SQL_TYPE_NBLOB_FILE ;JC 808/809 SQL_TYP_CLOB_FILE / SQL_TYPE_NCLOB_FILE ;JC 812/813 SQL_TYP_DBCLOB_FILE / SQL_TYPE_NDBCLOB_FILE ;JC 960/961 SQL_TYP_BLOB_LOCATOR / SQL_TYP_NBLOB_LOCATOR ;JC 964/965 SQL_TYP_CLOB_LOCATOR / SQL_TYP_NCLOB_LOCATOR ;JC 968/969 SQL_TYP_DBCLOB_LOCATOR / SQL_TYP_NDBCLOB_LOCATOR XML 988/989 SQL_TYP_XML / SQL_TYP_XML ":Z sqllib ?,b)N}jGIJE8 >#N}jGJmC'k&CLrxP;%,b`FZ2, SQL odDwd?# k+ PREPARE M DESCRIBE odk SQLDA a9dO9C,T9&CLr\;7 (}Z"vD SQL odD`M"4P`&DYw# Z/,4PD SQL LrP7(od`M <8 SQL od1,IT(}li SQLDA a947(XZod`MDE"#KE"G Zod<8Zd(} INTO SdEk SQLDA a9D,r_G(}TH0<8Dod "v DESCRIBE odEkCa9D# ^[ZD;VivB,}]b\mw<+Z SQLDA a9D SQLD VNPEC;v5, T8>C SQL odyzIDa{mPDP}#g{ SQLD VN|,c(0),G4m wCod;G SELECT od#IZCodQ<8jO,rKIT(} EXECUTE od "44P# g{Cod|,N}jG,G4Xk8( USING Sd#USING SdIT8(wd?P mr_ SQLDA a9# g{ SQLD VNsZc,G4mwCodG SELECT od"RXk4BPwZhvD ==xP&m# Z/,4PD SQL LrP&mIdPm SELECT od IdPm SELECT odG8,*5XDPD}?M`MZ$`k14*#ZKivB, &CLr^(BH*@*KfEa{mDPxhywD7Pwd?# }L *&mIdPm SELECT od,kTzD&CLrxP`kT4PTB=h: 1. yw SQLDA# Xk9C SQLDA a94&mIdPm SELECT od# 2. 9C INTO Sd4<8od# ;s,&CLr7(yywD SQLDA a9Gq|,c;D SQLVAR *X#g{ |;Pc;D*X,G4&CLr+Vdm;v|,yh}? SQLVAR *XD SQLDA a9,"9CBD SQLDA 4"vm;v DESCRIBE od# 3. Vd SQLVAR *X# *?v SQLVAR yhDwd?M8>{Vdf"w#K=h|(+z*}]M8> {d?VdDX7Ek?v SQLVAR *X# 4. &mC SELECT od# r*kQ<8Dod`X*DNj,;s9C}7VdD SQLDA a94CfP# #f4TnUC'D SQL ks g{&CLrDC'ITS&CLrP"v SQL ks,G4zI\k#fb)ks# Z 3 B `L 117 XZKNq g{&CLrJmC'#fNbD SQL od,G4zIT+d#f=P}]`M* VARCHAR"CLOB"VARGRAPHIC r DBCLOB DmP#"b,VARGRAPHIC M DBCLOB }]`MvJCZ+VZV{/(DBCS)M)9 UNIX zk(EUC)73# Xk#f4 SQL od,x;\#f<8jODf>#bb6E,Z4PmPf"Df >.0,Xklw"<8?vod#5JO,&CLry]V{.4<8 SQL od" /,X4PKod# (}9CN}jG*/,4PD SQL oda)d?dk Z/, SQL odP,IJE(?)rsz{FD0E(:{F)8>DN}jGCZf; wd?# XZKNq /, SQL od;\|,wd?,bGr*;PZ&CLr$`kZdE\qCwd? E"(}]`MM$H);Z4PZd,^(qCwd?E"#Z/, SQL odP, 9CN}jG4zfwd?#N}jGIJE(?)rsz{FD0E(:{F)8>, |8> SQL odPf;wd?D;C# }g,Y(*9C/, SQL od4y]M1`E5>} TEMPL mPD}]#zIT 8(|,N}jGD DELETE od,gBy>: DELETE FROM TEMPL WHERE EMPNO = ? *4PKod,k* EXECUTE odD USING Sd8(wd?r SQLDA a9#w d?DZ]+C48( EMPNO D5# g{49CSY<8&\,4,4hC"amd? DB2_DEFERRED_PREPARE_SEMANTICS r _+dhC* NO,G4N}jGD}]`MM$H!vZ SQL odPN}jGDOB D#g{^(y]9CN}jGDodDOBD47(N}jGD}]`M,k9C CAST f648(}]`M#zTd9CK CAST f6DN}jG;F*x`MN}j G#x`MN}jG;S* CAST f6P9CD}]`MDwd?#}g,od SELECT ? FROM SYSCAT.TABLES ^',bGr*a{PD}]`M4*#+G,od SELECT CAST(? AS INTEGER) FROM SYSCAT.TABLES P',bGr* CAST f68>CN}j Gm>{}5;a{PD}]`MQ*# g{}Z9CSY<8&\,4,+"amd? DB2_DEFERRED_PREPARE_SEMANTICS h C* YES,G4odD<8$w+FY=z"v OPEN r EXECUTE od1xP#< 8od1,Y(N}jGD`Mk SQLDA P`&wd?rE"D`M%d#Zod` kZd,SQL `kwI\ay]N}jGZodPDOBD4E/N}jGD`M#g {}Z9CSY<8&\,G4od SELECT ? FROM SYSCAT.TABLES P',"Ra{P D`MyZkN}jGs(Dwd?D`M# g{ SQL od|,`vN}jG,G4 EXECUTE odD USING SdXk8(BP dP;V`MDE": v wd?DPm(?vN}jG} BP>}5wgNZ/, SQL LrP9CN}jG: v C M C++(dbuse.sqc/dbuse.sqC) C oTy> dbuse.sqc PD/} DynamicStmtWithMarkersEXECUTEusingHostVars() 5wgN(}wd?9CN}jG44P>}: EXEC SQL BEGIN DECLARE SECTION; char hostVarStmt1[50]; short hostVarDeptnumb; EXEC SQL END DECLARE SECTION; /* prepare the statement with a parameter marker */ strcpy(hostVarStmt1, "DELETE FROM org WHERE deptnumb = ?"); EXEC SQL PREPARE Stmt1 FROM :hostVarStmt1; /* execute the statement for hostVarDeptnumb = 15 */ hostVarDeptnumb = 15; EXEC SQL EXECUTE Stmt1 USING :hostVarDeptnumb; v COBOL(varinp.sqb) 4T COBOL y> varinp.sqb DTB>}5wgNZQwu~M|Bu~P9CN }jG: EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 pname pic x(10). 01 dept pic s9(4) comp-5. 01 st pic x(127). 01 parm-var pic x(5). EXEC SQL END DECLARE SECTION END-EXEC. move "SELECT name, dept FROM staff - " WHERE job = ? FOR UPDATE OF job" to st. EXEC SQL PREPARE s1 FROM :st END-EXEC. EXEC SQL DECLARE c1 CURSOR FOR s1 END-EXEC. move "Mgr" to parm-var. EXEC SQL OPEN c1 USING :parm-var END-EXEC move "Clerk" to parm-var. move "UPDATE staff SET job = ? WHERE CURRENT OF c1" to st. EXEC SQL PREPARE s2 from :st END-EXEC. * call the FETCH and UPDATE loop. perform Fetch-Loop thru End-Fetch-Loop until SQLCODE not equal 0. EXEC SQL CLOSE c1 END-EXEC. Z6k= SQL &CLrPwC}L (}9l"4P|,J1}L}CMN}D CALL od,ITS6k= SQL &CLr PwC}L#ITS6k= SQL &CLrP2,r/,X"v CALL od#+G,T Z 3 B `L 119 Z?V`LoT,"vK|nD=(Py;,#^[9CDVwoT,N}D==r$ZC(#IN M OUT N} 45+],INOUT N}4}C+]# 9C C M C++ &CLr1,IT9CTBod4wCf"}L INOUT_PARAM: EXEC SQL CALL INOUT_PARAM(:inout_median:medianind, :out_sqlcode:codeind, :out_buffer:bufferind); dP,inout_median"out_sqlcode M out_buffer Gwd?,x medianind"codeind M bufferind G null 8>{d?# ":mb,9IT(}<8 CALL odT/,==wCf"}L# S REXX PwCf"}L IT9C~qwODNN\'VoT(AIX 53OD REXX }b)4`4f"}L# (Z AIX 53O,IT9C REXX 4`4M'z&CLr,+kd{oT`,,Z AIX O,|G;\wC9C REXX `4Df"}L#) Z6k= SQL &CLrPA!Mv/a{/ 6k= SQL &CLrDdP;nn#CNqGlw}]#KNq(} SELECT odj I,CodG;Vi/N=,|Z}]bPQw{Oy8(Qwu~DmP#g{f ZbyDP,G4+lw}]"+dEkwLrPD8(d?,ZC;C,|ITC ZyhFDNNC># ":6k= SQL &CLrIT(}NN\'VDf"}L5V4wCf"}L,"I TlwdvN}5MdkdvN}5,+6k= SQL &CLr^(A!Mv/f"} Ly5XDa{/# Z`4 SELECT od.s,z&C`k SQL odT(e+E"+]=&CLrD= =# 120 *"6k= SQL &CLr zIT+ SELECT odDa{kqI;vIPMPiIDm,bk}]bPDmG#` F#g{;5XK;P,G4IT+a{1S+]x SELECT INTO ody8(Dwd ?# g{5XK`P,G4Xk9CNj4?Na!;P#NjGI&CLr9C"_P {FDXFa9,CZ8rPrP/PDX(P# Z6k= SQL &CLrPv/H0lwD}] XZKNq &CLrS}]blw}]1,FETCH odJm|r0v/}],+G,;PNN SQL odJmrsv/a{/(`1Zrs FETCH)#+G,CLI M DB2 (C JDBC } /Lr(};ADIv/Nj4'Vrs FETCH# }L TZ6k= SQL &CLr,zIT9CBP,"(};)`L Z3)ivB,#t&CLrya!D}]D1>G#PC# }L *#t}]D1>,zD&CLrI4PBPdP;nNq: v Zibf"wP#fQa!D}]# v +}]4kY1D~(g{C}]Zibf"wP0;BD0)#K=(D;v' {G,rsv/DC'\G4=G)Qa!D}],49}]bPD}]ZKZd Q;3vBq|D`gK# v (}9C“IX4A”tk6p,IT(}XU"r*Nj4YNlwSBqlwD }]#;Jmd{&CLr|Ba{/PD}]#tk6pMx(I\a0lC' |B}]D==# Z6k= SQL &CLrPYNlwQa!D}] CZYNlw}]D= ’M95’ ORDER BY DEPTNO Kod+Nj(;ZzyZ{D;C# v 44r3rlw}] }rGPD1!3r#g{TZ DEPTNO D?v5;P;P,G4TBod+8(P D(;}r: SELECT * FROM DEPARTMENT WHERE LOCATION = ’CALIFORNIA’ ORDER BY DEPTNO *4=r3r4lw`,DP,k8(5r,gTBody>: SELECT * FROM DEPARTMENT WHERE LOCATION = ’CALIFORNIA’ ORDER BY DEPTNO DESC Z~vodPDNj4Z;vodPDNjD4r3r4lwP#v1Z;vod 8(K(;DEr3r1,lw3rEP#$# *4`43r4lwP,I\nC9(=vyZ DEPTNO PDw},dP;vIC} r3r,m;vIC5r3r# a{mPDP3rnp ,;v SELECT odD`va{mPDPI\aT;,3rvV#}G SELECT od 9CK ORDER BY,qr}]b\mwO*P3r";X*#rK,g{fZ`v_ P`, DEPTNO 5DP,G4Z~v SELECT odI\aT;,ZZ;v SELECT o dD3r4lwb)P#(;D#$G,b)P+<4 ORDER BY DEPTNO SdD *sT?EE3rvV# 49YN"v,;v SQL od"Rwd?2`,,3r=f2I\aPnp#}g, Zb=N4P.d,I\|BK?}Kw}#;s,z ITYN"vC SELECT od# g{Z~v SELECT od|,Z;v SELECT ody;PD=J,G43r|PI\ aPd/;}]b\mwI\a!q9CyZB=JDw}#}g,|I\*>}P DZ;vod!qyZ LOCATION Dw},"*Z~vod!qyZ DEPTNO Dw}# IZ4w}|D3ra!P,rK,Z~ND3r;h*kZ;ND3r`,# ,y,4P=v`FD SELECT odI\azz;,DP3r,493FE"4Pd/ "R44(r>}NNw}`gK#Z>}P,g{fZm`;,D LOCATION 5,G 4}]b\mwI\a*b=vod} |DZ~vodP DEPTNO D5a= ’Z98’ ORDER BY DEPTNO IZ SQL odq=kKodPD5.dfZ"nDX5,rK,}G(} ORDER BY Sd4(;X7(3r,qr@6;&Y(=v;,D SQL od+4`,D3r5X P# Z6k= SQL &CLrP|BH0lwD}] *rsv/"|BH0lwD}],zIT9C;iC4v/H0lwD}]M|B QlwD}]D}ylwD}] XZKNq zIT|BM>}Njy}CDP#*9PI|B,kNj`T&Di/;\G;A i/# *9CNjxP|B,kZ UPDATE odP9C WHERE CURRENT OF Sd#9C FOR UPDATE Sd4(*53z*|Ba{mD3)P#FOR UPDATE P8(DP ;X|,Z+i/P;rK,IT|BNj4T=lwDP#g{8(K FOR UPDATE Sd,+48(P{,G4+O*b?+i/PZ;v FROM Sdyj6DmrS< PyPDP}DYw(} DELETE odPD WHERE CURRENT OF SdjI# (#,>}NjD10P1,;h*8( FOR UPDATE Sd#(;D}bivG,T &CLrPD SELECT odr DELETE od9C/, SQL,xC&CLrZ LANGLEVEL hC* SAA1 DivBxP$`k"Z8(K BLOCKING ALL Di vBxPs(#ZbVivB,XkZ SELECT odP8( FOR UPDATE Sd# DELETE od+}Njy}CDP#K>}Yw+9Nj(;ZB;P.0,Z TCNj4Pd{ WHERE CURRENT OF Yw.0,Xk"v FETCH od# T2,==4PD SQL LrPDa!>} TBy>9CNjTm4P!q,r*Nj,;sSmPa!P#TZya!D?; P,KLry]r%u~7(GXk>}9G|BCP# REXX oT;'V2, SQL,rK4a)y># v C M C++(tbmod.sqc/tbmod.sqC) TB>}9CNjTm4P!q,r*Nj,a!"|Br>}mPDP,;sX UNj# EXEC SQL DECLARE c1 CURSOR FOR SELECT * FROM staff WHERE id >= 310; EXEC SQL OPEN c1; EXEC SQL FETCH c1 INTO :id, :name, :dept, :job:jobInd, :years:yearsInd, :salary, :comm:commInd; Ky>8uhvKyPI\Dm}]^Div# v COBOL(openftch.sqb) TB>}4Ty> openftch#K>}9CNjTm4P!q,r*Nj,;sSm Pa!P# EXEC SQL DECLARE c1 CURSOR FOR SELECT name, dept FROM staff WHERE job=’Mgr’ FOR UPDATE OF job END-EXEC. EXEC SQL OPEN c1 END-EXEC * call the FETCH and UPDATE/DELETE loop. 124 *"6k= SQL &CLr perform Fetch-Loop thru End-Fetch-Loop until SQLCODE not equal 0. EXEC SQL CLOSE c1 END-EXEC. Z6k= SQL &CLrPlwms{" y]CZ`4&CLrDoT;,,IT9C;,D=(4lwmsE": v C"C++ M COBOL &CLrIT9C GET ERROR MESSAGE API 4q!k+ kD SQLCA `XD`&E"# C >}:UTILAPI.C PD SqlInfoPrint }L /****************************************************************************** ** 1.1 - SqlInfoPrint - prints diagnostic information to the screen. ** ******************************************************************************/ int SqlInfoPrint( char * appMsg, struct sqlca * pSqlca, int line, char * file ) { int rc = 0; char sqlInfo[1024]; char sqlInfoToken[1024]; char sqlstateMsg[1024]; char errorMsg[1024]; if (pSqlca->sqlcode != 0 && pSqlca->sqlcode != 100) { strcpy(sqlInfo, ""); if( pSqlca->sqlcode < 0) { sprintf( sqlInfoToken, "\n---- error report ----\n"); strcat( sqlInfo, sqlInfoToken); } else { sprintf( sqlInfoToken, "\n---- warning report ----\n"); strcat( sqlInfo, sqlInfoToken); } /* endif */ sprintf( sqlInfoToken, " app. message = %s\n", appMsg); strcat( sqlInfo, sqlInfoToken); sprintf( sqlInfoToken, " line = %d\n", line); strcat( sqlInfo, sqlInfoToken); sprintf( sqlInfoToken, " file = %s\n", file); strcat( sqlInfo, sqlInfoToken); sprintf( sqlInfoToken, " SQLCODE = %ld\n", pSqlca->sqlcode); strcat( sqlInfo, sqlInfoToken); /* get error message */ rc = sqlaintp( errorMsg, 1024, 80, pSqlca); /* return code is the length of the errorMsg string */ if( rc > 0) { sprintf( sqlInfoToken, "%s\n", errorMsg); strcat( sqlInfo, sqlInfoToken); } /* get SQLSTATE message */ rc = sqlogstt( sqlstateMsg, 1024, 80, pSqlca->sqlstate); if (rc == 0) { sprintf( sqlInfoToken, "%s\n", sqlstateMsg); strcat( sqlInfo, sqlInfoToken); } if( pSqlca->sqlcode < 0) { sprintf( sqlInfoToken, "--- end error report ---\n"); strcat( sqlInfo, sqlInfoToken); printf("%s", sqlInfo); Z 3 B `L 125 return 1; } else { sprintf( sqlInfoToken, "--- end warning report ---\n"); strcat( sqlInfo, sqlInfoToken); printf("%s", sqlInfo); return 0; } /* endif */ } /* endif */ return 0; } C *"_9IT9CH[/} sqlglm(),C/}_PTBXw{: sqlglm(char *message_buffer_ptr, int *buffer_size_ptr, int *msg_size_ptr) COBOL >}:4T CHECKERR.CBL ******************************** * GET ERROR MESSAGE API called * ******************************** call "sqlgintp" using by value buffer-size by value line-width by reference sqlca by reference error-buffer returning error-rc. ************************ * GET SQLSTATE MESSAGE * ************************ call "sqlggstt" using by value buffer-size by value line-width by reference sqlstate by reference state-buffer returning state-rc. if error-rc is greater than 0 display error-buffer. if state-rc is greater than 0 display state-buffer. if state-rc is less than 0 display "return code from GET SQLSTATE =" state-rc. if SQLCODE is less than 0 display "--- end error report ---" go to End-Prog. display "--- end error report ---" display "CONTINUING PROGRAM WITH WARNINGS!". v REXX &CLr9C CHECKERR }L# /****** CHECKERR - Check SQLCODE *****/ CHECKERR: arg errloc if ( SQLCA.SQLCODE=0)then return 0 else do say ’--- error report ---’ say ’ERROR occurred :’ errloc say ’SQLCODE :’ SQLCA.SQLCODE /*********************\ * GET ERROR MESSAGE * \*********************/ 126 *"6k= SQL &CLr call SQLDBS ’GET MESSAGE INTO :errmsg LINEWIDTH 80’ say errmsg say ’--- end error report ---’ if (SQLCA.SQLCODE<0)then exit else do say ’WARNING - CONTINUING PROGRAM WITH ERRORS’ return 0 end end return 0 SQLCODE"SQLSTATE M SQLWARN VNPDmsE" msE"Z SQLCA a9D SQLCODE M SQLSTATE VNP5X,Ca9Z?vI 4P SQL odT0s?V}]b\mw API wC.s;|B# |,I4P SQL odD4D~ITAYa);v{* sqlca D SQLCA a9#SQLCA a9Z SQLCA |,D~P(e#4|,6k= SQL od+wCK}]b\mw API D4D~9ITa);vr`v SQLCA a9,+|GIT_PNbD{F# g{&CLr{O FIPS 127-2 j<,G4TZ C"C++"COBOL M FORTRAN &C Lr,IT+ SQLSTATE M SQLCODE yw*wd?,Tzf9C SQLCA a9# SQLCODE 5 0 m>4PI&(I\fZ SQLWARN /fiv)#}}5m>od QI&X4PjI,+vV/f,}gwd?;XO#:}5m>"zmsiv# m;vVN SQLSTATE |,j{}i,49 SQLCODE *c`gK#g{ SQLWARN }iP}Z;v*X SQLWARN0 TbDyPd{*Xy*U,G4Z;v*X2* U#g{} SQLWARN0 TbDAY;v*X|,/fV{,G4 SQLWARN0 |, W# ":g{zk*"h*CJwV IBM RDBMS ~qwD&CLr,G4&C: v PI\1,C&CLrli SQLSTATE x;G SQLCODE# v g{&CLr+9C DB2 Connect,kwba)\'VwoTPDO *,SodD>}# Z C M C++ 6k= SQL &CLrPk DB2 }]bO*,S 9C C M C++ &CLr1,(}"vTBod4XU}]b,S: EXEC SQL CONNECT RESET; Z COBOL 6k= SQL &CLrPk DB2 }]bO*,S 9C COBOL &CLr1,(}"vTBod4XU}]b,S: EXEC SQL CONNECT RESET END-EXEC. Z REXX 6k= SQL &CLrPk DB2 }]bO*,S 9C REXX &CLr1,(}"vTBod4XU}]b,S: CALL SQLEXEC ’CONNECT RESET’ 9C FORTRAN &CLr1,(}"vTBod4XU}]b,S: EXEC SQL CONNECT RESET 128 *"6k= SQL &CLr Z 4 B 9(6k= SQL &CLr Z4(6k= SQL &CLrD4zk.s,Xk4P=SD=hE\9(C&CLr# Z*"BD6k= SQL }]b&CLr1,z&Cb)=hD3rT0Q`kDdM DB2 &CLrDwv#i: 1. 4(|,xP6k= SQL odDLrD4D~# 2. ,S=}]b,;s$`k?v4D~Tc+6k= SQL 4zkod*;*}]b \mw\;9CDN=# IZ&CLrP8(D SQL od"GX(ZwoT,rK}]b\mwa)K;V =(4*; SQL o(,TcIwoTxP&m#TZ C"C++"COBOL r FOR- TRAN oT,K*;I9C PRECOMPILE(r PREP)|nwCD DB2 $`kw& m#$`kw+6k= SQL od1S*;* DB2 KP1~q API wC#$`k wZ&m4D~1,|(EiR SQL od"\b&mG SQL woT# 3. (}9CwoT`kw,T-}^DD4D~(Md{;|, SQL odDD~)x P`k# 4. +TsD~k DB2 MwoTb4S,TczII4PLr# `kM4S(=h 3 M 4)+4(yhDTs#i# 5. g{P4Z4P$`k14(Lr|,r_+*CJm;v}]b,kTs(D~ xPs(T4(Lr|#s(Yw+4(}]b\mw*ZCLrKP19CDL r|# 6. KPC&CLr#C&CLr+9CCJ=84CJC}]b# © Copyright IBM Corp. 1993, 2012 129 9C PRECOMPILE |n4$`k6k= SQL &CLr 4(6k= SQL &CLrD4D~.s,Xk9C PREP |n("8(X(ZwoT D!n)T|, SQL odD?vwoTD~xP$`k# $`kw+4D~P|,D SQL od*;*"M,"*G)odzI DB2 KP1 API wC# SQL SQL (db2 PREP) PACKAGE     ! "#$%&() '* '* (db2 BIND) BINDFILE '* 1 2 3 4 6 5 < 3. T9C`kMwoT`4DLrxP<8 130 *"6k= SQL &CLr XkH4P$`kDM'zMDM'zOKP6k=&CLr,bkC &CLrD`k;C^X#}g,Z DB2 V9.5 M'zO$`k6k=&CLr.s, ;'V"TZ DB2 V9.1 M'zOKPC&CLr# g{&CLr9CDzk3k}]bzk3;,,G4zh*O$`k&CLr,"R$`kwZM'zOzI-}^DD4zkM{",+$ `kw9C~qw,S44P?Vi$# $`kw9+4(}]b\mwT}]b&m SQL od1yhDE"#KE"f"Z Lr|M/rs(D~P,b!vZz!qD$`kw!n# BfG9C$`kwDdM>}#*$`k{* filename.sqc D C 6k= SQL 4 D~,zIT"vTB|nT4(1!{F* filename.c D C 4D~T01!{F * filename.bnd Ds(D~: DB2 PREP filename.sqc BINDFILE $`kwzI`oDV`MDdv: -}^DD4zk Z$`kw+ SQL od*;* DB2 KP1 API wCs,KD~G-<4D ~zIDBf>#+*d8(J1DwoT)9{# Lr| g{9C PACKAGE N}(1!5),r_48(NN BINDFILE"SYNTAX r SQLFLAG N},G4Lr|+f"Zy,SD}]bP#Lr|;|,TK}] b"vX(4D~D2, SQL odyhDyPE"#}Gz9C PACKAGE USING N}48(m;v{F,qr$`kw+9C4D~{D0 8 vV{4 9lLr|{# g{Z48( SQLERROR CONTINUE DivB9C PACKAGE N},G4$`k }LP9CD}]bXk|,4D~PD2, SQL ody}CDyP}]bT s#}g,}G SELECT ody}CDmfZZ}]bP,qr^($`kC od# hz VERSION N},+Ts(D~(g{9CK BINDFILE N})MLr|(g {Z PREP 1xPs(r_%@xPs()8(X(Df>j6#`v_P`, {FM4(_DLr|f>IT,1fZ# s(D~ g{9C BINDFILE N},G4$`kw+4(;vs(D~()9{* .bnd),KD~|,4(Lr|1yhD}]#Ts,IT+KD~k BIND | ndO9C,Tc+C&CLrk;vr`v}]bs(#g{8( BINDFILE Z 4 B 9( 131 "R48( PACKAGE N},G4s(+;SY=zwC BIND |n1xP#" b,TZ|nP&mw (CLP) xT,PREP Z1!ivB;8( BINDFILE N }#rK,g{z}Z9C CLP,"RkSYs(,G4h*8( BINDFILE N }# 8( SQLERROR CONTINUE I4(Lr|,49Zs( SQL od1"zms2 GgK#g{98(K VALIDATE RUN,G4ITZ4P1T]v==s(G) IZZ(rfZ-rx4\s(Dod#ZKP1,"T"vG)od+zI ms# {"D~ g{9C MESSAGES N},G4$`kwa+{"X(r=8(DD~#b){ "|(CZhv$`kZdv=DJbD/fMms{"#g{4\I&X$ `k4D~,k9C/fMms{"47(Jb,|}4D~,;sYN"T $`k4D~#g{;P9C MESSAGES N},G4$`k{"+;4Aj+*wCDNNLr| 9.1 z/OS® f(DB2 z/OS f)EP CURRENT PACKAGESET ( CDfw,bJmz9C`&D SET CURRENT PACKAGESET odT=hC5(% ;#={)#d; DB2 Database for Linux, UNIX, and WindowsP SET CURRENT PACKAGESET od,+;P CURRENT PACKAGESET (CDfw#bb6E,T Z DB2 Database for Linux, UNIX, and WindowsxT,^(Zd{OBD(}g SELECT od)P}C CURRENT PACKAGESET#DB2 i f4a)T CURRENT PACKAGESET D'V# DB2 }]b~qw|*in,4,|\;ZLr|bvZd},h*"v 5 v SET CURRENT PACKAGESET od#+G,(}9C CUR- RENT PACKAGE PATH (CDfw,%; SET odQc;#}g: SET CURRENT PACKAGE PATH = SCHEMA1, SCHEMA2, SCHEMA3, SCHEMA, SCHEMA5; ":Z DB2 Database for Linux, UNIX, and WindowsP,IT(} db2cli.ini D~" (}9C SQLSetConnectAttr API"(} SQLE-CLIENT-INFO a9r_(}Z6k= SQL LrP|( SET CURRENT PACKAGE PATH od4hC CURRENT PACK- AGE PATH (CDfw#;P DB2 z/OS fDf> 8 r|_f>E'V SET CUR- RENT PACKAGE PATH od#g{T DB2 Database for Linux, UNIX, and Win- dows~qwr DB2 i f"vKod,G4+5X -30005# IT9C`v#=4,$Lr|D`vde#b)deTZozXFzZzz73P ywD|DxTG#PC#mb,9IT9CLr|D;,de4#tLr|D8] f>r_Lr|DbTf>(}g,Tc@@Bw}D0l)#H0Lr|f>D9 C==k8]&CLr(0k#irI4PD~)`,,_exT,CZa)V4= H0f>D\&# }g,Y( PROD #=|,zz&CLry9CD10Lr|,"R BACKUP #= CZf"G)Lr|D8]1>#(}9C PROD #=xPs(,+Bf>D&CLr (T0Lr|)a}=zz73#(}9C8]#=(BACKUP)4s(&CLrD 10f>,4(Lr|D8]1>#;s,ZKP1,zIT9C SET CURRENT PACKAGE PATH od48(Z#=PiRLr|1&ICD3r#Y(Q9C BACKUP #=4s(&CLr MYAPPL D8]1>,"Rzz73PD10&CLr f>Qk PROD #=s((Sx4(KLr| PROD.MYAPPL)#*8(&CZ PROD #=PDLr|deIC19CCde(qr9C BACKUP #=PDde),kT( CDfw"vTB SET od: SET CURRENT PACKAGE PATH = PROD, BACKUP; g{h*V4*Lr|DH0f>,G4IT9C DROP PACKAGE od4>}C& CLrDzzf>,b+(0 k#irI4PD~)#Zbo,IT9CfYw53=(;,xPyd/D&CL r76}Y(Lr|f>.dDnpvvGCZ4(Lr|D BIND !nPy;, (4,I4PD~zk;Pnp)# &CLr49C SET CURRENT PACKAGESET od4!q|yhD#=#xG,| Jm DB2 (}Z CURRENT PACKAGE PATH (CDfwPP>D#=PiRLr |4xP!q# ":DB2 z/OS f$`k}LZ DBRM Pf";BTjG(IT9C LEVEL !n4 hCKjG),ZLr|bvZd,+xPliT7#LrPD;BTjGkLr| %d#,y,DB2 Database for Linux, UNIX, and Windowss(}LZs(D~Pf" 1dAG#DB2 Database for Linux, UNIX, and Windows9'V LEVEL !n# Z;,#=P4(`vLr|f>Dm;-rG,9;,D BIND !nz'#}g,I T+;,D^({CZLr|PD4^({F}C# 134 *"6k= SQL &CLr `4&CLr1,(#9C4^(Dm{#byM'V`v_P`,Dm{Ma9D m,+;,D^({ITT;,D5}STxV#}g,zITZbT53Mzz5 3P4(`,DTs,+b)TsD^({Py;,(}g PROD M TEST)#m;v >}G,&CLr+}]V<=;, DB2 53OD;,mP,"R?vmD^({% ; ` , ( } g EAST" WEST" NORTH M SOUTH; COMPANYA M COMPANYB;Y1999"Y2000 M Y2001)#TZ DB2 z/OS f,k9C BIND |n D QUALIFIER !n48(m^({#9C QUALIFIER !n1,C';X,$`vL r"C?vLr8(CJ4^(DmyhDj<{F#xG,(}S&CLrP"v SET CURRENT PACKAGESET od"8(%;#={,ITZKP1CJ}7DLr |#+G,g{9C SET CURRENT PACKAGESET,G4Th#t"^D`v&CL r:?v&CLr<(}T:D SET CURRENT PACKAGESET od4CJyhDL r|#g{D*"v SET CURRENT PACKAGE PATH od,G4ITP>yP#=# Z4P1,DB2 IT!q}7DLr|# ":DB2 Database for Linux, UNIX, and Windows9'V QUALIFIER s(!n#+ G,QUALIFIER s(!n;0lG)9CK BIND |nD DYNAMICRULES !nD 2, SQL rLr|# $`kwzID1dAG ZtCs(DivB$`k&CLr1,yzIDLr|MQ^D4D~+_P%d D1dAG#b)1dAG;%@XF*;BTjG# g{fZ`vf>DLr|((}9C PRECOMPILE VERSION !n5V),G4?vf >*“”(UV{.),G4+5XKms# v SQL0805N(R;=Lr|)#ZyPd{ivB,5XKms# kG!,+&CLrk}]bs(1,}G9C PREP |nD PACKAGE USING N}2G 1!5,qr+Q&CLr{D0 8 vV{CwLr|{#"R,}G PREP |nD VERSION N}8(Kf>j6,G4f>j6+G“”(UV{.)#bb6E,g{Z ;|Df>j6DivB9C,;{F4$`kMs(=vLr,G4Z~vLr| +f;Z;vLrDLr|#KPZ;vLr1,z+SU=1dAGmsr“R;= Lr|”ms,bGr*,-}^DD4D~D1dAG;Yk}]bPLr|D1d AG%d#“R;=Lr|”ms2I\GIZ9CK ACTION REPLACE REPLVER $`k rs(!nyB,gTB>}y>: 1. Z8( VERSION VER1 DivB,$`k"s(Lr| SCHEMA1.PKG#;s,zI` X*D&CLr A1# 2. Z8( VERSION VER2 ACTION REPLACE REPLVER VER1 DivB,$`k"s(L r| SCHEMA1.PKG#;s,zI`X*D&CLr A2# Z~N$`kMs(+zI VERSION * VER2 DLr| SCHEMA1.PKG,8( ACTION REPLACE REPLVER VER1 +}% VERSION * VER1 DLr| SCHEMA1.PKG# "TKPZ;v&CLr+}P,+vV`FD"4: 1. Z8( VERSION VER1 DivB,$`k"s(Lr| SCHEMA1.PKG#;s,zI` X*D&CLr A1 2. Z8( VERSION VER2 DivB,$`k"s(Lr| SCHEMA1.PKG#;s,zI` X*D&CLr A2 VZ,IT,1KP&CLr A1 M A2,b=v&CLr+SLr| SCHEMA1.PKG Df> VER1 M VER2 P4P#}g,g{9C SQL od DROP PACKAGE SCHEMA1.PKG VERSION VER1 +Z;vLr|>},G4"TKP&CLr A1 +'\""z“R;=Lr|”ms# g{$`k4D~+44(Lr|,G4zIDs(D~MQ^D4D~+_P%d D1dAG#*KKPC&CLr,+Z;v%@D BIND =hPs(Cs(D~T4 (Lr|,"R+`k"4S-}^DD4D~#TZh*`v4#iD&CLrx T,Xk*?vs(D~4Ps(}L# ZKSYs(=8P,IZs(D~|,D1dAGk$`kZdZ-}^DD4D ~Pf"D1dAG`,,rK&CLr1dAGkLr|1dAG%d# $`k6k= SQL &CLr1zIDmsM/f $`k1"zD6k= SQL msI6k= SQL $`kwlb#6k= SQL $`k w\;lbo(ms,}g SQL od1YVET0|,4ywDwd?#TZ?vm s,<+zI`&Dms{"# `kM4S|,6k= SQL D4D~ XZKNq T6k= SQL 4D~xP$`k1,PRECOMPILE |n+zI-}^DD4D~,CD ~_PJCZ`LoTDD~)9{# k9CJ1DwoT`kw4`k-}^DD4D~T0NNd{4|, SQL odD 4D~#oT`kw+?v-}^DD4D~*;*Ts#i# kNDYw=(D`LD5,TKbPX1!`kw!nDNN}biv#kND` kwDD5,Tq!IC`kw!nDj{hv# woT4SLr+4(I4PD&CLr#}g: v Z Windows Yw53O,&CLrITGI4PD~r/,4Sb(DLL)# v ZyZ UNIX M Linux DYw53O,&CLrITGI4PD0k#ir2mb# ":Z Windows Yw53O,d;&CLrITG DDL,+ DLL I&CLrx;G DB2 }]b\mw1S0k#Z Windows Yw53O,}]b\mw+6k= SQL f"}LMC'(eD/}w* DLL 0k# *4(I4PD~,k4STBTs: v IoT`kwy]-}^DD4D~Md{4|, SQL odDD~zIDC'Ts #i# v oT`kw=xa)DwoTb API# 136 *"6k= SQL &CLr v |,Yw73D`&}]b\mw API D}]b\mwb#kNDYw=(D`&` LD5,TKb}]b\mw API yhD}]b\mwbD_e{F# +6k= SQL Lr|k}]bs( “s(”G8y]s(D~4(Lr|"+df"=}]bD}L# &CLr"s(D~MLr|.dDX5 }]b&CLr9CLr|D3)-rk`k&CLrD-r`,:a_T\T0x P9u#(}T SQL odxP$`k,CodZ&CLr9(Zd(x;GZKP1) ;`k=Lr|P#?vod<;bv,Lr|Pf"DGbM'J|_DYw}V {.#ZKP1,$`kwzIDzk+wCKP1~q}]b\mw API "a)dk rdv}]yhDNNd?E",Lr|Pf"DE"+;4P# $`kDEcvJCZ2, SQL od#;aT9C PREPARE M EXECUTE r_ EXECUTE IMMEDIATE T/,==4PD SQL odxP$`k;rK,ZKP1, XkT|G4P{W&m=h# hz DB2 s(D~hv(db2bfd)5CLr,IT=cXT>s(D~DZ],Tc liMi$dPD SQL od#mb,9IT9C DB2 s(D~hv(db2bfd)5C Lr4T>CZ4(s(D~D$`k!n#bTZ7(k&CLrDs(D~`X DJbxTG#PC# I+ BIND |nD GENERIC N}OD STATICASDYNAMIC V{.hC*“yes”,T8 > DB2 }]b\mw+yPodf"Z?"CJLr|_Y:f)#Ks,s(D~PDodDP *Mg,z}Z9C/, SQL ;y#}g,wZ+kT}]b(eoT''"Xb( CDfw|BH~=XXB`k#DB2 }]b\mwa)K&\G*K=cSd{}] b53(F6kD SQL C &CLr# DYNAMICRULES s(!nT/, SQL D0l PRECOMPILE |nM BIND |nN} DYNAMICRULES I7(ZKP1T/, SQL &CD fr# HdG,DYNAMICRULES N}I7(ZKP1TTB/, SQL tT&CD5: v Z(liZd9CDZ(j6# v CZT4^(DTsxP^(D^({# v L r | G q I CZT / , = = < 8 B P o d : GRANT"REVOKE"ALTER"CREATE"DROP"COMMENT ON"RENAME"SET INTEGRITY M SET EVENT MONITOR STATE od# } DYNAMICRULES 5Tb,Lr|DKP173XF/, SQL odZKP1DP*# =VI\DKP173G: v Lr|w*@"LrDiI?VKP v Lr|Z}LOBDPKP Z 4 B 9( 137 DYNAMICRULES 5kKP1732,7(/, SQL tTD5#CitT5;F*/, SQL odP*#DVP*gBy>: KPP* DB2 Database for Linux, UNIX, and Windows 9C4PLr|DC'DZ( j6(nu,S= DB2 }]bDj6)w*CZT/, SQL od4PZ(l iD5,"+Cj6CwT/, SQL odPD4^(Ts}CxP~=^(D u<5# s(P* ZKP1,DB2 Database for Linux, UNIX, and Windows +9CyPJCZ 2, SQL Dfr4xPZ(M^(#4,9CLr|yP_DZ(j6w*C ZT/, SQL od4PZ(liD5,"+Cj6CwT/, SQL odPD 4^(Ts}CxP~=^(DLr|1!^({# (eP* v1/, SQL od|,Z*Z}LOBDPKPDLr|P,"RzQ9C DYNAMICRULES DEFINEBIND r DYNAMICRULES DEFINERUN TCLr|xPs( 1,(eP*EJC#DB2 Database for Linux, UNIX, and Windows 9C} L(e_(x;G}LDLr|s(_)DZ(j6w*CZT/, SQL od 4PZ(liD5,"9CCj6TC}LPD/, SQL odPD4^(Ts }CxP~=^(# wCP* v1/, SQL od|,Z*Z}LOBDPKPDLr|P,"RzQ9C DYNAMICRULES INVOKEBIND r DYNAMICRULES INVOKERUN TCLr|xPs( 1,wCP*EJC#DB2 Database for Linux, UNIX, and Windows 9Cw C}L1z'PD10odZ(j6w*CZT/, SQL 4PZ(liD5, "9CCj6TC}LPD/, SQL odPD4^(Ts}CxP~=^(# BmTKwK**: wC73 9CDj6 NN2, SQL SQL wCC}LD OWNER yZLr|D~=r T=yP_5# ZS5V?V/, SQL P*D DYNAMICRULES 5kKP173iO# m 18. DYNAMICRULES MKP173gN7(/, SQL odP* DYNAMICRULES 5 @"Lr73P/, SQL odDP* }L73P/, SQL odDP* BIND s(P* s(P* RUN KPP* KPP* DEFINEBIND s(P* (eP* DEFINERUN KPP* (eP* INVOKEBIND s(P* wCP* 138 *"6k= SQL &CLr m 18. DYNAMICRULES MKP173gN7(/, SQL odP* (x) DYNAMICRULES 5 @"Lr73P/, SQL odDP* }L73P/, SQL odDP* INVOKERUN KPP* wCP* BmP>?V/, SQL P*D/, SQL tT5# m 19. /, SQL odP*D(e /, SQL tT /, SQL tTDh C:s(P* /, SQL tTDh C:KPP* /, SQL tTDh C:(eP* /, SQL tTDhC:w CP* Z(j6 BIND OWNER |nN} D~=rT=5 4PLr|DC'D j6 }L(e_(x;G} LDLr|yP_) wC}L1D10odZ( j6# 4^(DTsD1 !^({ BIND QUALIFIER |n N}D~=rT=5 CURRENT SCHEMA (CDfw }L(e_(x;G} LDLr|yP_) wC}L1D10odZ( j6# I T 4 P GRANT"REVOKE"ALTER"CREATE"DROP"COMMENT ON"RENAME"SET INTEGRITY M SET EVENT MONITOR STATE q G qq 9C(CDfw4XFod`k73 TZT/,==<8DodxT,od`k73I`v(CDfwD57(: v CURRENT QUERY OPTIMIZATION (CDfw7(y9CDE/`# v CURRENT PATH (CDfw7(CZxP UDF M UDT bvD/}76# v CURRENT EXPLAIN SNAPSHOT Dfw7(Gq6q5wlUE"# v CURRENT EXPLAIN MODE Dfw7(Gq*NNOqD/, SQL od6q5w mE"#b)(CDfwD1!5kCZ`Xs(!nD1!5`,# 9C BIND |nMVPs(D~4XB4(Lr| “s(”G84(}]b\mwZ&CLr4P1CJ}]byhDLr|D}L#1 !ivB,PRECOMPILE |n+4(;vLr|#}G8( BINDFILE |nN},qrs (+Z$`k1T~===xP#PACKAGE |nN}Jmz*$`k14(DLr|8 (Lr|{# BfG;vdMD BIND |nC(>}#*+{* filename.bnd Ds(D~k}]b s(,IT"vTB|n: BIND filename.bnd TZ?v%@xP$`kD4zk#i,<+4(;vLr|#g{&CLrP 5 v4 D~,dP 3 vh*xP$`k,G4+4( 3 vLr|rs(D~#1!ivB, *?vLr|8(D{Fk .bnd D~yyZD4#iD{F`,,+K{F+;XO * 8 vV{#*TT===8(m;vLr|{,XkZ PREP |nP9C PACKAGE USING N}#Lr|Df>I VERSION $`kN}x(,"R1!*UV{.#g{b vB4(DLr|D{FM#=k?j}]bP10fZD3vLr|`,,+f> j6Py;,,G4+4(BLr|"#tH0DLr|#+G,g{fZkys( Z 4 B 9( 139 Lr|D{F"#=Mf>%dDLr|,G4CLr|+;>}"f;*}Zs( DBLr|#g{s(18(K ACTION ADD,G4+;Jm"zbViv,xG5Xm s(SQL0719)# 9C REBIND |n4XBs(VPLr| XBs(G8*H0s(D&CLrXB4(Lr|D}L#g{Lr|Q;jG* ^'r;IC,r_ONs(s}]b3FE"Q|D,G4XkXBs(Lr|# +G,Z3)ivB,zI\kXBs(P'DLr|#}g,zI\k{CB4( Dw},r_Z4P RUNSTATS |ns9C-}|BD3FE"# Lr|IT@5Z3)`MD}]bTs,}gm"S<"p{"w}"%"w"} C},G4CLr|+;CZ“^'”4,#g{;>}DTsG UDF,G4CLr|+;CZ;IC4,# Lr|;jG*;IC1,1,?N;\T;vf>xPXBs(# Z IBM Data Studio V3.1 r|_f>P,IT9CTB$_DNqzV:XBs(L r|. NqzVIT8}y>: v QUERYOPT s(N}Zs(1{CX(DE/`# v EXPLSNAP s(N}Z5wmPf"Oq SQL odD5wlUE"# 140 *"6k= SQL &CLr v FUNCPATH s(N}}7Xbv2, SQL PC'(eD%5`MMC'(eD/}# g{s(}Lt/+;1;5X,G4I\mwd{,S=}]bD&CLrQRp zyhDx(#ZKivB,k7#;PNN&CLr,S=}]b#g{PNN& CLr,S=}]b,kO*~qwOyP&CLrD,S,s(}L+LxxP# g{&CLr+9C DB2 Connect 4CJ~qw,G4zIT9CICZC~qwD BIND|nN}# s(D~";kOMf>D DB2 Database for Linux, UNIX, and Windows f]#Zl O6p73P,DB2 Database for Linux, UNIX, and Windows ;\9CICZnM6 p}]b73D&\#}g,g{f> 8 M'z,S=f> 7.2 ~qw,G4CM' z+;\9Cf> 7.2 D&\#1s(D~mo}]bD&\1,|GhqXlO6p ^F# g{h*ZOM6pD53OXBs(O_6pDs(D~,G4zIT4PBPY w: v 9COM6p IBM }]~qwM'z ,S=O_6p~qw,;s4(IT;;6 "kOM6p DB2 Database for Linux, UNIX, and Windows 73s(Ds(D~# v ZOM6pDzz73P,9CO_6p IBM }]~qwM'z 4s(ZbT73 P4(DO_6ps(D~#O_6pM'z+;+]JCZOM6p~qwD! n# Vi"bBn g{*T6k= SQL &CLrXUVi&\,+^(qC4zk,G4Xk(}9C BIND |n"hC BLOCKING NO Sd4XBs(C&CLr# Xk(}9C BIND |n"hC BLOCKING ALL r BLOCKING UNAMBIGUOUS SdTks xPVi4XBs(VPD6k= SQL &CLr(g{P4TK==xPs()#S ~qwlwPi.s,6k=&CLr+T?N;PD==S~qwlw LOB 5# SYs(DEc ZtCs(DivBxP$`k;Jm&CLrCJ$`k}LP9CD}]b#+ G,ZSYs(DivBxP$`k+Jm&CLrCJm`}]b,bGr*,z ITkT?v}]bTs(D~xPs(#bV&CLr*"=(Z>JO|*i n,4,z;hT&CLrxP;N$`k,+ITf1+dk}]bs(# Z4PZd9C BIND API Jm&CLrs(dTm,KYwITZ20}LPxP, 2ITZ4P`X*D#i.0xP#}g,3v&CLrIT4P`nNq,"R ;PdP;nNq*s9C SQL od#zIT+K&CLrhFI,v1K&CLr wCh* SQL odDNq1,"Rv1`X*DLr|P4fZ1,E+dTmk} ]bs(, SYs(=(Dm;vEcG,|JmzZ;XrnUC'a)4zkDivB4( Lr|#zITf&CLr;p;6`X*Ds(D~# 9C BIND |nD REOPT !n1DT\Dx s(!n REOPT \;Txa_6k= SQL &CLrDT\# Z 4 B 9( 141 REOPT T2, SQL D0l s(!n REOPT \;9|,wd?"+Vd?r(CDfwD2, SQL odqT]v ==s(Dod;y$w#bb6E,Z4P EXECUTE r OPEN 1(x;GZs( 1)`kb)od#ZK`kZd,+y]b)d?D5J54!qCJ=8# g{8( REOPT ONCE,G4ZZ;v OPEN r EXECUTE ks.s+Tf!=8x P_Y:f,Cf!=8+CZKodDsx4P#g{8( REOPT ALWAYS,G4?v OPEN M EXECUTE ks<+XBzIf!=8,"R+9Cwd?"N}jG"+ Vd?M(CDfw5D10/O44(K=8# REOPT T/, SQL D0l g{8(!n REOPT ALWAYS,G4}]b\mw+NN|,wd?"N}jG"+Vd ?r(CDfwDodD<8$wFY=|v= OPEN r EXECUTE od1xP;4, Zb)d?D5d*Q*1xP#K1,+9Cb)54zICJ=8#T,;od "vDsx OPEN r EXECUTE ks+XB`kCod"9Cd?5D10/O4X BE/i/=8T04PBzIDi/=8#8( REOPT ALWAYS 1,od/Pw&Z {C4,# !n REOPT ONCE _P`FD'{,+;,.&ZZ,;9Cwd?"N}jG"+V d?M(CDfwD5T=8xP;NE/#K=8+xP_Y:f"Isxks9 C# s(&CLrM5CLr(DB2 Connect ~qw) Xk+9C6k= SQL *"D&CLrk|G+*&mD}]bxPs(#PX IBM }]~qwLr|s(*sDE",kNDPX DB2 CLI s(D~MLr|{FDw b# ?v&CLr&CT?v}]b4P;Ns(#Zs(}LP,*+*4PD?v SQL od>}Y(: v yPM'z<&Z,;~q6p#g{|G;&Z,;6p,G4I\h*S?v X(~q6pDM'z4xPs(# v ~qwkM'z&Z,;~q6p#g{|G;&Z,;6p,G42h*S~q wxPs(# }K DB2 Connect 5CLr.b,d{NN9C6k= SQL D&CLr9Xkk| Gk9CD?v}]bxPs(#14P4s(D&CLr1,(#<+zzms{ " SQL0805N#zI\k*h*s(DyP&CLr4(;v=SDs(PmD~# TZ?v*s(AD IBM sMz}]b~qw,k4PBP=h: 1. 7#zT IBM sMz}]b~qw\m53_Pc;D(^: System z h*D(^G: v SYSADM r v SYSCTRL r v BINDADD M CREATE IN COLLECTION NULLID ":v1m~|P4fZ1,BINDADD M CREATE IN COLLECTION NULLID X(E\a)c;D(^#}g,z}ZWN4(m~|D1r# g{m~|Q-fZ"Rz}ZYNs(|G,G4jICNqyh*D (^!vZG-4PKnuDs(# A) g{nuGzT:4PKs(,xz}ZYN4Ps(,G4;*z_P H0yP>DNN(^,M+JmzjIs(# B) g{d{K4PKnuDs(,xz}Z4PZ~Ns(,G4z+Xk _P SYSADM r SYSCTRL (^E\jIs(#g{z;_P BINDADD M CREATE IN COLLECTION NULLID (^,G4+;JmzjIs(# g{z;P SYSADM r SYSCTRL X(,T;IT4(m~|#ZKi vB,z+h*Tkf;D?vVPm~|<_P BIND X(# VSE r VM h*D(^G DBA (^#g{kZs((bind)|nP9C GRANT !n (T\b*?v DB2 Connect m~|%@ZhCJ(),G4 NULLID C 'j6XkP(*d{C'ZhTBPmD(^: v system.syscatalog v system.syscolumns v system.sysindexes v system.systabauth v system.syskeycols Z 4 B 9( 143 v system.syssynonyms v system.syskeys v system.syscolauth v system.sysuserauth Z VSE r VM 53O,zIT"v: grant select on table to nullid with grant option IBM Power Systems T NULLID /OD *CHANGE (^r|_(^# 2. k"v`FTB|nD|n: db2 connect to DBALIAS user USERID using PASSWORD db2 bind path@ddcsmvs.lst blocking all sqlerror continue messages ddcsmvs.msg grant public db2 connect reset dP DBALIAS"USERID M PASSWORD JCZ IBM sMz}]b~qw, ddcsmvs.lst G z/OS Ds(PmD~,x path m>Cs(PmD~D;C# }g,drive:\sqllib\bnd\ JCZyP Windows Yw53,INSTHOME/sqllib/ bnd/ JCZyP Linux M UNIX Yw53,dP drive m>20 DB2 Connect D _-}/w,INSTHOME m> DB2 Connect 5}Dw?<# IT9C bind |nD grant !n4T PUBLIC r8(DC'{rij6Zh EXECUTE X(#g{;9C bind |nD grant !n,G4Xkpv4P GRANT EXECUTE (RUN)# *Kbs(D~Dm~|{F,dkBP|n: ddcspkgn @bindfile.lst }g: ddcspkgn @ddcsmvs.lst I\zzBPdv: s(D~ m~|{F ------------------------------ ------------------------------ f:\sqllib\bnd\db2ajgrt.bnd SQLAB6D3 *7( DB2 Connect Db)5,4P ddcspkgn 5CLr,}g: ddcspkgn @ddcsmvs.lst mb,K5CLrIC47(wvs(D~Dm~|{F,}g: ddcspkgn bindfile.bnd ": a. h*9Cs(!n sqlerror continue;;x,19C DB2 $_r|nP&m w(CLP)4s(&CLr1+T/*z8(K!n#8(KK!n,+Qs( ms*;*/f,rK,s(;v|,msDD~1T;IT4(m~|#, y,bJmT`v~qw9C;vs(D~,49X(D~qw5VI\+m ;v5VD SQL o(j>*^'#rK,TNNX(D IBM sMz}]b~ qws(NNPmD~ ddcsxxx.lst <&zI;)/f# 144 *"6k= SQL &CLr b. g{z}Z(} DB2 Connect ,SA DB2}]b,G49Cs(Pm db2ubind.lst "R;8( sqlerror continue(|vZ,SA IBM sMz}] b~qw1EP')#mb,*,SA DB2}]b,(iz9C DB2(x;G DB2 Connect)a)D DB2M'z# 3. 9C`FDod4s(?v&CLrr&CLrPm# 4. g{z_P DB2 0"PfD6LM'z,G4I\h*+b)M'zOD5CLr k DB2 Connect xPs(# Lr|Df"k,$ z(}T&CLrxP$`k/s(44(Lr|#Lr||,-}E/DCJ=8, K=8CZ`S&CLrPyP SQL odD4Piv#}VCZ&mLr|DX(G CONTROL"EXECUTE M BIND X(,|GCZTIS\DCJ(6pxP}K#(}Z` k18( VERSION !n,IT4(,;vLr|D`vf>#K!noz\b1dAG ;%dms,"Jm,1KP&CLrD`vf># Lr|f>XF g{h*4(&CLrD`vf>,G4IT9C PRECOMPILE |nPD VERSION N }#K!nJm`v_P`,Lr|{(4,Lr|{M4(_{)Df>2f# }g,Y(P;vS foo1.sqc `kDF* foo1 D&CLr#z+$`kLr| foo1 "+dk}]bs(,;s+C&CLr;6xC'#;s,C'ITKPC&CL r#*TC&CLrxPsx|D,z+|B foo1.sqc,;sX4XB`k"s(T0 +C&CLr"MxC'b;}L#g{ZZ;NrZ~N$`k foo1.sqc 1;P8 ( VERSION N},G4Z;vLr|+;Z~vLr|f;#NN"TKPIf>&C LrDC'<+SU= SQLCODE -818,bm>"z1dAG;%dms# *K\b"z1dAG;%dms,"R*KJmb=vf>D&CLr,1KP, k9CLr|f>XF&\#}g,Z9( foo1 DZ;vf>1,k9C VERSION N }TdxP$`k,gBy>: DB2 PREP FOO1.SQC VERSION V1.1 VZ,ITKPKLrDZ;vf>#Z9( foo1 DBf>1,k9CTB|nTd xP$`k: DB2 PREP FOO1.SQC VERSION V1.2 VZ,bvBf>D&CLr2\;KP,49Z;v&CLrD5}TZ4P`g K#IZZ;vLr|DLr|f>G V1.1,"RZ~vLr|DLr|f>G V1.2, rK;a"z|{e;:=vLr|<+fZZ}]bP,"Rb=vf>D&CL rLr|D==# Lr|X(;_Pf>6D#H#4,Lr|X(DZh(GRANT)r7z (REVOKE)+&CZyP_P`,{FM4(_DLr|f>#rK,Z4(f> V1.1 .s,g{+Lr| foo1 DLr|X(Zh3vC'ri,G4V"f> V1.2 1,CC'ri+Tf> V1.2 _P`,DX(#bVP*(#GXhD,bGr*, `,DC'Mi(#T;vLr|DyPf>5P`,DX(#g{z;k+`,D Z 4 B 9( 145 Lr|X(&CZ&CLrDyPf>,G4;&9C PRECOMPILE VERSION N}4j ILr|f>XF#xG,&C9C;,DLr|{(+-}|BD4D~X|{, r_9C PACKAGE USING N}TT===+Lr|X|{)# T4^(Dm{xPbv IT9CBPdP;V=(4&m&CLrP4^(Dm{: v hzZBP|n,(}9C;,DZ(j6,?vC'}P,database-name G}]bD{F,C'{ GC'D{F,D~{ G+ *s(D&CLrD{F#"b,C'{ k #={ (#_P`,D5#;s,9C SET CURRENT PACKAGESET od48(*9CDLr|,Sx8(*9CD^( {#g{48( COLLECTION,G41!^({Gs(Lr|19CDZ(j6#g{ 8( COLLECTION,G48(D schema_name G+*CZ4^(TsD^({# v 4(+Cp{T8rh*Dm# v *?vC'4(km,{DS<,Tc}7Xbv4^(Dm{# v *?vC'4(;vp{T8rh*Dm# 9Cy>9(E>49(6k= SQL &CLr Z UNIX M Linux O,CZ]>9(y>LrDD~;F*E>D~,Z Windows O,|G;F*z&mD~#(#,RG+dF*9(D~#|G|,CZ\'VD =(`kwD(i`kM4S|n# 9(D~I DB2 a),CZk\'V=(`XDwoT#9(D~|,ZCoTDy >yZD?CZ9(;,`MDLrD;,9(D~`M#}GmP 8>,qrb)9(D~CZyP\'V=(OD\'VoT#Z Windows O,9( D~D)9{* .bat(z&m),Bm4P>K)9{#Z UNIX =(O,;P)9 {# m 20. DB2 9(D~ 9(D~ y9(DLrD`M bldapp &CLr bldrtn }L(f"}LM UDF) bldmc C/C++ `,S&CLr bldmt C/C++ `_L&CLr bldcli sqlpl samples S?

E>+9( 64 ; I4PD~# Bm4=(M`LoT4P>9(D~T0|GyZD?<#Z*zD5P,9(D ~{TH4S==4S= HTML 4D~#C'9ITZ`&D samples ?D~# 146 *"6k= SQL &CLr m 21. 9(D~(4oTM=(EP) =( *> oT AIX HP-UX Linux Solaris Windows C samples/c bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp.bat bldrtn.bat bldmt.bat bldmc.bat C++ samples/cpp bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp bldrtn bldmt bldmc bldapp.bat bldrtn.bat bldmt.bat bldmc.bat IBM COBOL samples/cobol bldapp bldrtn ;JC ;JC ;JC bldapp.bat bldrtn.bat Micro Focus COBOL samples/cobol_mf bldapp bldrtn bldapp bldrtn bldapp bldrtn bldapp bldrtn bldapp.bat bldrtn.bat ZD5P,9C9(D~49(&CLrM}L,bGr*,|GG#ezX]>K DB2 (i\'V`kw9CD`kM4S!n#(#,9Pd{m`ICD`kM4S !n,"RC'ITTIXTiG)!n#kND`kwD5,TKbya)DyP `kM4S!n#}9(y>LrTb,*"_9IT9C9(D~49({GT: DLr#y>LrITCwIIC'^DD#e,Tcoz{G*"&CLr# (}9C9(D~,zIT=cX9(_P`kwyJmDNND~{D4D~#b kZD~P2`kLr{D Makefile ;,#Makefile (}CJ9(D~4`kM4S |Gy9lDLr#9(D~9C $1 d?(TZ UNIX M Linux)M %1 d?(TZ Windows Yw53)TZ?==f;Lr{#(}9b)d?{D}?;O]v,IT f;d{I\h*DTd?# IZ?v9(D~}H0DTsD~MI4PD~r_^D4zk# 9(D~|,y>}]bD1!hC#g{C'}ZCJm;v}]b,G4{G; ha)m;vN}4I2G1!5#g{{GmPD sample# TZ6k= SQL LrxT,}KZ Windows O9C IBM COBOL $`kwDiv Tb,9(D~+wCm;vD~ embprep,CD~|,CZ6k= SQL LrD$` kMs(=h#b)=hI\h*PXC'j6M\kDI!N},b!vZ6k= SQL LrD9(;C# Z 4 B 9( 147 ns,*"_IT*K$w=cx^D9(D~#}KZ9(D~P|D}]b{ (TOhvD=()Tb,*"_9IT=cXZKD~P2`kd{N}"|D` kM4S!nr_|D1!D DB2 5}76#9(D~Dr%"1SM_eTJ9z \;=cXTdxP(FTzczDh*# msli5CLr DB2 M'za)K`v5CLrD~#b)D~a)KCZ4PmsliMr!msE "D&\#TZ?;VoT,: m 22. msli5CLrD~(4oTEP) oT G6k= SQL 4 D~ G6k= SQL 7 D~ 6k= SQL 4D ~ 6k= SQL 7D ~ C samples/c utilapi.c utilapi.h utilemb.sqc utilemb.h C++ samples/cpp utilapi.C utilapi.h utilemb.sqC utilemb.h IBM COBOL samples/cobol checkerr.cbl ;JC ;JC ;JC Micro Focus COBOL samples/cobol_mf checkerr.cbl ;JC ;JC ;JC *K9C5CLr/},XkH`k5CLrD~,;sZ4(?j53DI4PD ~Zd4SdTsD~#samples ?}]>gNZ DB2 LrP9Cmsli5CLr#utilemb.h 7D~*/} SqlInfoPrint() M TransRollback() (eK EMB_SQL_CHECK j: /* CZ4P6k= SQL liDj */ #define EMB_SQL_CHECK(MSG_STR) \ SqlInfoPrint(MSG_STR, &sqlca, __LINE__, __FILE__); \ if (sqlca.sqlcode < 0) \ {\ TransRollback(); \ return 1; \ } SqlInfoPrint() li SQLCODE "r!NNkyv=DX(ms`XDE"#|98 r4zkP"zmsD;C#TransRollback() Jm5CLrD~2+XXv"zms 148 *"6k= SQL &CLr DBq#|9C6k= SQL od EXEC SQL ROLLBACK#TB>}5w C Lr dbuse gN(}9Cj"* SqlInfoPrint() /}D MSG_STR N}a)5 "Delete with host variables -- Execute" 4wC5CLr/}: EXEC SQL DELETE FROM org WHERE deptnumb = :hostVar1 AND division = :hostVar2; EMB_SQL_CHECK("Delete with host variables -- Execute"); EMB_SQL_CHECK j7#Z DELETE od'\12+XXvBq"r!J1Dms{"# (i*"_Z4(T:D DB2 Lr19C")9b)msli5CLr# 9(9C C M C++ `4D&CLrM}L z7=xa)KCZwVYw53=(D9(E>#(}9Cb)D~,IT9(9 C C M C++ `4D6k= SQL &CLr#}CZ9(&CLrD9(E>Tb,9 a)KCZ9(}L(f"}LMC'(eD/})DX( bldrtn E>#TZ9C VisualAge® `4D&CLrM}LxT,9CdCD~49(&CLr#fLLT0M 'z6r5}6>};,,a)D C &CLry>2Py;,,zITZ sqllib/ samples/c ?<(TZ UNIX)M sqllib\samples\c ?<(TZ Windows)PR=b )y># C M C++ D`kM4S!n AIX C 6k= SQL M DB2 API &CLrD`kM4S!n: 9C AIX IBM C `kw49( C 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: xlc IBM XL C/C++ `kw# $EXTRA_CFLAG TZQtC 64 ;'VD5},K!n|,“-q64”;qr,|;|,NN5# -I$DB2PATH/include 8( DB2 |,D~D;C#}g:$HOME/sqllib/include# -c ;4P`k;;xP4S#`kM4SG;,D=h# 4S!n: xlc 9C`kww*4SLrD0K# $EXTRA_CFLAG TZQtC 64 ;'VD5},K!n|,“-q64”;qr,|;|,NN5# -o $1 8(I4PLr# $1.o 8(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# Z 4 B 9( 149 utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# -ldb2 k DB2 b4S# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#}g:$HOME/sqllib/$LIB#g{48( -L ! n,G4`kw+ICTB76:/usr/lib:/lib# kND`kwD5,TKbd{`kw!n# AIX C++ 6k= SQL M DB2 \m API &CLrD`kM4S!n: 9C AIX IBM XL C/C++ `kw49( C++ 6k= SQL M DB2 \m API &CL r1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: xlC IBM XL C/C++ `kw# EXTRA_CFLAG TZQtC 64 ;'VD5},K!n|,“-q64”;qr,|;|,NN5# -I$DB2PATH/include 8( DB2 |,D~D;C#}g:$HOME/sqllib/include# -c ;4P`k;;xP4S#`kM4SG;,D=h# 4S!n: xlC 9C`kww*4SLrD0K# EXTRA_CFLAG TZQtC 64 ;'VD5},K!n|,“-q64”;qr,|;|,NN5# -o $1 8(I4PLr# $1.o 8(LrTsD~# utilapi.o |(CZG6k= SQL LrD API 5CLrTsD~# utilemb.o |(CZ6k= SQL LrD6k= SQL 5CLrTsD~# -ldb2 k DB2 b4S# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#}g:$HOME/sqllib/$LIB#g{48( -L ! n,G4`kw+ICTB76:/usr/lib:/lib# kND`kwD5,TKbd{`kw!n# HP-UX C &CLrD`kM4S!n: 9C HP-UX C `kw49( C 6k= SQL M DB2 API &CLr1,9C DB2 P a)D`kM4S!n,g bldapp 9(E>Py># 150 *"6k= SQL &CLr bldapp D`kM4S!n `k!n: cc C `kw# $EXTRA_CFLAG g{ HP-UX =(* IA64 "RtCK 64 ;'V,G4Kj>|,5 +DD64; g{tCK 32 ;'V,G4Kj>|,5 +DD32# +DD64 Xk9CK!nE\* IA64 OD HP-UX zI 64 ;zk# +DD32 Xk9CK!nE\* IA64 OD HP-UX zI 32 ;zk# -Ae tC HP ANSI )9==# -I$DB2PATH/include 8( DB2 |,D~D;C# -c ;4P`k;;xP4S#`kM4SG;,D=h# 4S!n: cc 9C`kww*4SLrD0K# $EXTRA_CFLAG g{ HP-UX =(* IA64 "RtCK 64 ;'V,G4Kj>|,5 +DD64; g{tCK 32 ;'V,G4Kj>|,5 +DD32# +DD64 Xk9CK!nE\* IA64 OD HP-UX zI 64 ;zk# +DD32 Xk9CK!nE\* IA64 OD HP-UX zI 32 ;zk# -o $1 8(I4PD~# $1.o 8(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# $EXTRA_LFLAG 8(KP176#g{hCKK!n,G4TZ 32 ;,||,5 -Wl,+b$HOME/ sqllib/lib32,TZ 64 ;,||,5 -Wl,+b$HOME/sqllib/lib64#g{4h CK!n,G4|;|,NN5# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#TZ 32 ;:$HOME/sqllib/lib32;TZ 64 ;:$HOME/sqllib/lib64# -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# HP-UX C++ &CLrD`kM4S!n: Z 4 B 9( 151 9C HP-UX C++ `kw49( C++ 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: aCC HP aC++ `kw# $EXTRA_CFLAG g{ HP-UX =(* IA64 "RtCK 64 ;'V,G4Kj>|,5 +DD64; g{tCK 32 ;'V,G4Kj>|,5 +DD32# +DD64 Xk9CK!nE\* IA64 OD HP-UX zI 64 ;zk# +DD32 Xk9CK!nE\* IA64 OD HP-UX zI 32 ;zk# -ext tCwV C++ )9,dP|(“long long”'V# -I$DB2PATH/include 8( DB2 |,D~D;C#}g:$HOME/sqllib/include# -c ;4P`k;;xP4S#`kM4SG;,D=h# 4S!n: aCC 9C HP aC++ `kww*4SLrD0K# $EXTRA_CFLAG g{ HP-UX =(* IA64 "RtCK 64 ;'V,G4Kj>|,5 +DD64; g{tCK 32 ;'V,G4Kj>|,5 +DD32# +DD64 Xk9CK!nE\* IA64 OD HP-UX zI 64 ;zk# +DD32 Xk9CK!nE\* IA64 OD HP-UX zI 32 ;zk# -o $1 8(I4PD~# $1.o 8(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# $EXTRA_LFLAG 8(KP176#g{hCKK!n,G4TZ 32 ;,||,5“-Wl,+b$HOME/ sqllib/lib32”,TZ 64 ;,||,5“-Wl,+b$HOME/sqllib/lib64”#g{4 hCK!n,G4|;|,NN5# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#TZ 32 ;:$HOME/sqllib/lib32;TZ 64 ;:$HOME/sqllib/lib64# -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# 152 *"6k= SQL &CLr Linux C &CLrD`kM4S!n: 9C Linux C `kw49( C 6k= SQL M DB2 API &CLr1,9C DB2 P a)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: $CC gcc r xlc_r `kw# $EXTRA_C_FLAGS |,BPdP;vj>: v -m31(v^Z Linux for zSeries®),CZ9( 32 ;b; v -m32(v^Z Linux for x86"x64 M POWER),CZ9( 32 ;b; v -m64(v^Z Linux for zSeries"POWER M x64),CZ9( 64 ;b; r_ v ;|,NN5(Linux for IA64),CZ9( 64 ;b# -I$DB2PATH/include 8( DB2 |,D~D;C# -c ;4P`k;;xP4S#KE>D~|,@"D`kM4S=h# 4S!n: $CC gcc r xlc_r `kw;9C`kww*4SLrD0K# $EXTRA_C_FLAGS |,BPdP;vj>: v -m31(v^Z Linux for zSeries),CZ9( 32 ;b; v -m32(v^Z Linux for x86"x64 M POWER),CZ9( 32 ;b; v -m64(v^Z Linux for zSeries"POWER M x64),CZ9( 64 ;b; r_ v ;|,NN5(Linux for IA64),CZ9( 64 ;b# -o $1 8(I4PD~# $1.o 8(TsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# $EXTRA_LFLAG TZ 32 ;,|,5“-Wl,-rpath,$DB2PATH/lib32”;TZ 64 ;,|,5“-Wl,- rpath,$DB2PATH/lib64”# -L$DB2PATH/$LIB 8( DB2 2,bM2mbZ4S1D;C#}g,TZ 32 ;:$HOME/sqllib/ lib32;TZ 64 ;:$HOME/sqllib/lib64# Z 4 B 9( 153 -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# Linux C++ &CLrD`kM4S!n: 9C Linux C++ `kw49( C++ 6k= SQL M DB2 API &CLr19CD` kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: g++ GNU/Linux C++ `kw# $EXTRA_C_FLAGS |,BPdP;vj>: v -m31(v^Z Linux for zSeries),CZ9( 32 ;b; v -m32(v^Z Linux for x86"x64 M POWER),CZ9( 32 ;b; v -m64(v^Z Linux for zSeries"POWER M x64),CZ9( 64 ;b; r_ v ;|,NN5(Linux for IA64),CZ9( 64 ;b# -I$DB2PATH/include 8( DB2 |,D~D;C# -c ;4P`k;;xP4S#KE>D~|,@"D`kM4S=h# 4S!n: g++ 9C`kww*4SLrD0K# $EXTRA_C_FLAGS |,BPdP;vj>: v -m31(v^Z Linux for zSeries),CZ9( 32 ;b; v -m32(v^Z Linux for x86"x64 M POWER),CZ9( 32 ;b; v -m64(v^Z Linux for zSeries"POWER M x64),CZ9( 64 ;b; r_ v ;|,NN5(Linux for IA64),CZ9( 64 ;b# -o $1 8(I4PD~# $1.o |(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# $EXTRA_LFLAG TZ 32 ;,|,5“-Wl,-rpath,$DB2PATH/lib32”;TZ 64 ;,|,5“-Wl,- rpath,$DB2PATH/lib64”# 154 *"6k= SQL &CLr -L$DB2PATH/$LIB 8( DB2 2,bM2mbZ4S1D;C#}g,TZ 32 ;:$HOME/sqllib/ lib32;TZ 64 ;:$HOME/sqllib/lib64# -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# Solaris C &CLrD`kM4S!n: TBGz9C Forte C `kw49( C 6k= SQL M DB2 API &CLr1,DB2 (iz9CD`kM4S!n(g bldapp 9(E>y>)# bldapp D`kM4S!n `k!n: cc C `kw# -xarch=$CFLAG_ARCH K!n7#k libdb2.so 4S1,`kwzIP'DI4PD~# $CFLAG_ARCH D5DhCgBy>: v “v8plusa”:Solaris SPARC OD 32 ;&CLr v “v9”:Solaris SPARC OD 64 ;&CLr v “sse2”:Solaris x64 OD 32 ;&CLr v “amd64”:Solaris x64 OD 64 ;&CLr -I$DB2PATH/include 8( DB2 |,D~D;C#}g:$HOME/sqllib/include# -c ;4P`k;;xP4S#KE>|,@"D`kM4S=h# 4S!n: cc 9C`kww*4SLrD0K# -xarch=$CFLAG_ARCH K!n7#k libdb2.so 4S1,`kwzIP'DI4PD~# $CFLAG_ARCH D5hC*“v8plusa”(m> 32 ;)r“v9”(m> 64 ;)# -mt Z'V`_LDivBxP4S#K!nCZk libdb2 4S# ":g{9C POSIX _L,G4 DB2 &CLr9Xk9C -lpthread xP 4S,x^[|GGq_L/&CLr# -o $1 8(I4PD~# $1.o |(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# Z 4 B 9( 155 -L$DB2PATH/$LIB 8( DB2 2,bM2mbZ4S1D;C#}g,TZ 32 ;:$HOME/sqllib/ lib32;TZ 64 ;:$HOME/sqllib/lib64# $EXTRA_LFLAG 8( DB2 2mbZKP1D;C#TZ 32 ;,|,5“-R$DB2PATH/ lib32”;TZ 64 ;,|,5“-R$DB2PATH/lib64”# -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# Solaris C++ &CLrD`kM4S!n: TBGz9C Forte C++ `kw49( C++ 6k= SQL M DB2 API &CLr1, DB2 (iz9CD`kM4S!n(g bldapp 9(E>y>)# bldapp D`kM4S!n `k!n: CC C++ `kw# -xarch=$CFLAG_ARCH K!n7#k libdb2.so 4S1,`kwzIP'DI4PD~# $CFLAG_ARCH D5DhCgBy>: v “v8plusa”:Solaris SPARC OD 32 ;&CLr v “v9”:Solaris SPARC OD 64 ;&CLr v “sse2”:Solaris x64 OD 32 ;&CLr v “amd64”:Solaris x64 OD 64 ;&CLr -I$DB2PATH/include 8( DB2 |,D~D;C#}g:$HOME/sqllib/include# -c ;4P`k;;xP4S#KE>|,@"D`kM4S=h# 4S!n: CC 9C`kww*4SLrD0K# -xarch=$CFLAG_ARCH K!n7#k libdb2.so 4S1,`kwzIP'DI4PD~# $CFLAG_ARCH D5hC*“v8plusa”(m> 32 ;)r“v9”(m> 64 ;)# -mt Z'V`_LDivBxP4S#K!nCZk libdb2 4S# ":g{9C POSIX _L,G4 DB2 &CLr9Xk9C -lpthread xP 4S,x^[|GGq_L/&CLr# -o $1 8(I4PD~# $1.o |(LrTsD~# utilemb.o g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# 156 *"6k= SQL &CLr utilapi.o g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# -L$DB2PATH/$LIB 8( DB2 2,bM2mbZ4S1D;C#}g,TZ 32 ;:$HOME/sqllib/ lib32;TZ 64 ;:$HOME/sqllib/lib64# $EXTRA_LFLAG 8( DB2 2mbZKP1D;C#TZ 32 ;,|,5“-R$DB2PATH/ lib32”;TZ 64 ;,|,5“-R$DB2PATH/lib64”# -ldb2 k DB2 b4S# kND`kwD5,TKbd{`kw!n# Windows C M C++ &CLrD`kM4S!n: Z Windows O9C Microsoft Visual C++ `kw9( C M C++ 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp.bat z&mD~P y># bldapp D`kM4S!n `k!n: %BLDCOMP% `kwDd?#1!5* cl,4 Microsoft Visual C++ `kw#mb,9IT +dhC* icl(CZ 32 ;M 64 ;&CLrD Intel C++ `kw)r ecl (CZ Itanium 64 ;&CLrD Intel C++ `kw)# -Zi tCwTE"# -Od {9E/#ZXUE/DivB9CwTwO*]W# -c ;4P`k;;xP4S#Kz&mD~|,@"D`kM4S=h# -W2 dv/f"ms"OXM;IV4ms{"# -DWIN32 Windows Yw53yXhD`kw!n# 4S!n: link 9C4SLrxP4S# -debug |(wTE"# -out:%1.exe 8(D~{# %1.obj |(TsD~# utilemb.obj g{G6k= SQL Lr,G4|,CZlimsD6k= SQL 5CLrTs D~# Z 4 B 9( 157 utilapi.obj g{;G6k= SQL Lr,G4|,CZlimsD DB2 API 5CLrTs D~# db2api.lib k DB2 b4S# 9Cy>9(E>49( C r C++ &CLr (UNIX) XZKNq DB2 a)KCZ`kM4S C r C++ 6k= SQL M DB2 \m API LrD9(E >#b)E>kIT9Cb)D~9(Dy>Lr;pEZ sqllib/samples/c ?<(T Z C &CLr)M sqllib/samples/cpp ?<(TZ C++ &CLr)P# 9(D~ bldapp |,CZ9( DB2 &CLrD|n# Z;vN} $1 8(4D~D{F#bG(;DXhN},"R,4|,6k= SQL D DB2 \m API Lr;h*KN}#9(6k= SQL Lrh*,S=}]b,rK, 9a)K}vI!N}:Z~vN} $2 8(*,SD}]bD{F;Z}vN} $3 8 (}]bDC'j6,x $4 r8(\k# TZ6k= SQL Lr,bldapp +N}+]x$`kMs(E> embprep#g{4a) }]b{,G4+9C1!}]b sample#v1SP9(LrD5}k}]byZD5 };,1,Eh*C'j6M\kN}# BP>}5wgN9(MKP DB2 \m API M6k= SQL &CLr# 9(MKP DB2 \m API &CLr *y]4D~ cli_info.c (C) M cli_info.C (C++) 49( DB2 \m API y>Lr cli_info,kdk: bldapp cli_info b+zII4PD~ cli_info# *KPbvI4PD~,kdkI4PD~{: cli_info 9(MKP6k= SQL &CLr v IT(}}V=(4y]4D~ tbmod.sqc (C) M tbmod.sqC (C++) 9(6 k= SQL &CLr tbmod: 1. g{Q,S=,;5}PD sample }]b,kdk: bldapp tbmod 2. g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp tbmod }]b 3. g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC' j6M\k: bldapp tbmod database userid password b+zII4PD~ tbmod v IT(}}V=(4KPbv6k= SQL &CLr: 158 *"6k= SQL &CLr 1. g{*CJ,;5}PD sample }]b,kdkI4PD~{: tbmod 2. g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b {: tbmod }]b 3. g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0 C}]b5}DC'j6M\k: tbmod database userid password Z Windows O9( C/C++ &CLr DB2 a)KCZ`kM4S DB2 API M6k= SQL C/C++ LrD9(E>#b) E>kIT9Cb)D~9(Dy>Lr;pEZ sqllib\samples\c M sqllib\ samples\cpp ?# Z;vN} %1 8(4D~D{F#TZ4|,6k= SQL DLrxT,bG(;D XhN}#9(6k= SQL Lrh*,S=}]b,rK,9a)K}v=SN}: Z~vN} %2 8(*,SD}]bD{F;Z}vN} %3 8(}]bDC'j6, x %4 r8(\k# TZ6k= SQL Lr,bldapp +N}+]x$`kMs(D~ embprep.bat#g{4 a)}]b{,G4+9C1!}]b sample#v1SP9(LrD5}k}]byZ D5};,1,Eh*C'j6M\kN}# }L v 9(MKP6k= SQL &CLr IT(}}V=(4y] sqllib\samples\c PD C 4D~ tbmod.sqc r sqllib\ samples\cpp PD C++ 4D~ tbmod.sqx 49(6k= SQL &CLr tbmod: – g{Q,S=,;5}PD sample }]b,kdk: bldapp tbmod – g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp tbmod }]b – g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC'j6M\ k: bldapp tbmod database userid password b+zII4PD~ tbmod.exe# IT(}}V=(4KPbv6k= SQL &CLr: – g{*CJ,;5}PD sample }]b,kdkI4PD~{: tbmod – g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: tbmod }]b Z 4 B 9( 159 – g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: tbmod database userid password v 9(MKP`_L&CLr Z Windows O`k C/C++ `_L&CLr1,Xk8( -MT r -MD !n#-MT ! n+9C2,b LIBCMT.LIB xP4S,x -MD +9C/,b MSVCRT.LIB xP4 S#9C -MD 4SD~xFD~O!+@5Z MSVCRT.DLL,9C -MT 4SD~x FD~Os+@"ZKP1# z&mD~ bldmt.bat 9C -MT !n49(`_LLr#yPd{`kM4S!n Lr dbthrds,kdk: bldmt dbthrds b+zII4PD~ dbthrds.exe# IT(}}V=(4KPbv`_L&CLr: – g{*CJ,;5}PD sample }]b,;hdkI4PD~{(;X8()9 {): dbthrds – g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: dbthrds }]b – g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: dbthrds database userid password >} BP>}5wgN9(MKP DB2 API M6k= SQL &CLr# *y] sqllib\samples\c PD4D~ cli_info.c r sqllib\samples\cpp PD4D ~ cli_info.cxx 49( DB2 API G6k= SQL y>Lr cli_info,kdk: bldapp cli_info b+zII4PD~ cli_info.exe#zIT(}Z|nPdkI4PD~{(;X8( )9{)4KPI4PD~: cli_info (}dCD~49(9C VisualAge C++ `4D6k= SQL &CL r XZKNq VisualAge C++ a)K]v`kwMz&m==`kw#d;z&m==`kw9C Makefile M9(D~,+]v`kw9CdCD~#PXb=fD|`E",kND VisualAge C++ V5.0 =xa)DD5# 160 *"6k= SQL &CLr DB2 *zIT9C VisualAge C++ `kw9(D;,`M DB2 Lra)KdCD~# *9C DB2 dCD~,kH+;v73d?hC*y*`kDLrD{F#;s,9 C VisualAge C++ a)D|n4`kLr# Z Windows O9( C/C++ `,S&CLr XZKNq DB2 Database for Linux, UNIX, and Windows a)KCZ`kM4S C M C++ 6k = SQL M DB2 API LrD9(E>#b)E>kIT9Cb)D~9(Dy>Lr ;pEZ sqllib\samples\c M sqllib\samples\cpp ?2`kK1!5“sample”M“sample2”w*}]b{(%2 M %3),rK, g{z9CK9(E>"S\b)1!5,G4;h8(Lr{(%1 N})#g{z9 C bldmc.bat E>,G4Xk8(+?}vN}# I!N}";G>X,SyXhD,+g{*S6LM'z,S=~qw,G4b) N}GXhD#b)N}G:%4 M %5(CZ8(Z;v}]bDC'j6M\k)T 0 %6 M %7(CZ8(Z~v}]bDC'j6M\k)# TZ`,Sy>Lr dbmcon.exe xT,h*=v}]b#g{P44( sample }] b,G4zIT(}Z DB2 |n0ZD|nPPdk db2sampl 44(K}]b#I T9CBPdP;u|n44(Z~v}]b(Z>}P,K}]b{* sample2): g{T>X==4(}]b: db2 create db sample2 g{T6L==4(}]b: db2 attach to Zc{ db2 create db sample2 db2 detach db2 catalog db sample2 as sample2 at node Zc{ dP,Zc{ G}]byZDZc# `,S9*s TCP/IP l}w&ZKP4,# }L *7# TCP/IP l}w&ZKP4,,k4PTBYw: 1. +73d? DB2COMM hC* TCP/IP,gBy>: db2set DB2COMM=TCPIP 2. 9C services D~P8(D TCP/IP ~q{F4|B}]b\mwdCD~: db2 update dbm cfg using SVCENAME TCPIP_service_name Z 4 B 9( 161 ?v5} TCP/IP ~q{F#g{zR;=CD~r_;_P| D~qD~yhDD~mI(,kk53\m1*5# 3. #9;sXBt/}]b\mw,T9b)|Dz': db2stop db2start a{ dbmcon.exe LrGy] samples\c r samples\cpp ?}kZ;v}]bs(DmD SQL o d# dbmcon2.sqc r dbmcon2.sqx CZ4(kZ~v}]bs(DLr|D4D~# dbmcon2.h w4D~ dbmcon.sqc r dbmcon.sqx P|(D dbmcon2.sqc r dbmcon2.sqx D7D~,dwCGCJCZ4(M>}kZ~v}]bs(DmD SQL o d# *9(`,Sy>Lr dbmcon.exe,kdk: bldmc dbmcon sample sample2 b+zII4PD~ dbmcon.exe# *KPbvI4PD~,kdkI4PD~{(;X8()9{): dbmcon KLr]>T=v}]b4P;WNd5# 9(9C COBOL `4D&CLrM}L z7=xa)KCZwVYw53=(D9(E>#(}9Cb)D~,IT9(9 C COBOL `4D6k= SQL &CLr#}CZ9(&CLrD9(E>Tb,9a )KCZ9(}L(f"}LMC'(eD/})DX( bldrtn E>#Z Linux O& m9C Micro Focus COBOL oT`4D&CLr1,kqX+`kwdC*\;CJ 3) COBOL 2mb#zITZ sqllib/samples/cobol ?<(TZ UNIX)M sqllib\ samples\cobol ?<(TZ Windows)PR=RGa)D IBM COBOL y>,TZ Micro Focus COBOL D samples ?<,k+76)2D“cobol”f;*“cobol_mf”# COBOL D`kM4S!n AIX IBM COBOL &CLrD`kM4S!n: 162 *"6k= SQL &CLr 9C IBM COBOL for AIX `kw49( COBOL 6k= SQL M DB2 API &CL r1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: cob2 IBM COBOL for AIX `kw# -qpgmname\(mixed\) 8>`kwJmwC_PlOs!4{FDbkZc# -qlib 8>`kw&m COPY od# -I$DB2PATH/include/cobol_a 8( DB2 |,D~D;C#}g:$HOME/sqllib/include/cobol_a# -c ;4P`k;;xP4S#`kM4SG;,D=h# 4S!n: cob2 9C`kww*4SLrD0K# -o $1 8(I4PLr# $1.o 8(LrTsD~# checkerr.o |(CZ4PmsliD5CLrTsD~# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#}g:$HOME/sqllib/lib32# -ldb2 k}]b\mwb4S# kND`kwD5,TKbd{`kw!n# AIX Micro Focus COBOL &CLrD`kM4S!n: Z AIX O9C Micro Focus COBOL `kw49( COBOL 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py>#"b, IT(}hC COBCPY 73d?4R= DB2 MicroFocus COBOL |,D~,rK; h*Z`k=hP8( -I j>#kND bldapp E>Tq!>}# bldapp D`kM4S!n `k!n: cob MicroFocus COBOL `kw# -c ;4P`k;;xP4S# $EXTRA_COBOL_FLAG="-C MFSYNC" tC 64 ;'V# -x k -c dO9C1,zITsD~# 4S!n: cob 9C`kww*4SLrD0K# -x zII4PLr# Z 4 B 9( 163 -o $1 8(I4PLr# $1.o 8(LrTsD~# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C#}g:$HOME/sqllib/lib32# -ldb2 k DB2 b4S# -ldb2gmf k Micro Focus COBOL D DB2 l#&mLrb4S# kND`kwD5,TKbd{`kw!n# HP-UX Micro Focus COBOL &CLrD`kM4S!n: Z HP-UX O9C Micro Focus COBOL `kw49( COBOL 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: cob Micro Focus COBOL `kw# -cx `k*Ts#i# $EXTRA_COBOL_FLAG g{ HP-UX =(tCK IA64 M 64 ;'V,G4Kj>|,“-C MFSYNC”# 4S!n: cob 9C`kww*4SLrD0K# -x 8(I4PLr# $1.o |(LrTsD~# checkerr.o |(CZ4PmsliD5CLrTsD~# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C# -ldb2 k DB2 b4S# -ldb2gmf k Micro Focus COBOL D DB2 l#&mLrb4S# kND`kwD5,TKbd{`kw!n# Solaris Micro Focus COBOL &CLrD`kM4S!n: TBGZ Solaris O9C Micro Focus COBOL `kw49( COBOL 6k= SQL M DB2 API &CLr19CD`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: cob Micro Focus COBOL `kw# 164 *"6k= SQL &CLr $EXTRA_COBOL_FLAG TZ 64 ;'V,|,5“-C MFSYNC”;qr,|;|,NN5# -cx `k*Ts#i# 4S!n: cob 9C`kww*4SLrD0K# -x 8(I4PLr# $1.o |(LrTsD~# checkerr.o |(CZ4PmsliD5CLrTsD~# -L$DB2PATH/$LIB 8( DB2 2,bM2mbZ4S1D;C#}g:$HOME/sqllib/lib64# -ldb2 k DB2 b4S# -ldb2gmf k Micro Focus COBOL D DB2 l#&mLrb4S# kND`kwD5,TKbd{`kw!n# Linux Micro Focus COBOL &CLrD`kM4S!n: TBGZ Linux O9C Micro Focus COBOL `kw49( COBOL 6k= SQL M DB2 API &CLr19CD`kM4S!n,g bldapp 9(E>Py># bldapp D`kM4S!n `k!n: cob Micro Focus COBOL `kw# -cx `k*Ts#i# $EXTRA_COBOL_FLAG TZ 64 ;'V,|,5“-C MFSYNC”;qr,|;|,NN5# 4S!n: cob 9C`kww*4SLrD0K# -x 8(I4PLr# -o $1 |(I4PD~# $1.o |(LrTsD~# checkerr.o |(CZ4PmsliD5CLrTsD~# -L$DB2PATH/$LIB 8( DB2 KP12mbD;C# -ldb2 k DB2 b4S# -ldb2gmf k Micro Focus COBOL D DB2 l#&mLrb4S# Z 4 B 9( 165 kND`kwD5,TKbd{`kw!n# Windows IBM COBOL &CLrD`kM4S!n: Z Windows O9C IBM VisualAge COBOL `kw9( COBOL 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp.bat z&mD~P y># bldapp D`kM4S!n `k!n: cob2 IBM VisualAge COBOL `kw# -qpgmname(mixed) 8>`kwJmwC_PlOs!4{FDbkZc# -c ;4P`k;;xP4S#`kM4SG;,D=h# -qlib 8>`kw&m COPY od# -I76 8( DB2 |,D~D;C#}g:-I"%DB2PATH%\include\cobol_a"# %EXTRA_COMPFLAG% g{+“set IBMCOB_PRECOMP=true”!{"M,G4+9C IBM COBOL $`k w4$`k6k= SQL#y]dkN}D;,,+9CBPdP;Vq=4w C$`kw: -q"SQL(’database sample CALL_RESOLUTION DEFERRED’)" 9C1!D sample }]bxP$`k"FYwCbv# -q"SQL(’database %2 CALL_RESOLUTION DEFERRED’)" 9CC'8(D}]bxP$`k"FYwCbv# -q"SQL(’database %2 user %3 using %4 CALL_RESOLUTION DEFERRED’)" 9CC'8(D}]b"C'j6M\kxP$`k"FYwCb v#bGCZ6LM'zCJDq=# 4S!n: cob2 9C`kww*4SLrD0K# %1.obj |(LrTsD~# checkerr.obj |(msli5CLrTsD~# db2api.lib k DB2 b4S# kND`kwD5,TKbd{`kw!n# Windows Micro Focus COBOL &CLrD`kM4S!n: Z Windows O9C Micro Focus COBOL `kw49( COBOL 6k= SQL M DB2 API &CLr1,9C DB2 Pa)D`kM4S!n,g bldapp.bat z&mD~P y># 166 *"6k= SQL &CLr bldapp D`kM4S!n `k!n: cobol Micro Focus COBOL `kw# 4S!n: cbllink 9C4SLrxP4S`-# -l k lcobol b4S# checkerr.obj kmsli5CLrTsD~4S# db2api.lib k DB2 API b4S# kND`kwD5,TKbd{`kw!n# COBOL `kwdC Z AIX OdC IBM COBOL `kw: XZKNq g{*"|,6k= SQL M DB2 API wCD&CLr,"Rz}Z9C IBM COBOL Set for AIX `kw,G4h*b)=h# }L v 9C PRECOMPILE |n4$`k&CLr1,k9C target ibmcob !n# v k;*Z4D~P9CxxV{# v ITZ4D~DZ;P9C PROCESS M CBL X|V4hC`k!n# v g{&CLr;|,6k= SQL,+4|, DB2 API wC,G4;h*9C pgmname(mixed) `k!n#g{9CK DB2 API wC,G4Xk9C pgmname (mixed) `k!n# v g{z}Z9C IBM COBOL Set for AIX `kwD“System z wz}]`M'V” &\?~,G4&CLrD DB2 |,D~ZTB?D~49( DB2 y>Lr,G4Xk+E>D~P8( D|,D~76|D*8r cobol_i ?,G4&CLrD DB2 |,D~ZTB? : COPY "sql.cbl". Z Windows OdC IBM COBOL `kw: Z 4 B 9( 167 XZKNq g{z*"|,6k= SQL M DB2 API wCD&CLr,"R}Z9C IBM VisualAge COBOL `kw,G4XkNG`vBn# }L v Z9C DB2 $`kw4$`k&CLr,"9C|nP&mw|n db2 prep 1, k9C target ibmcob !n# v k;*Z4D~P9CxxV{# v Z4D~P9C PROCESS M CBL X|V4hC`k!n#;\ZZ 8 = 72 PP 8(X|V# v g{&CLr;|,6k= SQL,+4|, DB2 API wC,G4;h*9C pgmname(mixed) `k!n#g{9CK DB2 API wC,G4Xk9C pgmname (mixed) `k!n# v g{z}Z9C IBM VisualAge COBOL `kwD“System/390 w}]`M'V”& \?~,G4&CLrD DB2 |,D~ZTB?Lr,G4Xk+z&mD~P 8(D|,D~76|D*8r cobol_i ?,G4&CLrD DB2 |,D~ZTB?< P: %DB2PATH%\include\cobol_a cobol_a G1!?<# v 8( COPY D~{T|( .cbl )9{,gBy>: COPY "sql.cbl". Z Windows OdC Micro Focus COBOL `kw: XZKNq g{z*"|,6k= SQL M DB2 API wCD&CLr,"R}Z9C Micro Focus `kw,G4XkNG`vBn# }L v 9C PRECOMPILE |n4$`k&CLr1,k9C target mfcob !n# v (}9CTB|n,7# LIB 73d?8r %DB2PATH%\lib: set LIB="%DB2PATH%\lib;%LIB%" v Micro Focus COBOL D DB2 COPY D~$tZ %DB2PATH%\include\cobol_mf P# k+ COBCPY 73d?hC*|(K?<,gBy>: set COBCPY="%DB2PATH%\include\cobol_mf;%COBCPY%" zXk7#Z System hCP@ChCOv73d?#IT(}jIBP=hxPl i: 1. r*XFfe 168 *"6k= SQL &CLr 2. !q53 3. !q_6!n( 4. %w73d? 5. Z53d?PmPiRXhD73d?#g{b)73d?;fZ,kZ53d ?PmPmSb)d? (}C'hC"|na>{rE>4hCb)d?";c;# B;=v24 Xk9CwC<( 74 4wCyP DB2 &CLr`LSZ#DB2 COBOL $`kw+ Z SPECIAL-NAMES NPT/ek CALL-CONVENTION Sd#g{;fZ SPECIAL- NAMES N,G4 DB2 COBOL $`kw+4(CN,gBy>: Identification Division Program-ID. "static". special-names. call-convention 74 is DB2API. "R,?1wC DB2 API 1,$`kw#b)E>kIT9Cb)D~9(Dy>Lr;pEZ sqllib/samples/ cobol ? embprep#g{4a) }]b{,G4+9C1!}]b sample#v1SP9(LrD5}k}]byZD5 };,1,Eh*C'j6M\kN}# *y]4D~ client.cbl 49(G6k= SQL y>Lr client,kdk: bldapp client b+zII4PD~ client#zIT(}dkTB|nT sample }]bKPbvI4 PD~: client }L v IT(}}V=(y]4D~ updat.sqb 9(6k= SQL &CLr updat: 1. g{Q,S=,;5}PD sample }]b,kdk: bldapp updat 2. g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp updat }]b 3. g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC'j6M\ k: bldapp updat database userid password b+zII4PD~ updat# v IT(}}V=(4KPbv6k= SQL &CLr: 1. g{*CJ,;5}PD sample }]b,kdkI4PD~{: updat 2. g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: updat }]b 3. g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: updat database userid password 172 *"6k= SQL &CLr 9( UNIX Micro Focus COBOL &CLr XZKNq DB2 a)KCZ`kM4S Micro Focus COBOL 6k= SQL M DB2 \m API L rD9(E>#b)E>kIT9Cb)D~9(Dy>Lr;pEZ sqllib/samples/ cobol_mf ? embprep#g{4a) }]b{,G4+9C1!}]b sample#v1SP9(LrD5}k}]byZD5 };,1,Eh*C'j6M\kN}# *y]4D~ client.cbl 49(G6k= SQL y>Lr client,kdk: bldapp client b+zII4PD~ client#zIT(}dkTB|nT sample }]bKPbvI4 PD~: client }L v IT(}}V=(y]4D~ updat.sqb 9(6k= SQL &CLr updat: 1. g{Q,S=,;5}PD sample }]b,kdk: bldapp updat 2. g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp updat }]b 3. g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC'j6M\ k: bldapp updat database userid password b+zII4PD~ updat# v IT(}}V=(4KPbv6k= SQL &CLr: 1. g{*CJ,;5}PD sample }]b,kdkI4PD~{: updat 2. g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: updat }]b 3. g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: updat database userid password Z 4 B 9( 173 Z Windows O9( IBM COBOL &CLr XZKNq DB2 a)KCZ`kM4S DB2 API M6k= SQL LrD9(E>#b)E>kI T9Cb)D~9(Dy>Lr;pEZ sqllib\samples\cobol ?m9CX(D$`k!njI# z&mD~ bldapp.bat |,CZ9( DB2 &CLrD|n#KD~ITS\`o 4 vN},Zz&mD~P,|GVpId? %1"%2"%3 M %4 m># Z;vN} %1 8(4D~D{F#TZ4|,6k= SQL DLrxT,bG(;D XhN}#9(6k= SQL Lrh*,S=}]b,rK,9a)K}vI!N}: Z~vN} %2 8(*,SD}]bD{F;Z}vN} %3 8(}]bDC'j6, x %4 r8(\k# TZ9C1!D DB2 $`kwD6k= SQL Lr,bldapp.bat +N}+]x$`k Ms(D~ embprep.bat# TZ9C IBM COBOL $`kwD6k= SQL Lr,bldapp.bat +Q .sqb 4D~ 4F= .cbl 4D~#`kw9CX(D$`k!nT .cbl 4D~4P$`k# ^[9CDn$`kw,g{4a)}]b{,<+9C1!}]b sample#v1SP 9(LrD5}k}]byZD5};,1,Eh*C'j6M\kN}# BP>}5wgN9(MKP DB2 API M6k= SQL &CLr# *y]4D~ client.cbl 49(G6k= SQL y>Lr client,kdk: bldapp client b+zII4PD~ client.exe#zIT(}dkI4PD~{(;X8()9{)T sample }]bKPI4PD~: client }L v IT(}}V=(y]4D~ updat.sqb 9(6k= SQL &CLr updat: 1. g{Q,S=,;5}PD sample }]b,kdk: bldapp updat 2. g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp updat }]b 3. g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC'j6M\ k: bldapp updat database userid password b+zII4PD~ updat# v IT(}}V=(4KPbv6k= SQL &CLr: 174 *"6k= SQL &CLr 1. g{*CJ,;5}PD sample }]b,kdkI4PD~{: updat 2. g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: updat }]b 3. g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: updat database userid password Z Windows O9( Micro Focus COBOL &CLr XZKNq DB2 a)KCZ`kM4S DB2 API M6k= SQL LrD9(E>#b)E>kI T9Cb)D~9(Dy>Lr;pEZ sqllib\samples\cobol_mf ?# Z;vN} %1 8(4D~D{F#TZ4|,6k= SQL DLrxT,bG(;D XhN}#9(6k= SQL Lrh*,S=}]b,rK,9a)K}vI!N}: Z~vN} %2 8(*,SD}]bD{F;Z}vN} %3 8(}]bDC'j6, x %4 r8(\k# TZ6k= SQL Lr,bldapp +N}+]x$`kMs(z&mD~ embprep.bat# g{4a)}]b{,G4+9C1!}]b sample#v1SP9(LrD5}k}] byZD5};,1,Eh*C'j6M\kN}# BP>}5wgN9(MKP DB2 API M6k= SQL &CLr# *y]4D~ client.cbl 49(G6k= SQL y>Lr client,kdk: bldapp client b+zII4PD~ client.exe#zIT(}dkI4PD~{(;X8()9{)T sample }]bKPI4PD~: client }L v IT(}}V=(y]4D~ updat.sqb 9(6k= SQL &CLr updat: 1. g{Q,S=,;5}PD sample }]b,kdk: bldapp updat 2. g{Q,S=,;5}PDm;v}]b,G49hdk}]b{: bldapp updat }]b 3. g{Q,S=m;5}PD}]b,G49hdkC}]b5}DC'j6M\ k: bldapp updat database userid password b+zII4PD~ updat.exe# v IT(}}V=(4KPbv6k= SQL &CLr: Z 4 B 9( 175 1. g{*CJ,;5}PD sample }]b,kdkI4PD~{(;X8()9 {): updat 2. g{*CJ,;5}PDm;v}]b,kdkI4PD~{M}]b{: updat }]b 3. g{*CJm;5}PD}]b,kdkI4PD~{"}]b{T0C}]b 5}DC'j6M\k: updat database userid password 9(MKP9C REXX `4D6k= SQL &CLr ;XT REXX &CLrxP$`k"`kr4S#zITZ Windows Yw53M AIX Yw53O9(MKP REXX &CLr# XZKNq Z Windows Yw53O,zD&CLrD~Xk_P .CMD )9{#4(&CLrj Is,IT1SSYw53|na>{KPC&CLr#Z AIX O,&CLrD~I T_PNN)9{# }L *9(MKP REXX &CLr,k4PTBYw: v Z Windows Yw53O,&CLrD~IT_PNN{F#4(&CLrjIs, IT(}wC REXX bMwSYw53|na>{KPC&CLr,gBy>: REXX D~{ v Z AIX O,IT9CTB=V=(PDNN;V=(4KP&CLr: – Z shell |na>{&,dk rexx name,dP name GzD REXX LrD{F# – g{ REXX LrDZ;P|,“C}”(#!)"j6K REXX/6000 bMwyZD ?<,G4zIT(}Z shell |na>{&dk REXX LrD{F4KPCL r#}g,g{ REXX/6000 bMwD~Z /usr/bin ?{&dkTB|n9CLrI4P: chmod +x {F (}Z shell |na>{&dk REXX LrDD~{4KPCLr# ":Z AIX O,&ChC LIBPATH 73d?T|( REXX SQL b db2rexx yZ D?<#}g: export LIBPATH=/lib:/usr/lib:/$DB2PATH/lib REXX Ds(D~ RGa)K 5 vs(D~4'V REXX &CLr#b)D~D{F|(Z DB2UBIND.LST D~P#?vs(D~<9C;,Dtk6pxP$`k;rK,}] bPf"K 5 v;,DLr|# 176 *"6k= SQL &CLr b 5 vs(D~G: DB2ARXCS.BND 'V“NjH(T”tk6p# DB2ARXRR.BND 'V“IX4A”tk6p# DB2ARXUR.BND 'V“4d5DA”tk6p# DB2ARXRS.BND 'V“AH(T”tk6p# DB2ARXNC.BND 'V“;d5”tk6p#9C3)wzr System i }]b~qw1,+9CK tk6p#TZd{}]b,Ktk6pDP*k“4d5DA”tk6p` ,# ":Z3)ivB,I\PX*T=X+b)D~k}]bs(# 9C SQLEXEC }L1,ZIC“NjH(T”tk6pDivB4(DLr|Cw1! |#g{zh*mb3Vtk6p,ITZ,S=}]b.09C SQLDBS CHANGE SQL ISOLATION LEVEL API 4|Dtk6p#b+#QT+3 REXX mSfrTsD)9, +dVP/}M8n4|D#Object REXX bMwGdH0f>Dv?f>,|a)K TBPwnD=S'V: v `"TsM=( v {"+]M`,T v %;LPM`XLP Object REXX k+3 REXX j+f]#Z>ZP,?19C REXX 1,y8y* REXX DyPf>,dP|( Object REXX# z;XT REXX LrxP$`krs(# Z Windows O,REXX Lr;XT"M*7#+G,*K5VIF2T,(iz9? v REXX LrLr# *KPy> REXX Lr updat,kdk: rexx updat.cmd Z 4 B 9( 177 S|nP9(6k= SQL &CLr S|nP9(6k= SQL &CLrf0BP=h: 1. (}"v PRECOMPILE |n4$`k&CLr 2. g{Q4(s(D~,k(}"v BIND |n+KD~k}]bs(,Tc4(&C LrLr|# 3. T-}^DD&CLr4D~T04|,6k= SQL D4D~xP`k,Tc4( &CLrTsD~(.obj D~)# 4. (}9C4S|n+&CLrTsD~k DB2 MwoTb4S,Tc4(I4PL r# 9(9C C r C++ `4D6k= SQL &CLr(Windows) Z`44D~.s,Xk9(6k= SQL &CLr# XZKNq 9(}LD3)=h!vZzy9CD`kw#K}LD?v=hy=xa)D>} 5wgN9C Microsoft Visual Studio 6.0 `kw(bG;v C `kw)49({* myapp D&CLr#zITpvKPK}LPD?v=h,2IT(}S DB2 |n0 Za>{KPz&mD~4,1KPb)=h#*q!ICZ9( %DB2PATH%\SQLLIB\ samples\c\ ?&CLrDz&mD~D>},kN< %DB2PATH %\SQLLIB\samples\c\bldapp.bat D~#Kz&mD~(}wCm;vz&mD~ %DB2PATH%\SQLLIB\samples\c\embprep.bat 4$`k&CLrT0+C&CLrk}] bs(# v n/D}]b,S v )9{* .sqc(C)r .sqx(C++)"|,6k= SQL D&CLr4zkD~ v \'VD C r C++ `kw v KP PRECOMPILE |nM BIND |nyhD(^rX( }L 1. (}"v PRECOMPILE |n4$`k&CLr# }g: C &CLr:db2 PRECOMPILE myapp.sqc BINDFILE C++ &CLr:db2 PRECOMPILE myapp.sqx BINDFILE PRECOMPILE |n+zI;v .c r .C D~(KD~|, .sqc r .sqC D~P4z kD-}^DDN=)T0;v&CLr|#g{9C BINDFILE !n,G4 PRE- COMPILE |n+zIs(D~#ZTO>}P,Ks(D~{* myapp.bnd# 2. g{Q4(s(D~,k(}"v BIND |n+KD~k}]bs(,Tc4(& CLrLr|#}g: db2 bind myapp.bnd BIND |n9&CLr|k}]b`X*"+CLr|f"Z}]bP# 3. T-}^DD&CLr4D~T04|,6k= SQL D4D~xP`k,Tc4( &CLrTsD~(.obj D~)# }g: C &CLr:cl -Zi -Od -c -W2 -DWIN32 myapp.c C++ &CLr:cl -Zi -Od -c -W2 -DWIN32 myapp.cxx 178 *"6k= SQL &CLr 4. (}9C4S|n+&CLrTsD~k DB2 MwoTb4S,Tc4(I4PL r# }g: link -debug -out:myapp.exe myapp.obj Z 4 B 9( 179 180 *"6k= SQL &CLr Z 5 B ?pMKP6k= SQL &CLr 6k= SQL &CLrIF2,"IT?pZ6LzwO#zITZ;v;C`kK& CLr,;sZm;(zwOKPLr|Tc9CBzwOD}]b# PX4S= libdb2.so D^F Z3) Linux V"O,libc *" rpm f= /usr/lib/libdb2.so r /usr/lib64/libdb2.so b#bvbCZ Sleepycat Software D Berkeley DB 5V,k IBM DB2 }]b53 ^X# g{z4F.9C Berkeley DB,G4ITZ53O@CX+b)bD~X|{r>}# g{zk*9C Berkeley DB,G4IT+|,b)bD~DD~PX|{"+73d ?^D*8rBD~P# © Copyright IBM Corp. 1993, 2012 181 182 *"6k= SQL &CLr Z 6 B tC(Ff]T&\ DB2 }]b\mwa)K=cSd{}]b53(F6kD SQL C &CLrD&\# I(}+$`kw!n COMPATIBILITY_MODE hC* ORA 4tCb)f]T&\# }g,1z`k{* tbsel.sqc DD~1,9CTB|n+tCf]T&\: $ db2 PRECOMPILE tbsel.sqc BINDFILE COMPATIBILITY_MODE ORA r*f]T==1,'VBP&\: v + C }iwd?CZ FETCH INTO od v + INDICATOR d?}iCZ FETCH INTO od v BD CONNECT odo( v 9C+}E(} INCLUDE od8(D~{ v VARCHAR `MDr%`M(e Kb,9'V6k= SQL C M6k= SQL C++ DTB&\,+;h*+$`kw! n COMPATIBILITY_MODE hC* ORA: v 9C BIND |n GENERIC !nD STATICASDYNAMIC V{.*a0PDLr| s(a)f}D/, SQL P* v +V{.DVCZ PREPARE od v + BREAK YwCZ WHENEVER od C }iwd? (}9C C }iwd?,ITyw;vNj"T}id?xPz?Cf,1==oCP Da2# ,;NCfP9CD}id?h*_P`,D*X},qr+9C*}id?ywD n!*X}"T>/f#}id?Ds!w;`,(S 2 = 32K)# Z;N FETCH P,IlwDnsG<}G*}id?ywDns*X}#g{ZZ; NCfsP|`PIC,G4ITX4 FETCH odTq!B;iP#CfD\P}D [}Mf"Z sqlca.sqlerrd[2] P# ZTB>}P,ywK=v}iwd? empno M lastname#?v}iwd?n`I] I 100 v*X#r*vP;v FETCH od,yTK>}lw 100 vr|YDP# EXEC SQL BEGIN DECLARE SECTION; char empno[100][8]; char lastname[100][15]; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE empcr CURSOR FOR SELECT empno, lastname FROM employee; EXEC SQL OPEN empcr; EXEC SQL WHENEVER NOT FOUND GOTO end_fetch; while (1) { © Copyright IBM Corp. 1993, 2012 183 EXEC SQL FETCH empcr INTO :empno :lastname; /* bulk fetch */ ... /* 100 or less rows */ ... } end_fetch: EXEC SQL CLOSE empcr; INDICATOR d?}i Z FETCH odP,I9C8>{d?}i47(}id?DNN*XGq* NULL# g{8>{d?|,;v!ZcD5,G4bj6`&D}i5* NULL# I9CX|V INDICATOR 4j68>{d?,gTB>}y># ZTB>}P,ywKF* bonus_ind D8>{d?}i#|IT_Pn` 100 v* X,k*}id? bonus ywD}?`,#Cf}]1,g{ bonus D5* NULL, G4 bonus_ind PD5+*:}# EXEC SQL BEGIN DECLARE SECTION; char empno[100][8]; char lastname[100][15]; short edlevel[100]; double bonus[100]; short bonus_ind[100]; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE empcr CURSOR FOR SELECT empno, lastname, edlevel, bonus FROM employee WHERE workdept = ’D21’; EXEC SQL OPEN empcr; EXEC SQL WHENEVER NOT FOUND GOTO end_fetch; while (1) { EXEC SQL FETCH empcr INTO :empno :lastname :edlevel, :bonus INDICATOR :bonus_ind ... ... } end_fetch: EXEC SQL CLOSE empcr; 8>{d?;GI INDICATOR X|Vj6,xGIT1SzfZd`&Dwd?. s,gTB>}Py>: EXEC SQL FETCH empcr INTO :empno :lastname :edlevel, :bonus:bonus_ind g{8>{}id?D*X}k`&Dw}id?D*X};%d,G4+5Xm s# BD CONNECT odo( CONNECT odVZJmTB=So(: EXEC SQL CONNECT [ username IDENTIFIED BY password ][ USING dbname ]; BmhvKb)N}: 184 *"6k= SQL &CLr N} hv C'{ CZ8(}]bC'{Dwd?rV{. \k CZ8(\kDwd?rV{. }]b{F CZ8(}]b{FDwd?rV{. 9C+}E8(|,D~{ IZ INCLUDE 18nP9C+}E48(|,D~{(1 COMPATIBILITY MODE 4hC* ORA 1,vJm9C%}E)#}g: EXEC SQL INCLUDE "abc.h"; VARCHAR `MDr%`M(e 'VTB VARCHAR `Myw#$`kw+d9**H[D C a9`M: EXEC SQL BEGIN DECLARE SECTION; VARCHAR var_name [n+1]; EXEC SQL END DECLARE SECTION; BIND |nO GENERIC !nD STATICASDYNAMIC V{. g{+ BIND |n GENERIC !nOD STATICASDYNAMIC V{.hC*“yes”, G4 DB2 }]b\mw;a+yPodf"Z?"CJLr|_Y:f)# Ks,s(D~PDodDP*Mg,z}Z9C/, SQL ;y#}g,wZ+kT }]b(eoT''"Xb(CDfw|BH~=XXB`k#4gB==(eCB o(: DB2 BIND filename GENERIC ’STATICASDYNAMIC [YES|NO]’ +V{.DVCZ PREPARE od PREPARE odI&CLrCZT/,==<8 SQL odTc4P#PREPARE od y]odDV{.q=(F*odV{.)4(I4PD SQL od# TZ6k= C M6k= C++ &CLr,}K\;y]wd?rmo=<8odTb, statement string 9ITGV{.DV# }g:EXEC SQL PREPARE stmt_name FROM ’select empid from employee’ ; WHENEVER odPD BREAK Yw WHENEVER odCZ8("z8(l#u~1*4PDYw#TZ6k= C M6k = C++ &CLr,'V=SYw BREAK#KYwa}aLr – LL v DB2 i. – PDF D~(IBX) – PDF D~(Z DB2 PDF DVD P) – !"fi. v |nPoz – |noz – {"oz ":DB2 E"PDwbD|B5JH PDF i.r2=4i.D|B5J_#*q!n BE",k20ICDD5|Br_ND ibm.com OD DB2 E"PD# zITZ_CJ ibm.com ODd{ DB2 c:http:// www.ibm.com/software/data/sw-library/# D54! RGG#XSzT DB2 D5D4!#g{zkMgNDF DB2 D5av(i,kr db2docs@ca.ibm.com "MgSJ~#DB2 D5!i+DAzDyP4!,+^(1S xzp4#k!I\a)_eD>},byRGE\|CXKbzyXDDJb#g {z*a)PX_ewbrozD~D4!,kSOjbM URL# k;*9CTOgSJ~X7k DB2 M''Vz9*5#g{zv=D5^(bvD DB2 M-kf># !\b)mj6i.P!"f,+I\4ZzyZzRrXxa)# ?N|BVa1,m%EDVaDnBf># ":DB2 E"PDD|B5JH PDF r2=4i.D|B5J_# © Copyright IBM Corp. 1993, 2012 187 m 23. DB2 SQL 4,oz DB2 z7kTI\d1 SQL oda{Du~5X SQLSTATE 5#SQLSTATE oz 5w SQL 4,M SQL 4,`zkD,e# }L *t/ SQL 4,oz,kr*|nP&mw"dk: ? sqlstate or ? class code dP,sqlstate m>P'D 5 ; SQL 4,,class code m>C SQL 4,D0 2 ;# }g,? 08003 T> 08003 SQL 4,Doz,x ?08T> 08 `zkDoz# CJ;,f>D DB2 E"PD zITZ ibm.com® OD;,E"PDPR=d{f> DB2 z7DD5# XZKNq TZ DB2 V10.1 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v10r1# =< A. DB2 XD DB2 E"PDXk(ZxP|B# *<.0 XkQ20 DB2 V10.1 E"PD#PXj8E",kND20 DB2 ~qwPD“9C DB2 20r<420 DB2 E"PD”wb#yPJCZ20E"PDDHvu~M^ F,yJCZ|BE"PD# XZKNq ITT/rV/|BVPD DB2 E"PD: v T/|B+|BVPDE"PD&\?~MoT#T/|BD;vEcG,kV/ |B`H,E"PDD;IC1dOL#mb,T/|BIhC*w*(ZKPD d{z&mw5D;?VKP# v IT9CV/|B=(4|BVPDE"PD&\?~MoT#T/|BITuL |B}LPD#z1d,+g{zkmS&\?~roT,G4Xk4PV/} L#}g,g{>XE"PDnu20DG"oM(of,xVZ9*20Bo f;G4V/|B+20Bof,"|BVPE"PDD&\MoT#+G,V/ |B*szV/#9"|BMXBt/E"PD#Z{v|B}LZdE"PD; IC#ZT/|B}LP,E"PDvZ|BjIs#9$wTXBt/E"P D# Kwbj85wKT/|BD}L#PXV/|BD8>E",kND“V/|B20 ZzDFczrZ?x~qwOD DB2 E"PD”wb# }L *T/|B20ZFczrZ?x~qwOD DB2 E"PD: 1. Z Linux Yw53O, a. /@AE"PDD20;C#1!ivB,DB2 E"PD20Z /opt/ibm/ db2ic/V10.1 ?: 190 *"6k= SQL &CLr update-ic 2. Z Windows Yw53O, a. r*|n0Z# b. /@AE"PDD20;C#1!ivB,DB2 E"PD20Z \IBM\DB2 Information Center\V10.1 ? m > Program Files ?BDT0|BsD wb#g{E"PD|B;IC,G4aZU>PmS{"#U>D~;Z doc\ eclipse\configuration ?D~{FGfzzID`E#}g, 1239053440785.log# V/|B20ZFczrZ?x~qwOD DB2 E"PD g{zQZ>X20 DB2 E"PD,G4IS IBM q!D5|B"xP20# XZKNq V/|B20Z>XD DB2 E"PD*sz: 1. #9FczOD DB2 E"PD,;sT@"==XBt/E"PD#g{T@"= =KPE"PD,G4xgODd{C'+^(CJE"PD,rxzIT&C| B#DB2 E"PDD$w>f>\GT@"==KP# 2. 9C“|B”&\?~4i4ICD|B#g{PzXk20D|B,G4k9C“ |B”&\?~4q!"20b)|B# ":g{zD73*sZ;(4,SArXxDzwO20 DB2 E"PD|B,k 9C;(Q,SArXx"Q20 DB2 E"PDDzw+|B>c5qA>XD~ 53#g{xgPPm`C'+20D5|B,G4IT(}Z>X2*|B>c Fw5q"*|B>c4(zm4uL?vK4P|Byh*D1d# g{a)K|B|,k9C“|B”&\?~4q!b)|B|#+G,;PZ%z ==BE\9C“|B”&\?~# 3. #9@"E"PD,;sZFczOXBt/ DB2 E"PD# ":Z Windows 2008"Windows Vista M|_f>O,TsP>ZK?VD|nXk w*\m1KP#*r*_P+f\m1X(D|na>{r XFfe > \m$_ > ~q#R|%w DB2 E "PD~q,"!q#9# =< A. DB2 Program Files ?: help_start 531! Web /@w+r*TT>@"E"PD# 3. %w|B4%( )#(XkZ/@wPtC JavaScript#) ZE"PDDR_f eO,%wiR|B# +T>VPD5D|BPm# 4. *t/20}L,kliz*20D!n,;s%w20|B# 5. Z20xLjIs,k%wjI# 6. *#9@"E"PD,k4PBPYw: v Z Windows O,/@A20?: help_end ":help_end E>|,2+X#99C help_start E>t/DxLyhD|n# ;*9CNNd{=(4#9 help_start E># 7. XBt/ DB2 E"PD# v Z Windows O,%w*< > XFfe > \m$_ > ~q#R|%w DB2 E "PD~q,"!qt/# v Z Linux O,dkTB|n: /etc/init.d/db2icdv10 start a{ |BsD DB2 E"PD+T>BDT0|BsDwb# 192 *"6k= SQL &CLr DB2 LL DB2 LLozzKb DB2 }]bz7Dwv=f#b)NLa)Kp=8>E"# *<.0 zITZE"PDPi4 XHTML fDLL:http://publib.boulder.ibm.com/infocenter/ db2luw/v10r1/# 3)NL9CKy>}]rzk#PXdX(NqDNNHvu~Dhv,kNDL L# DB2 LL *i4LL,k%wjb# pureXML 8OPD:pureXML®; hC DB2 }]bTf" XML }]T0T>z XML }]f"w4Py>Y w# DB2 JOoOE" RGa)KwVwyDJOoOMJb7(E"4ozz9C DB2 }]bz7# DB2 D5 zITZJOoOMw{}]bT\r_ DB2 E"PDD“}]by!”?VP R=JOoOE",b)E"|,TBZ]: v PXgN9C DB2 oO$_M5CLr4tkM7(JbDE"# v ;)n#{JbDbv=8# v g{zv=Jb"R#{C=ozTiRI\D-rMbv=8,kCJ IBM 'VE'x>#bvca)K8rnB DB2 vfo":http://www.ibm.com/support/entry/portal/Overview/ Software/Information_Management/DB2_for_Linux,_UNIX_and_Windows E"PDunMu~ g{{OTBunMu~,G4Zhz9Cb)vfoDmI(# JCT:C'h*q- IBM Web >cD9Cun0TBunMu~# vK9C:;*#tyPD(P(yw,zMIT*vK"GL59C4Fb)vf o#4- IBM w7,b,z;ITV""9>rFwb)vfordPNN?VD] ow7# L59C:;*#tyPD(P(yw,zMITvZs5Z4F"V"M9>b) vfo#4- IBM w7,b,z;ITFwb)vfoD]ow7,r_ZzDs5 b?4F"V"r9>b)vfordPDNN?V# =< A. DB2 mI(Pw7Zh,qr;CZhTb)vfordP|,DNNE ""}]"m~rd{*6z(DNNmI("mI$r({,^[Gw>D9G5 ,D# IBM #ty]TmDPO,O*TvfoD9Cp&K IBM D(f(I IBM Tm7 ()r4}7q-TO8>E"1,7XK&yZh(^D({# ;Pzj+q-yPJCD(IM(f,|(yPD@zvZ(IM(f,zEIT BX"vZrYvZCE"# IBM Tb)vfoDZ];wNN#$#b)vfo“4V4”a),;=PNNV`D (^[Gw>D9G5,D)#$,|(+;^Z5,DXZJzMJCZ3VX( C>D#$# IBM Trademarks: IBM, the IBM logo, and ibm.com are trademarks or registered trade- marks of International Business Machines Corp., registered in many jurisdictions world- wide. Other product and service names might be trademarks of IBM or other compa- nies. A current list of IBM trademarks is available on the Web at www.ibm.com/legal/ copytrade.shtml 194 *"6k= SQL &CLr =< B. yw >E"G*Z@za)Dz7M~q`4D#PXG IBM z7DE"GyZWNvf KD51DIqE"Raf1|B# IBM I\Zd{zRrXx;a)>D5PV[Dz7"~qr&\XT#PXz10 yZxrDz7M~qDE",krz1XD IBM zmI/#NNT IBM z7"L rr~qD}C"GbZw>r5>;\9C IBM Dz7"Lrr~q#;*;V8 IBM D*6z(,NN,H&\Dz7"Lrr~q,I\Q5Pr}Zjkk>D5Z]PXDwn({#a)>D5"4ZhC '9Cb)({DNNmI#zITCif==+mIi/Dy: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. PX+VZV{/ (DBCS) E"DmIi/,kkzyZzRrXxD IBM *6z( ?E*5,rCif==+i/Dy: Intellectual Property Licensing Legal and Intellectual Property Law IBM Japan, Ltd. 1623-14, Shimotsuruma, Yamato-shi Kanagawa 242-8502 Japan >un;JC"zrNNbyDunk1X(I;;BDzRrXx:International Busi- ness Machines Corporation“4V4”a)>vfo,;=PNNV`D(^[Gw>D9 G5,D)#$,|(+;^Z5,DPXGV("JzMJCZ3VX(C>D# $#3)zRrXxZ3);WP;Jmb}w>r5,D#$#rK>unI\; JCZz# >E"PI\|,JODBf>P#IBM ITf1T>JOPhvDz7M/rLrxPD xM/r|D,x;mP(*# >E"PTG IBM Web >cDNN}C<;G*K=cp{Ea)D,;TNN== d1TG) Web >cD#$#G) Web >cPDJO;GK IBM z7JOD;? V,9CG) Web >cx4DgU+IzTPP## IBM IT4|O*J1DNN==9CrV"zya)DNNE"x^kTzP#NN pN# © Copyright IBM Corp. 1993, 2012 195 >LrD;mI=g{*KbPXLrDE"To=gB?D:(i) JmZ@"4(DL rMd{Lr(|(>Lr).dxPE";;,T0 (ii) JmTQ-;;DE"xP `%9C,kkBPX7*5: IBM Canada Limited U59/3600 3600 Steeles Avenue East Markham, Ontario L3R 9Z7 CANADA ;*qXJ1DunMu~,|(3)iNBD;(}?D6Q,JOPhvDmILr0dyPICDmIJOyI IBM @] IBM M'-i"IBM zJm~mI-irNN,H-iPDuna)# K&|,DNNT\}]D5DC'&1i$dX(73DJC}]# f0G IBM z7DE"ISb)z7D)&L"dvf5wrd{I+*qCDJO Pq!#IBM ;PTb)z7xPbT,2^(7OdT\D+7T"f]TrNNd {XZG IBM z7Dyw#PXG IBM z7T\DJb&1rb)z7D)&La v# yPXZ IBM 44=rrbrDywK?jMb8xQ# >E"I\|,ZU#5qYwP9CD}]M(fD>}#*K!I\j{X5w b)>},>}PI\a|(vK"+>"7FMz7D{F#yPb){FE"|(4oTN=Dy>&CLr,b)y>5w;,Yw=(OD`L=(# g{G*4UZ`4y>LrDYw=(OD&CLr`LSZ (API) xP&CLrD *""9C"-zrV",zITNNN=Tb)y>LrxP4F"^D"V", x^kr IBM 6Q#b)>}"4ZyPu~Bw+fbT#rK,IBM ;\##r 5>b)LrDI?T"I,$Tr&\#Ky>Lr“4V4”a),R;=PNN V`D#$#TZ9CKy>Lry}pDNNp5,IBM +;P#pN# 2b)y>LrD?]=4rdNN?VrNN\zz7,D{F)(j]). K?VzkGy] IBM +>Dy>Lr\zv4D#© Copyright IBM Corp. (dkj]). All rights reserved. Lj IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of Interna- tional Business Machines Corp., registered in many jurisdictions worldwide. Other prod- 196 *"6k= SQL &CLr uct and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the web at :Copyright and trademark information; at www.ibm.com/legal/copytrade.shtml. The following terms are trademarks or registered trademarks of other companies v Linux is a registered trademark of Linus Torvalds in the United States, other coun- tries, or both. v Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle, its affiliates, or both. v UNIX is a registered trademark of The Open Group in the United States and other countries. v Intel, Intel logo, Intel Inside, Intel Inside logo, Celeron, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiar- ies in the United States and other countries. v Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of oth- ers. =< B. yw 197 198 *"6k= SQL &CLr w} [B] oz SQL od 189 s( s(D~hv5CLr(db2bfd) 137 Lr| 6k= SQL 129 DB2 Connect 142 /,od 139 Ev 139 (^ 142 5CLr DB2 Connect 142 SY 141 &CLr 142 "bBn 140 DYNAMICRULES s(!n 137 s(Pm DB2 Connect 142 s(D~ 6k= SQL &CLr 129, 132 rsf]T 140 REXX 176 s(!n Ev 139, 140 s( API SYs( 141 |,D~ (; Z COBOL P 4 Ev 24 COBOL 6k= SQL &CLr 27 C/C++ 6k= SQL &CLr 25 FORTRAN 6k= SQL &CLr 29 `k 6k= SQL &CLr 136 `kw 9(D~ 146 6k= SQL &CLr 7 IBM COBOL AIX 167 Windows 168 Micro Focus COBOL AIX 170 HP-UX 171 Solaris 171 Windows 168 d? REXX 99 SQLCODE 62, 85, 94 d? (x) SQLSTATE 62, 85, 94 m bv4^(D{F 146 {F bv4^(D 146 a!P 124 [C] N}jG x`M 118 /, SQL d?dk 118 7(od`M 117 >} 119 >} 119 i/ I|B 124 I>} 124 I&zk 31 Lr| f> X( 145 ,{ 145 ;IC 140 4( BIND |nMVPs(D~ 139 #= 133 6k= SQL &CLr 132 1dAGms 135 X( Ev 145 ^'4, 140 wz}]b~qw 142 REXX &CLr'V 176 System i }]b~qw 142 I1Kc{ C/C++ ^F 78 XBs( j8E" 140 REBIND PACKAGE |n 140 vZPm}L 127 f"}L u 127 SQLCA a9 127 SQLCODE VN 127 SQLSTATE VN 127 SQLWARN VN 127 [D] sTs(LOB) (;w C/C++ PDyw 73 C/C++ yw 71 x`MN}jG 118 zk3 s( 140 /, SQL s( 139 N}jG 118 Ev 10 2, SQL HO 11 6k= SQL HO 11 Nbod &m 116 7(`M 117 >}P 124 ^F 10 T\ 2, SQL HO 11 Nj &m 112 'Vod 10 DESCRIBE od Ev 10, 108 DYNAMICRULES 0l 137 EXECUTE od Ev 10 EXECUTE IMMEDIATE od Ev 10 PREPARE od Ev 10 SQLDA yw 108 `,S&CLr 9(D~ 146 9( Windows C/C++ 161 `_L&CLr 9( D~ 146 C++(Windows) 159 `VZzk3 Uozk/ C/C++ 78 FORTRAN 98 UoM1ePD EUC zk/ COBOL 91 PD(1e)zk/ C/C++ 78 FORTRAN 98 [E] ~xFsTs(BLOB) COBOL 42 FORTRAN 45 REXX 47 [F] 5Xk yw SQLCA 31 Vi Nj 141 {E C/C++ oT^F 79 [G] tk6p IX4A(RR) 121 |B DB2 E"PD 190, 191 9(E> C M C++ }L 149 COBOL &CLr 162 9(D~ 6k= SQL &CLr 146 JOoO LL 193 *zE" 193 }L N}`M 119 CALL od 119 [H] P Z~Nlw =( 121 P3r 122 200 *"6k= SQL &CLr P (x) lw `v 123 9C SQLDA 111 j)9 C/C++ oT 79 q!ms{" API lwms{" 125 $(eD REXX d? 99 [J] lw}] 2, SQL 120 LL JOoO 193 Pm 193 Jb7( 193 pureXML 193 a{zk 31 XO 8>{d? 54 wd? 54 /f XO 54 2, SQL lw}] 120 k/, SQL HO 11 wd? 49, 51 [K] IX4A(RR) XBlw}] 121 )9 UNIX zk(EUC) Uo COBOL &CLr 91 C/C++ &CLr 78 FORTRAN &CLr 98 PD(1e) COBOL &CLr 91 C/C++ &CLr 78 FORTRAN &CLr 98 [L] `}]I1 75 }L 9(D~ 146 4S j8E" 136 4S!n C &CLr 150 P }]`M 4((COBOL) 42 4((C/C++) 34 4((FORTRAN) 45 SQL 52 null 5 null 8>{d? 54 Ygx `_L6k= SQL &CLr 19 [P] dCD~ VisualAge 149 VisualAge C++(AIX) 160 z&mD~ 9(6k= SQL &CLr 146 [Q] 6k= SQL &CLr |,D~ Ev 24 COBOL 27 C/C++ 25 FORTRAN 29 `L 21 `k 8, 181 ?p 181 Lr| 145 f!=8 142 ms 136 Ev 1 /f 136 *"73 8 hF 21 ywZ 2 Z( 9 ^F 14 C/C++ 14 FORTRAN 15 REXX 16 T\ Ev 13 BIND |n REOPT !n 142 od COBOL 4 C/C++ 2 FORTRAN 3 REXX 5 $`k ms 136 CJ`v~qwD&CLr 132 /f 136 w} 201 6k= SQL &CLr (x) 'VDYw53 7 4P/,od 10, 106 4P2,od 10, 106 wd? Ev 49 }C 57 COBOL |,D~ 27 od 4 C/C++ |,D~ 25 ^F 14 od 2 FORTRAN |,D~ 29 ^F 15 od 3 REXX ^F 16 od 5 SQLCA a9 2 XML 5 54 (^ s( 142 [R] Uo)9 UNIX zk(EUC)zk3 COBOL 6k= SQL &CLr 91 C/C++ 6k= SQL &CLr 78 FORTRAN 6k= SQL &CLr 98 [S] OBD `_L DB2 &CLrPDhC j8E" 16 }]b@5X5 19 _L.dDhC 16 &CLr@5X5 19 yw 195 ywZ C M C++6k= SQL &CLr 60 COBOL 6k= SQL &CLr 84 FORTRAN 6k= SQL &CLr 93 1dAG $`kwzID 135 5CLr s( 142 ddcspkgn 142 5CLr API |,D~ COBOL &CLr 27 C/C++ &CLr 25 5CLr API (x) |,D~ (x) FORTRAN &CLr 29 >} /, SQL LrPDN}jG 119 REXX Lr 101 SQL ywZ#e 60 SQL odPD`}]I1 75 }] |B H0lwD}] 123 T2,==4PD SQL &CLr 124 v/H0lwD 121 lw Z~N 121 >} T2,==4PD SQL &CLr 124 a!D 121 }]m> lw Z~N 122 }]YwoT(DML) /, SQL T\ 11 }]a9 C'(eD,(}`v_L 18 }]b CJ `v_L 16 OBD 16 }]`M f]TJb 52 6k= SQL &CLr 3d 34, 52 C/C++ 34, 75, 79 IBM COBOL 162 ;BT jG 135 T null axDV{q= 34 l=B~ 16 l#&mLr Ev 127 &CLr s( 142 9( 6k= SQL 13, 178 &CLr*" vZPm}L 127 6k= SQL Ev 1 COBOL >} 84 &CLrhF #fC'ks 118 N}jG 118 ms&m 32 v/H0lwD}] 121 IdPmod&m 117 hv SELECT od 111 ywc;D SQLVAR 5e 108 }]+] 115 ,{DLr|f> 145 YNlw}] 121 4P;|,d?Dod 10 COBOL |,D~ 27 UoM1ePD EUC "bBn 91 NULL 5 54 REXX 101 SQLDA a95CLr 131 E/w /, SQL 11 2, SQL 11 Nj &m ** 123 SQLDA a9 112 P |B 124 lw 123 >} 124 {F REXX 5 6k= SQL &CLr 120, 123 y>Lr 124 w} 203 Nj (x) &CLrPD`v 123 $`k j>5CLr 131 /, SQL od 10 CJ`v~qw 131 6k= SQL &CLr 131 1dAG 135 (} DB2 Connect CJwz&CLr~qw 131 ;BTjG 135 C/C++ 78 FORTRAN 15 $&mw&\ SQL $`kw 79 $(eDd? SQLISL 99 $(eDd? SQLMSG 99 $(eDd? SQLRDAT 99 $(eDd? SQLRIDA 99 $(eDd? SQLRODA 99 $(eD REXX d? RESULT 99 KP1~q `_LTxfwD0l 16 [Z] {m3r |,D~ COBOL 27 C/C++ 25 FORTRAN 29 8>{d? 62, 183 j6 null SQL 5 54 FORTRAN 99 REXX 104 8>{m COBOL 93 C/C++ 81 PO SIGUSR1 127 PO&mLr C> 127 PD(1e)zk/ COBOL 91 C/C++ 78 FORTRAN 98 wd? 62, 183 S SQL P}C 57 /, SQL 10 XO 54 2, SQL 49 `}]I1 75 |{ COBOL 83 C/C++ 59 FORTRAN 93 REXX 99 wd? (x) 6k= SQL &CLr Ev 49 COBOL 88 C/C++ 71 FORTRAN 96 REXX 102 yw IdPmod 117 6k= SQL &CLrEv 51 COBOL 84 C/C++ 60 db2dclgn ywzIw 51 FORTRAN 93 {m 93 PD(1e)EUC 91 wd? |{ 83 yw 84 yw($V{ 86 yw}V 85 yw{m 81 206 *"6k= SQL &CLr C/C++ oT (x) 8r}]`MD8k 75 PD(1e)EUC "bBn 78 wd? u 58 wa9'V 80 "M 106 FOR BIT DATA 79 LOB (;wyw 73 LOB }]yw 71 SQLCODE d? 62 sqldbchar }]`M 67 SQLSTATE d? 62 VisualAge dCD~(AIX) 160 WCHARTYPE $`kw!n 67 wchar_t }]`M 67 C/C++ PD^(Kc{ 78 D DATE }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 DB2 E"PD f> 189 |B 190, 191 db2bfd |n Ev 137 db2dclgn |n ywwd? 51 DBCLOB }]`M COBOL 42 REXX 47 DBCLOB-FILE COBOL }]`M 42 DBCLOB-LOCATOR COBOL }]`M 42 dbclob_file C/C++ }]`M 34 dbclob_locator C/C++ }]`M 34 ddcs400.lst D~ 142 ddcsmvs.lst D~ 142 ddcsvm.lst D~ 142 ddcsvse.lst D~ 142 DDL od /, SQL T\ 11 DECIMAL }]`M *; COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 DECLARE od odfr 49 COBOL ywZ 84 C/C++ ywZ 60 FORTRAN ywZ 93, 94 DESCRIBE od &mNbod 116 DOUBLE }]`M C/C++ Lr 34 DYNAMICRULES $`k/s(!n T/, SQL D0l 137 E EXEC SQL INCLUDE SQLCA od 18 EXECUTE od Ev 10 EXECUTE IMMEDIATE od Ev 10 F FETCH od X4D}]CJ 121 wd? 108 SQLDA a9 111 FIPS 127-2 j< + SQLSTATE M SQLCODE yw*wd? 127 FLOAT }]`M COBOL 42 C/C++ *; 34 FORTRAN 45 REXX 47 FOR BIT DATA }]`M 79 FOR UPDATE Sd j8E" 124 FORTRAN oT |,D~ 29 `L 15 `VZV{/ 98 ,S=}]b 33 6k SQL od 3 Uo 98 }]`M 45 }Vwd? 95 D~}Cyw 98 ^F 93 &CLr dvD~ 21 dkD~ 21 wd? 93 8>{d? 99 PD(1e) 98 wd? |{ 93 w} 207 FORTRAN oT (x) wd? (x) yw 93 }C 3 "M 106 LOB (;wyw 97 LOB }]yw 96 SQL ywZ>} 94 SQLCODE d? 94 SQLSTATE d? 94 G GRAPHIC }]`M !q 67 COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 H HP-UX `kw!n C &CLr 150 C++ &CLr 151 Micro Focus COBOL &CLr 164 4S!n C &CLr 150 C++ &CLr 151 Micro Focus COBOL &CLr 164 I INCLUDE od +}E CONNECT od BIND |n STATICASDYNAMIC !n 183 INCLUDE SQLCA od yw SQLCA a9 31 INCLUDE SQLDA od 4( SQLDA a9 112 INTEGER }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 INTEGER*2 FORTRAN }]`M 45 INTEGER*4 FORTRAN }]`M 45 L LANGLEVEL $`k!n MIA 34 SAA1 34 SQL92E 62, 85, 94 libdb2.so b ^F 181 Linux b libaio.so.2 181 C &CLr 153 C++ &CLr 154 Micro Focus COBOL dC`kw 169 &CLr 165 LOB }]`M C/C++ PD}]yw 71 long C/C++ }]`M 34 long int C/C++ }]`M 34 long long C/C++ }]`M 34 long long int C/C++ }]`M 34 LONG VARCHAR }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 LONG VARGRAPHIC }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 M MIA LANGLEVEL $`k!n 34 N NULL SQL 5 8>{d? 54 null U9{ 34 NULLID 142 NUMERIC }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 O Object REXX for Windows &CLr 9( 177 208 *"6k= SQL &CLr P PRECOMPILE |n 6k= SQL &CLr S|nP9( 178 CJ`v}]b~qw 132 Ev 129 C/C++ 178 PREPARE od Ev 10 Nbod&m 116 Q queryopt $`k/s(!n zk3"bBn 140 R REAL SQL }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 REAL*2 FORTRAN SQL }]`M 45 REAL*4 FORTRAN SQL }]`M 45 REAL*8 FORTRAN SQL }]`M 45 REDEFINES Sd COBOL 90 REXX s(D~ DB2ARXCS.BND 176 REXX oT s(D~ 176 u{d? 104 wd? |{ 99 }C 99 "a}L 101 "M 106 API SQLDB2 16 SQLDBS 16 REXX oT (x) API (x) SQLEXEC 16 LOB (;wyw 103 LOB }] 102 LOB D~}Cyw 103 LOB wd? 104 SQL od 5 SQLDB2 API 101 SQLDBS API 101 SQLEXEC API 101 Windows &CLr 177 REXX PDD~}Cyw 103 RUNSTATS |n U/3FE" 13 S SAA1 LANGLEVEL $`k!n 34 SELECT od |BQlwD}] 123 lw `P 123 }],YN 121 IdPm 117 yw SQLDA 108 ZVd SQLDA .shv 111 EXECUTE od 10 SET CURRENT PACKAGESET od 133, 146 short }]`M C/C++ 34 short int }]`M 34 SIGUSR1 PO 127 SMALLINT }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 Solaris Yw53 C &CLr 155 C++ &CLr 156 Micro Focus COBOL &CLr 164 SQL |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 Z( 6k= SQL 9 SQL }]`M 6k= SQL &CLr Ev 52 COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 w} 209 SQL od oz T> 189 #fnUC'ks 118 /, SQL 1, 9 +4PrP/ 16 2, SQL 1, 9 9Cn!D SQLDA a94xP<8 109 EE&mLr 127 l#&mLr 127 PO&mLr 127 COBOL o( 4 C/C++ o( 2 FORTRAN o( 3 INCLUDE 31 REXX o( 5 SQL1252A |,D~ COBOL &CLr 27 FORTRAN &CLr 29 SQL1252B |,D~ COBOL &CLr 27 FORTRAN &CLr 29 SQLADEF |,D~ 25 SQLAPREP |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLCA |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 `v(e 32 `_L"bBn 18 Ev 127 /f 54 yw 31 *s 127 $(eDd? 99 SQLCODE VN 127 SQLSTATE VN 127 SQLWARN1 VN 54 SQLCA_92 |,D~ COBOL &CLr 27 FORTRAN &CLr 29 SQLCA_92 a9 29 SQLCA_CN |,D~ 29 SQLCA_CS |,D~ 29 SQLCHAR a9 +]}] 115 SQLCLI |,D~ 25 SQLCLI1 |,D~ 25 SQLCODE |( SQLCA 31 mszk 31 a9 127 SQLCODE (x) SQLCA PDVN 127 SQLCODES |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLDA |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 +]}] 115 4( 112 `_L"bBn 18 +PXQ<8DodDE"Ek 10 7(Nbod`M 117 yw 108 ywc;D SQLVAR 5e 110 9Cn!Da94<8od 109 k PREPARE odDX* 10 SQLDACT |,D~ 29 SQLDB2 API * REXX "a 101 sqldbchar }]`M H,DP`M 34 !q 67 SQLDBS API 101 SQLE819A |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLE819B |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLE850A |,D~ COBOL &CLr 27 FORTRAN &CLr 29 SQLE850B |,D~ COBOL &CLr 27 FORTRAN &CLr 29 SQLE859A |,D~ 25 SQLE859B |,D~ 25 SQLE932A |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLE932B |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 sqleAttachToCtx API 9C`vOBD 16 SQLEAU |,D~ COBOL &CLr 27 C/C++ &CLr 25 210 *"6k= SQL &CLr SQLEAU |,D~ (x) FORTRAN &CLr 29 sqleBeginCtx API 9C`vOBD 16 sqleDetachFromCtx API 9C`vOBD 16 sqleEndCtx API 9C`vOBD 16 sqleGetCurrentCtx API 9C`vOBD 16 sqleInterruptCtx API 9C`vOBD 16 SQLENV |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 sqleSetTypeCtx API 9C`vOBD 16 SQLETSD |,D~ 27 SQLException 6k= SQL &CLr 125 SQLEXEC REXX API &m SQL od 5 6k= SQL 16 "a 101 SQLEXT |,D~ 25 sqlint64 C/C++ }]`M 34 SQLJ 9(D~ 146 SQLJACB |,D~ 25 SQLMON |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLMONCT |,D~ 27 SQLSTATE |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 VN 127 SQLSYSTM |,D~ 25 SQLUDF |,D~ C/C++ &CLr 25 SQLUTBCQ |,D~ 27 SQLUTBSQ |,D~ 27 SQLUTIL |,D~ COBOL &CLr 27 C/C++ &CLr 25 FORTRAN &CLr 29 SQLUV |,D~ 25 SQLUVEND |,D~ 25 SQLVAR 5e ywc;D}? 108, 110 SQLWARN a9 127 SQLXA |,D~ 25 SQL_WCHART_CONVERT $&mwj 67 T TIME }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 TIMESTAMP }]`M COBOL 42 C/C++ 34 FORTRAN 45 REXX 47 U UNIX C &CLr 9( 158 Micro Focus COBOL &CLr 173 V VARBINARY }]`M 6k= SQL &CLr 77 VARBINARY wd? 77 VARCHAR }]`M *;= C/C++ 34 COBOL 42 C/C++ j8E" 34 FOR BIT DATA f; 79 FORTRAN 45 REXX 47 VARGRAPHIC }]`M COBOL 42 C/C++ *; 34 FORTRAN 45 REXX 47 Visual Basic .NET z&mD~ 146 W WCHARTYPE $`kw!n ITk NOCONVERT M CONVERT !ndO9CD}]` M 34 j8E" 67 wchar_t }]`M C/C++ 6k= SQL &CLr 67 WHENEVER od ms&m 32 w} 211 Windows COBOL &CLr `kw!n 166 9( 174 4S!n 166 C/C++ &CLr `kw!n 157 9( 159 4S!n 157 Micro Focus COBOL &CLr `kw!n 166 9( 175 4S!n 166 X XML yw 6k= SQL &CLr 53 COBOL &CLr 105 C/C++ &CLr 4P XQuery mo= 105 XMLQUERY /} 16 XQuery mo= 16, 105 XML `k Ev 53 XML }]lw C &CLr 57 COBOL &CLr 57 XML }]`M 6k= SQL &CLrPDwd? 53 Z SQLDA Pj6 54 XQuery od Z6k= SQL &CLrPywwd? 53 [XpV{] .NET z&mD~ 146 212 *"6k= SQL &CLr  Printed in China S151-1763-00 Spine information: IBM DB2 10.1 for Linux, UNIX, and Windows *"6k= SQL &CLr 

还剩220页未读

继续阅读

下载pdf到电脑,查找使用更方便

pdf的实际排版效果,会与网站的显示效果略有不同!!

需要 10 金币 [ 分享pdf获得金币 ] 0 人已下载

下载pdf

pdf贡献者

yulewo123

贡献于2016-11-06

下载需要 10 金币 [金币充值 ]
亲,您也可以通过 分享原创pdf 来获得金币奖励!