DB2

Published on October 2021 | Categories: Documents | Downloads: 2 | Comments: 0 | Views: 64
of 39
Download PDF   Embed   Report

Comments

Content

 

Overview:IMS DB Interview ,Mainframe IMS Interview Questions,IMS Interview Overview:IMS Questions asked in top companies What is the physical nature of a dataase called! Is it necessary that all the se"ments in a DI#i dataase have key $elds! %ow man key $led and search $elds can a se"ment have! h ave! Is it necessary that the key $eld in a DI#I dataase e uni&ue! What is a key $eld in an IMS dataase! What is a dataase record! What is a hierarchy path! What is a 'oot! What are (wins (wins De$ne the terms )arent )arent and *hild+ What is the limitation on the no+ of levels in a D#I dataase ! %ow many se"ment types can you have in a D#I dataase! What is a Se"ment type! What is a Se"ment! What is %ierarchy *hart! What are the control lock in IMS! Which is the $rst statement in *OBO-IMS pro"rams! What is the return code you "et after a successful IMS call! What is IMAGECOPY? – When do you use the IMAGECOPY? – – What is COPY PENDING status?

 

What is CHECK PENDING? What is QUIESCE? What is a !uste"in# inde$? Ho% &any !uste"in# inde$es an 'e de(ned )o" a ta'!e? What is the di*e"ene 'et%een +"i&a"y ,ey and uni-ue inde$? What is s-!ode ./00 ? What is s-!ode .122? What does the s-!ode o) .121 +e"tain to? – A"e 3ie%s u+datea'!e? What is dyna&i SQ4? –– When is the aess +ath dete"&ined )o" dyna&i SQ4? – Su++ose I ha3e a +"o#"a& %hih uses a dyna&i SQ4 and it has 'een +e")o"&in# %e!! ti!! no%55 O* !ate6 I (nd that the +e")o"&ane has dete"io"ated5 What no% ha++ened? –– I) I ha3e a 3ie% %hih is a 7oin o) t%o o" &o"e ta'!es6 an this 3ie% 'e u+datea'!e? What a"e si&+!e6 se#&ented and +a"titioned ta'!e s+aes ? What is (!te" )ato"? Whe"e is the out+ut o) E8P4AIN sto"ed What do you need to do 'e)o"e you do E8P4AIN? What a"e the 9 en3i"on&ents %hih an aess D:0? What is an inne" 7oin6 and an oute" 7oin? What is ;<EEPAGE and PC=;<EE in =A:4ESPACE "eation?

 

What is E8P4AIN What is inde$ a"dina!ity? – What is a synony&? What is the di*e"ene 'et%een SYNONYM and A4IAS? What do you &ean 'y NO= NU44 WI=H DE;AU4=? When %i!! you use it? What do you &ean 'y NO= NU44? When %i!! you use it? When %ou!d you +"e)e" to use >A<CHA<? >A<CHA<? What a"e the ontents o) a DC4GEN? What is DC4GEN? What a"e the disad3anta#es o) usin# >A<CHA<? >A<CHA<? Ho% do I "eate a ta'!e MANAGE<  EMP@6 MANAGE< %he"e MANAGE< is a )o"ei#n ,ey %hih "e)e"enes to EMP@ in the sa&e ta'!e? Gi3e the e$at DD45 What is auditin#? Ho% do you onatenate the ;I<S=NAME and 4AS=NAME Ho% do you "ead >SAM (!e? What is a NU44 3a!ue? What a"e the +"os and ons o) usin# NU44S? Ho% to in"ease ta'!e s+ae in D:0? Can you use MA8 on a CHA< o!u&n What does WI=H HO4D o+tion do? What is UNION6 UNION A44 What is the use o) >A4UE )untion ? Ho% do you (nd the &a$i&u& 3a!ue in a o!u&n?

 

What a"e a##"e#ate )untions? At %hat sta#e D:0 &ust 'e u+? What tehni-ues a"e used to "et"ie3e data )"o& &o"e than one ta'!e in a sin#!e SQ4 state&ent? Ho% do you se!et a "o% usin# inde$es? Ho% do you e!i&inate du+!iate 3a!ues in SE4EC= What is a synony&? Ho% is it used? What is a +"eo&+i!e? Ho% do %e un!oad the D:0 ta'!es usin# BC4? Ho% to "ead !ast "eo"d in >SAM (!e56 I dont ,no% ho% &any "eo"ds a"e the"e? What is a !uste"ed inde$? What is dynamic SQL What is the difference between CS and RR isolation levels? Where do you specify them? What are the various locking levels available? How does !" determine what lock#si$e to use? What is lock escalation? What are the " s%lcodes that are returned? What is a collection? What are the advantages of using a &'C(')*? What are &'C(')*S? &'C(')*S?

 

What are the various locks available? Can + use L,C( -'!L* on a view? What is 'L-*R? What is a !R./ &L'0? What is 'CQ1+R*2R*L*'S* in !+0? What is 'CQ1+R*2R*L*'S* in !+0 What is a !R./ &L'0? What is 'L-*R? Can + use L,C( -'!L* on a view? What are the various locks available? What is lock escalation? What are the disadvantages of &')* level lock? How does !" determine what lock#si$e to use? What are the various locking levels available? When do you specify the isolation level? What else is there in the &L'0 apart from the access path? 3  What happens to the &L'0 if inde4 used by it is dropped? What are &'C(')*S? &'C(')*S? 3  What are the advantages of using a &'C(')*? What is a collection?

 

How do you do the *5&L'+0 of a dynamic SQL statement? How do you simulate the *5&L'+0 of an embedded SQL statement in S&16+2Q.6? )ive an e4ample with a host variable in WH*R* clause78 What are the isolation levels possible? What are the " s%lcodes that are returned? 3  How would you print the output of an SQL statement from S&16+? 3  Lot of updates has been done on a table due to which inde4es have gone haywire7 What do you do? 3  How does !" store 01LL physically? How do you retrieve the data from a nullable column? 3  What is the picture clause of the null indicator variable? 3  What does it mean if the null indicator has #9/ :/ #"? 3  How do you insert a record with a nullable column? What is R10S-'-S? When will you chose to run R10S-'-S? )ive some e4ample of statistics collected during R10S-'-S? What is R*,R)? When is it used?

a#sMain)"a&e D:0 <ea!ti&e Inte"3ie% Questions6D:0 Q uestions6D:0 Inte"3ie% Questions6Main)"a&e <ea!ti&e Inte"3ie% Questions5 Can you dis+!ay the inde$? At %hat sta#e d'0 &ust 'e u+? When do you use su'"outines?

 

What is inde$ a"dina!ity? What is (!te" )ato"? What is an inne" 7oin6 and an oute" 7oin What a"e the 9 en3i"on&ents %hih an aess D:0 A"e 3ie%s u+datea'!e %hat is s-!ode .122 What is s-!ode ./00 What is the di*e"ene 'et%een +"i&a"y ,ey  uni-ue ,ey What is the "esu!t o) this -ue"y i) no "o%s a"e se!eted? Why SE4EC= F is not +"e)e""ed in e&'edded SQ4 +"o#"a&s? What a"e o""e!ated su' -ue"ies? What is a u"so"? Why shou!d it 'e used? – What is a !uste"in# inde$? What is QUIESCE? What is CHECK PENDING? What is COPY PENDING status What is IMAGECOPY? What is <EO<G? When is it used? Ho% %ou!d you "et"ie3e "o%s )"o& a D:0 ta'!e in e&'edded SQ4? – Ho% do you s+ei)y and use a u"so" in a CO:O4 +"o#"a&? – What ha++ens %hen you say OPEN CU<SO<? Is DEC4A<E CU<SO< e$euta'!e? Can you ha3e &o"e than one u"so" o+en at any one ti&e in a +"o#"a&? –

 

When you COMMI=6 is the u"so" !osed? When %i!! you hose to "un <UNS=A=S What is <UNS=A=S? Ho% do you inse"t a "eo"d %ith a nu!!a'!e o!u&n? Ho% do you !ea3e the u"so" o+en a)te" issuin# a COMMI=? A >A<CHA< >A<CHA< o!u&n <EMA<KS %ou!d 'e de(ned as )o!!o%s What is the +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es? What is the CO:O4 +itu"e !ause o) the )o!!o%in# D:0 data ty+es? What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? What is DC4GEN? What a"e the ontents o) a DC4GEN? Is it &andato"y to use DC4GEN? I) not6 %hy %ou!d you use it at a!!? Is DEC4A<E =A:4E in DC4GEN neessa"y? Why it used? Wi!! +"eo&+i!ed o) an D:0.CO:O4 +"o#"a& 'o&'6 i) D:0 is do%n? Ho% is a ty+ia! D:0 'ath +#& e$euted? Na&e so&e (e!ds )"o& SQ4CA5 Ho% an you -ui,!y (nd out the @ o) "o%s u+dated a)te" an u+date state&ent? What is E8P4AIN? What do you need to do 'e)o"e you do E8P4AIN? Whe"e the out+ut o) is E8P4AIN sto"ed? –

 

E8P4AIN has out+ut %ith MA=CHCO4S  5 What does it &ean? – .+ 4oadin# o) D:0 Un!oad %ith +a,ed Dei&a!J data to O"a!e en3i"on&ent 05 4oadin# o) Co'o! Data st"ea&s %ith HE8 Cha"ate" data to O"a!e en3i"on&ent A"e the"e any too!s6 &ehanis&s in O"a!e o" any othe" thi"d +a"ty +"odut? 05 Ho% &any o!u&ns &a$i&u& an 'e "eated in a ta'!e o) a inne" ta'!e o) the su'-ue""y 5 When do %e need a CO44EC=ION? 95 What is the "o!! o) INDE8 in a -ue"y? L5 What is sto"ed in ta'!es unde" "eato" SYSI:M?

5 ;i!e ontains L "eo"ds say D6E6;6C6A . Ho% to o+y D and A "eo"ds on!y 'y usin# (!e.aid? 5 Ho% to !oad data to a ta'!e? 15 A dataset ontains 2 "eo"ds6 Ho% do you '"o%se +a"tiu!a" "eo"d usin# (!e.id? /5 What is di*e"ene 'et%een QM;  S+oo(? 25 Des"i'e the e!e&ents o) the SE4EC= -ue"y synta$5 SE4EC= e!e&ent ;<OM ta'!e WHE<E onditiona! state&ent5 225 When you %i!! use u"se" %ith ho!d o+tion? 205 Ho% to see the status o) the ta'!e? 25 Can you see s/9o&+ data? 295 Ho% to ,no% othe" +e"son 7o' status? 2L5 Ho% &any !uste"in# inde$es a"e +asin# )o" a ta'!e? 25 Ho% to "ead !ast "eo"d in 3sa& (!e %hen the nu&'e" o) "eo"ds is not ,no%n?

 

25 What is !o% 3a!ues and hi#h 3a!ues? 215 What is an intent !o,? 2/5 What is the inde$6 ty+es o) inde$? 05 Can you dis+!ay the inde$? /+ uestion %hat a"e the &a$5  &in5 no5 o) +a"titions a!!o%ed in a +a"tition ta'!es+ae? Ans%e" minimum Ans%e"  minimum is 0+ma1imum is 20+ Question %hat is the &a$i&u& nu&'e" o) ta'!es that an 'e  7oined ? Ans%e" $fteen Ans%e"  $fteen Question What tehni-ue is used to "et"ie3e data )"o& &o"e than one ta'!e in a sin#!e SQ4 state&ent? Ans%e" (he Ans%e"  (he 3oin statement comines data from more that two tales

Question What is a )o"ei#n ,ey? Ans%e" It Ans%e"  It identi$es a releated row in another tale and estalishes a lo"ical relationship etween rows in two tales+ Question E$+!ain the use o) the WHE<E !ause5 Ans%e" It Ans%e"  It directs DB/ to e1tract data from rows where the value of the column is the same as the current value of the host variale+ Ho% %ou!d you (nd out the tota! nu&'e" o) "o%s in a ta'!e? 4se S55*( *O46(789 Ho% do you e!i&inate du+!iate 3a!ues in SE4EC=? 4se S55*( DIS(I6*( Ho% do you se!et a "o% usin# inde$es? Specify the inde1ed inde1ed columns in the W%5'5 clause What a"e a##"e#ate )untions? Built-in mathematical functions for use in S55*( clause Ho% do you (nd the &a$i&u& 3a!ue in a o!u&n? 4se S55*( M;7

 

Can you use MA8 on a CHA< o!u&n?  <5S My SQ4 state&ent SE4EC= A>GSA4A< A>GSA4A<Y Y ;<OM EMP yie!ds inau"ate "esu!ts Why? Because S'< is not declared to have 64s and the employees for whom the salary is not known are also counted Ho% do you "et"ie3e the ("st L ha"ate"s o) ;I<S=NAME o!u&n o) EMP ta'!e? S55*( S4BS('7=I'S(6M5,.,>9 ='OM 5M)? Ho% do you onatenate the ;I<S=NAME and 4AS=NAME )"o& EMP ta'!e to #i3e a o&+!ete na&e? S55*( =I'S(6M5 @ A S(6M5 ='OM 5M)? What is the use o) >A4UE )untion? void vo id -ve SQ *OD5 y handlin" nulls and eroes in computations Sustitute a numeric value for any nulls used in computation What is UNION6UNION A44? 46IO6 : eliminates duplicates 46IO6 : retains duplicates Both these are used to comine the results of diCerent S55*( statements Su++ose I ha3e (3e SQ4 SE4EC= state&ents onneted 'y UNIONUNION A446 ho% &any ti&es shou!d I s+ei)y UNION to e!i&inate the du+!iate "o%s? Once What is the "est"ition on usin# UNION in e&'edded SQ4? It has to e in a *4'SO' In the WHE<E !ause %hat is :E=WEEN and IN? B5(W556 supplies a ran"e of values while I6 supplies a list of values Is :E=WEEN in!usi3e o) the "an#e 3a!ues s+ei(ed?  <es  <es What is 4IKE used )o" in WHE<E !ause?What a"e the %i!da"d ha"ate"s? I5 is used for partial strin" matches @E@ 7 for a strin" of any character 9 and @F@ 7for any sin"le character 9 are the two wild card characters When do you use a 4IKE state&ent?

 

 (o  (o do partial search search e" to search employee employee y name, you need not specify specify the complete name? usin" I5, you can search for partial strin" matches What is the &eanin# o) unde"so"e    in the 4IKE state&ent? Match for any sin"le character What do you ao&+!ish 'y G<OUP :Y HA>ING !ause? G'O4) B< partitions the selected rows on the distinct values of the column on which you "roup y %HI6G selects G'O4)s which match the criteria speci$ed+ *onsider the employee tale with column )'O35*( nullale %ow can you "et a ist of employees who are not assi"ned to any proect! S55*( 5M)6O ='OM 5M) W%5'5 )'O35*( IS 64? What is the result of this uery if no rows are selected: S55*( S4M7S'<9 ='OM 5M) W%5'5 4J@MS*@? 64 Why SE4EC= F is not +"e)e""ed in e&'edded SQ4 +"o#"a&s? =or three reasons: If the tale structure is chan"ed 7 a $eld is added 9, the pro"ram will have to e modi$ed )ro"ram mi"ht retrieve the columns which it mi"ht not use, leadin" on I#O over head (he chance of an inde1 only scan is lost What a"e o""e!ated su' -ue"ies?  su-&uery in which the inner 7 nested 9 &uery refers ack to the tale in the outer &uery *orrelated Su &ueries must e evaluated for each &uali$ed row of the outer &uery that is referred to+ What is a CU<SO<? why should it e used! *ursor is a pro"rammin" device that allows the S55*( to $nd a set of 'ows ut return them one at a time *ursor should e used ecause the host lan"ua"e can deal with only one row at a time K+ Main)"a&e D:0 ;"e-uent!y As,ed Inte"3ie% Questions and Ans%e"sPa"t  Question What is E8P4AIN in D:0 A 5;)I6 A 5;)I6 is used to detail the access paths chosen y DB/ optimier for SQ statement+ (his command is used to monitor the performance of SQ statement used in a pro"ram+ nswer: BI6D mainly performs two thin"s synta1 checkin" and authoriation checkin"+It inds to"ether all packa"es into an application plan hence the name BI6D+part from this ind has optimiser as a sucomponent+Its function is to determine the optimum access strate"y+ strate"y+ Question MA85 NO O; <OWS PE< PAGE

 

Ans%e" ./L Ans%e"  ./L Question =he on!y +!ae o) >SAM KSDS in D:0 is? Ans%e" BSDS Ans%e"  BSDS is a HSM SDS+ Question CAN A44 USE<S HA>E =HE P<I>I4AGE =O USE =HE SQ4 S=A=EMEN= SE4EC= F DM4? Ans%e" 6O Ans%e"  6O (%5 4S5' S%O4D B5 G'6(5D )'IHIG5 (O 4S5 I(+ Question What is the sie o) a data +a#e? Ans%e" 0 Ans%e"  0 to   Question %hats the 'est !o,sie that you ou!d use %hen you "eate a ta'!es+ae? Ans%e" (he Ans%e"  (he answer is ocksie J 6<+4nless you are Sure what@s the )urpose of talespace ie+,'ead-only or '#W+If '#W+If you use lock sie Jany, D/ would automatically determine what type of locks it should use+ Question %hats the e""o" ode )o" Uni-ue Inde$ >oi!ation Ans%e" -NK Ans%e"  -NK Question %hats the +e"enta#e )"ee s+ae )o" Ans%e" 5'O Ans%e"  5'O Question Can you de(ne an Inde$ i) the ta'!e sie !ess than 2 PAGES? Ans%e" the Ans%e"  the nswer is : 6O Question Whats the Ma$i&u& 4en#th o) SQ4CA and %hats the ontent o) SQ4CA:C? Ans%e" (he Ans%e"  (he Ma1 len"th is .K2+ and the SQ*B* has the Halue of SQ*+ Question Can you de(ne an Inde$ i) the ta'!e sie !ess than 2 PAGES? Ans%e" (he Ans%e"  (he answer is Question %hats the +e"enta#e )"ee s+ae )o" Ans%e" (he Ans%e"  (he answer is 5'O+ Question Whats the &a$i&u& nu&'e" o) 3o!u&es that an 'e added to a S=OG<OUP? Ans%e" (he Ans%e"  (he answer is .KK+ 4sually 4 sually it will e diPcult monitor more than K or 0 volumes to a Sto"roup+

 

Question Whats the &a$i&u& nu&'e" o) ha"ate"s that a ta'!ena&e an ha3e? Ans%e" (he Ans%e"  (he answer is . characters+ Question What is the &eanin# o) .1L s-! "etu"n ode? Ans%e" )ro"ram Ans%e"  )ro"ram name not in plan+ Bind the plan and include the DB'M for the pro"ram named as part of the plan+ Question What is the use o) DSND: ? Ans%e" (his Ans%e"  (his is the area where sortin" takes place in DB/ Question %hen does the s-! state&ent #ets e$euted %hen you use u"so" in the a++!iation +"o#"a&&in# ? Ans%e" s&l Ans%e"  s&l statement "ets e1ecuted when we open cursor Question What does CU<<EN=DA=A o+tion in 'ind indiate Ans%e" *4''56(D( Ans%e"  *4''56(D( option ensures lock fetch while selectin" rows from a tale+ In DB/H0 the default has een chan"ed to 6O+ (herefor (herefore e it is necessary to chan"e all the ind cards with *4''56(D *4''56(D( (7<5S9 which is default in DB/HK  earlier to *4''56(D(76O9+ Question What is the di*e"ene 'et%een =YPE 2 inde$  =YPE 0 inde$ Ans%e" (<)5 Ans%e"  (<)5 .  (<)5 / are speci$ed when an inde1 is created on the tale+ (<)5 / inde1 is the option which comes with DB/H0+ With (<)5 / inde1 data can e retreived faster as only the data pa"es are locked and not the inde1 pa"es+ %ence (<)5 / inde1 is recommended+ Question What a"e the !e3e!s o) iso!ation a3ai!a'!e %ith D:0>9 Ans%e" *S Ans%e"  *S '' 4'7 added new for DB/H0 which stands for uncommited read which allows to retreive records from the space which has e1clusive locks also ut data inte"rity will e aCected if this option is used 9 (he est availale option for data inte"rity  data concurrency is *S+ Question Ho% do you ahie3e "eo"d !o,in# in D:0 in the 3e"sions %hih do not su++o"t "eo"d !e3e! !o,in#? Ans%e" <@day Ans%e"  <@day I had posted this &ue+ (he answer shud hv read as follows: By havin" the record len"th more than half of the pa"e sie R Sorry a"ain   (han1 Question Ho% do u ahie3e "eo"d !e3e! !o,in# in D:0 3e"sions %hen "eo"d !e3e! !o,in# is not a!!o%ed? Ans%e" By Ans%e"  By havin" the len"th of the record "reater than that of a pa"eR Question In a D:0.CICS +"o#"a& %hih is ats as o.o"dinato" and

 

%hih is +a"tii+ant? Ans%e" DB/ Ans%e"  DB/ - participant *I*S- coordinator Question Ho% to de(ne the dataite&s to "eei3e the )eth ite&s )o" the SQ4? Ans%e" 4sin" Ans%e"  4sin" the DS5*(, followed y lines of - @dataitems DS datatype@+ Question <eHo% %i!! you de!ete du+!iate "eo"ds )"o& a ta'!e? Ans%e" Delete Ans%e"  Delete =r =rom om (ale.Whe (ale.Where re Id In 7Select 7 Select Id =rom (ael. (ael. s  s (emp (emp Group By Id %avin" *ount789 .9 Question What is the di*e"ene 'et%een Whe"e and Ha3in# C!ause Ans%e" W%5'5 Ans%e"  W%5'5 is for 'ows and %HI6G is for Groups Question Ho% to see the st"utu"e o) d'0 ta'!e?? Ans%e" 4sin" Ans%e"  4sin" QM= Question Ho% do you de!a"e a host 3a"ia'!e in CO:O4 )o" an att"i'ute na&ed EMP.NAME o) ty+e >A<CHA<0L ? Ans%e" N. Ans%e"  N. 5M)-G')+ 0T 5-56 )I* ST709 *OM)+ 0T 5-6M5 )I* ;7/>9+ Question What is the &a$i&u& nu&'e" o) ta'!es that an 'e sto"ed on a Pa"titioned =a'!e S+ae ? Ans%e" O65 Ans%e"  O65 Question Na&e the di*e"ent ty+es o) =a'!e s+aes5 Ans%e" .+ Ans%e"  .+ Simple (ale Space/+ Se"mented (ale Space andK+ )artitioned  (ale  (ale Space Main)"a&e D:0 ;"e-uent!y As,ed Inte"3ie% Questions and Ans%e"sPa"t 2 What is an intent !o,? n intent lock is at the th e tale level for a se"mented tale space or at the tale space level for a non se"mented tale space (hey indicate at the tale or tale space level the kinds of locks at lower levels+ What is the di*e"ene 'et%een Stati and Dyna&i SQ4? Static SQ is hard-coded in a pro"ram when the pro"rammer knows the statements to e e1ecuted =or dynamic SQ the pro"ram must dynamically allocate memory to receive the &uery results+ What is u"so" sta'i!ity? *ursor staility means that DB/ takes a lock on the pa"e the cursor is accessin" and releases the lock when the cursor moves to another pa"e+

 

What is the si#ni(ane o) the CU<SO< WI=H HO4D !ause in a u"so" de!a"ation?  (he clause avoids closin" closin" the cursor and repositionin" repositionin" it to the last row row processed when the cursor is reopened+ What is the SQ4 Co&&uniations A"ea and %hat a"e so&e o) its ,ey (e!ds? It is a data structure that must e included in any h host-lan"ua"e ost-lan"ua"e pro"ram usin" SQ It is used to pass feedack aout the SQ operations to the pro"ram =ields ar are e return codes, error messa"es, %andlin" codes and warnin"s+ What is the +u"+ose o) the WHENE>E< state&ent?  (he W%565H5' statement is coded once in the host pro"ram tto o control pro"ram pro"ram actions dependin" on the SQ-*OD5 returned y each SQ statement within the pro"ram+ What is DC4GEN?  D*G56 stands for declarations "enerator? it is a facility to "enerate DB/ SQ data structures in *OBO or )#. pro"rams+ What is the ;<EE o&&and?  (he ='55 command can e used to delete plans and#or pa packa"es cka"es no lon"er 6eeded+ 6eeded+ D:0 an i&+!e&ent a 7oin in th"ee %ays usin# a &e"#e 7oin6 a nested 7oin o" a hy'"id 7oin E$+!ain the di*e"enes5  mer"e oin re&uires that the tales ein" oined e in a se&uence? the rows are retrieved with a hi"h cluster ratio inde1 or are sorted y DB/  nested oin does not re&uire a se&uence and works est on oinin" a small numer of rows DB/ reads the outer tale values and each time scans the inner tale for matches (he hyrid oin is a nested oin that re&uires the outer tale e in se&uence+ Co&+a"e a su' se!et to a 7oin5 ny su select can e rewritten as a oin, ut not vice versa 3oins are usually more ePcient as oin rows can e returned immediately, su selects re&uire a temporary work area for inner selects results while processin" the outer select+ What is the di*e"ene 'et%een IN su' se!ets and E8IS=S su' se!et? If there is an inde1 on the attriutes tested an I6 is more ePcient since DB/ u uses ses the inde1 for the I6 7I6 for inde1 is the mnemonic9+ What is a Ca"tesian +"odut?  *artesian product results from a faulty &uery It is a row in the results for every comination in the oin tales+

 

What is the di*e"ene 'et%een a +a,a#e and a +!an? %ow does one ind / versions of a *I*S transaction with the same module name in two diCerent *I*S re"ions that share the same DB/ susystem! )acka"e )ack a"e and plan are usually used synonymously as in this site Both contain optimied code for SQ statements - a packa"e for a sin"le pro"ram, module or suroutine contained in the data ase re&uest module 7DB'M9 lirary  plan may contain multiple packa"es and pointers to packa"es (he one *I*S module would then e1ist in a packa"e that could e referenced in two diCerent plans+ What is an asyh"onous %"ite? It is a write to disk that may occur efore or lon" after a commit (he write is controlled y the uCer mana"er+ What is a !o,?  lock is the mechanism that controls access to data pa"es and tale spaces+ What is &eant 'y iso!ation !e3e!?  (his is a key concept for any relational relational dataase Isol Isolation ation level is the manner in which locks are applied and released durin" a transaction =or DB/ a @repeatale read@ holds all locks until un til the (ransaction (ransaction completes or a sync point is issued+ =or transactions usin" @cursor staility@ the pa"e lock releases are issued as the cursor @moves@, ie as the transaction releases address aility to the records+ Main)"a&e D:0 ;"e-uent!y As,ed Inte"3ie% Questions and Ans%e"sPa"t 2 Q What is BOIN and %hat a"e the di*e"ent ty+es o) BOIN5 A (he A (he aility to oin rows and comine data from two or more tales is one of the most powerful features of relational system+ (here are three type of oins:.+ 5&ui oin? /+6on-e&uioin? K+self-o K+self-oin in Q Whih is the &ost %ide!y used 'ath +e")o"&ane &onito" )o" D:0? A DB/)M A DB/)M Q Can I a!te" a ta'!e !i,e addin# a o!u&n %hen othe" use" is se!etin# so&e o!u&ns o" u+datin# so&e o!u&ns )"o& the sa&e ta'!e? A < A <es+ es+ It is possile until the updatin" or selection is committed, DB/ tale will not e restructured+ 6ew column de$nition will e there ut it will not e included until all the tasks on the tale are committed+ Q Ho% &any su'-ue"ies an you o&'ine to#ethe" ? A (otal A (otal .2 &ueries and su&ueries are .> Q What a"e the di*e"ent &ethods o) aessin# D:0 )"o& =SO? Ho% is the onnetion esta'!ished 'et%een =SO  D:0? A

 

 (here are three three ways in estalishin" (SO#DB/ connection .+ S)4=I S)4=I /+ QM= K+ *(OG HISIBII(<?  thread etween (SO  DB/ is estalished while attemptin" to make connection etween (SO  DB/+ Q Ho% &any 'u*e" 'oo!s a"e a3ai!a'!e in D:0? A ( A (en en K/ sie uCerpools and $fty 0 sie uCer pools 7B)N to B)0T9+ Default uCer pools are B)N, B)., B)/  B)K/ Q What is : a'end du"in# SPU;I? A (he A (he BKL B56D in the S)4=I is ecause of space re&uirements+ (he &uery has resulted in so many rows that the S)4=I+O4( $le is not lar"e enou"h to handle it? One possile solution is to increase the space allocation of S)4=I+O4( $le+ Q What is the o&&and used 'y =SO use"s to in3o,e D:0? A DS6 A DS6 '46 Q What is the e""o" ode .1 ? A: 4ni&ue Inde1 violation Q Ho% do you (!te" out the "o%s "et"ie3ed )"o& a D:0 ta'!e? A One A One way is to use the SQ W%5'5 clause+ Q What is a o!!etion? A  A  collection is somethin" that every pro"rammer should assi"n#specify for every packa"e+ (his is aout .-. characters lon"+ Q What is S,e!eton Cu"so" =a'!e SKC=? A (he A (he 51ecutale form of a )lan+ (his is stored st ored in S<SIBM+S*(N/ tale+ Q What is the e-ui3a!ent Co'o! Data ty+e )o" Dei&a! $6y in D:0? What does the u""ent SQ4ID "e#iste" ontain? A )I* A )I* ST7;ST7;-<9HT7<9 *OM)-K? (he current SQID contains the current authoriation ID+ Q Can %e de!a"e D:0 HOS= 3a"ia'!e in CO:O4 COPY 'oo,? A 6O+ A 6O+ If we declare DB/ host variale in *OBO *O)< ook, at the time of )recompilation we "et the host variale not de$ned, ecause pre-compiler will not e1pand *OBO *O)< ook+ So we declare declare it either in D*G56 with 5;5* SQ I6*4D5 I6*4D 5 D*G56 6M5 56D-5;5* or we directly hardcode it in the workin" stora"e section+ Q What shou!d 'e s+ei(ed a!on# %ith a u"so" in o"de" to ontinue u+datin# +"oess a)te" COMMI=? A With A With %old option+

 

Q What is the na&e o) the de)au!t D:0 ata!o# data'ase? A DS6DBN2 A DS6DBN2 Q When an you 'e su"e that a -ue"y %i!! "etu"n on!y one "o%? A When A When you use the primary key and only the primary key in the W%5'5 clause+ Q What is the di*e"ene 'et%een BOIN and UNION? A 3OI6 A 3OI6 is used to retrieve data from diCerent tales usin" a sin"le SQ statement+ 46IO6 is used to comine the results of two or more SQ &ueries+ Q What is a o""e!ated su'-ue""y? A In A In a su&uerry, if the outer &uery refers ack to the outcome of inner &uery it is called correlated su&uerry+ su&uerry+ (hat@s why the outer &uery is evaluated $rst unlike an ordinary su&uerry Q What a"e the )untions o) :ind? A BI6D A BI6D mainly performs two thin"s: Synta1 checkin" and uthoriation checkin"+ It inds to"ether all packa"es into an application plan hence the name BI6D+ part from this ind has optimier as a sucomponent+ Its function is to determine the optimum access strate"y+ O3e"3ie%D:0 Inte"3ie% Questions and Ans%e"s6D:0 Inte"3ie% Questions5 D:0 =ehnia! =ehnia! Inte"3ie% Questions5 D:0 Inte"3ie% Question5 ;"e-uent!y As,ed D:0 Questions Q2 . What is SPU;I  QM; ? Ans Ans  - S)4=I - S&l )rocessin" 4sin" =ile Input QM= - Query Mana"ement =acility Both of them are DB/ interactive menu-driven tools used u sed y developers to create  modify dataase oects+ Q0 . Na&e a )e% uti!ities a3ai!a'!e in D:0 ? Ans Ans  - OD M5'G5 MODI=< Q4I5S*5 '5B4ID '5*OH5' '5O'G '5)O'( '5)I' '46S((S

 

Q . What a"e the di*e"ent CO4UMN )untions ? Ans Ans  - S4M-'eturns the total value+ MI6-'eturns the minimum value+ HG-'eturns the avera"e value+ M;-'eturns M;-' eturns the ma1imum value+ *O46(-'eturns *O46( -'eturns the numer of selected rows+ S(DD5H-'eturns S(DD5H -'eturns the standard deviation of the column values+ H'I6*5- 'eturns the variance of the column values+ Q9 . What is a sa!a" )untion ? Ans Ans  -  scalar function also produces a sin"le value, ut unlike the ar"ument of a column function, an ar"ument of a scalar function is a sin"le value+ QL . What is a CO4UMN )untion ? Ans Ans  -  column function fun ction produces a sin"le value for a "roup of rows+ <ou <ou can use the SQ column functions to calculate values ased on entire columns of data+ (he calculated values are from selected rows only 7all rows that satisfy the W%5'5 clause9+ Q . What a"e the di*e"ent ty+es o) =a'!e s+aes ? Ans Ans  - Simple (ale Space Se"mented (ale Space )artitioned (ale Space Q . What is Cu"so" Sta'i!ityCS ? Ans Ans  -  pa"e lock is held only while the cursor is positioned on that pa"e+ When the cursor moves to another pa"e, the lock is released+ When a pa"e is locked concurrent application pro"rams pro"rams cannot update or delete a row of the locked pa"e+  (he current lock is not released until a new lock is ac&uired+ ac&uired+ If an applic application ation pro"ram updates or deletes data, the lock is held until the data is committed+ *S applies only to data that is read+ ll chan"ed data remains locked until *OMMI( or 'OB*+ Q1 . What is the +u"+ose o) a nu!! indiato" 3a"ia'!e? and %hat a"e the +ossi'!e 3a!ues in the 3a"ia'!e and %hat do they &ean ? Ans Ans  -  6ull Indicator is used to indicate whether the host variale has een assi"ned a null+ It used to indicate whether a retrieved character value has een truncated+ It is used to set a column to null+ (he indicator value of U. means the associated host variale contains null+ N means the associated host variale does not contain null, nor the returned value is truncated+ U/ means the associated host variale contains null due to a numeric or arithmetic conversion error error++ N means the value assi"ned to the host h ost variale is truncated+ (he value represented y the indicator variale is the actual len"th of the character value efore truncation+

 

Q/ . What is o&&it and "o!!'a, ? Ans Ans  -  commit occurs automatically at the end of the pro"ram, or y re&uest one or more times durin" the e1ecution of the pro"ram+ 'eleases all locks ac&uired y the pro"ram since the last commit, so that other pro"rams and users may otain access to the data+ ny open cursors are automatically closed+ ll dataase chan"es are made permanent+If any chan"es made to the tales are not appropriate, appropriate, then all the chan"es must y rolled ack resultin" in the same state of data as they were prior to makin" chan"es+ 'elease all locks ac&uired y the pro"ram+ Q2 . In a sin#!e ta'!e6Ho% to "et"ie3e a e&+!oyee.id o) an e&+!oyee %ho %o",s in &o"e than one de+a"t&ent? AnsSelect Ans Select empFidfromemployee"roup empFidfromemployee"roup y empFid,depthavin" count789.? Q22 . Ho% an you s+!it a ta'!e in to e$at!y ha!)? Q20 . Say CUS= =a'!e ontains "eo"ds !i,e CUS=NO CUS=NAME CUS=4OC 2 A:C SSS 0 8YR  PQ< 9 MNO WWW L C>> ............. .............No% .............N o% %"ite a -ue"y to "et"ie3e a!! "eo"ds %ith CUS=4OC no data5 S55*( 8 ='OM *4S( W%5'5 *4S(O* IS 64 Q2 . A =a'!e =a'!e )ei!d is de!a"ed de !a"ed as Dei&a!605 I %ant to inse"t the dei&a! in to this o!u&n th"uo'o!.d'0 +"o#"a&5 Ho% shou!d I de!a"e &y !oa! in+ut (!e 3a"ia'!e o" any su##estion? N. dec pic T7>9+T7/9+ is e&ual to dec7L,/9 Q29 . %hat is he, +oint and "esta"t 4o#i ? %hy do %e #o )o" that ?? *heck point and restart lo"ic are mainly used when our tale has .NNN records and we are "ettin" aend after .NN records and we want to start the e1ecution after .NNth record we use this+for this we have to use check points for every .NN recordsQ0N9 what needs to e done if a tale is in copy pendin" # check pendin" status! 4se repair utility '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 6O*O)<)56D '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 6O'*H')56D '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 D(BS5+(B5S)*56M5 6O*%5*)56D 6O*% 5*)56D :0 Inte"3ie% Questions and Ans%e"s6Co&&on I:M D:0 inte"3ie% -uestions as,ed 'y Di*e"ent O"#aniations5 2 Ho% %ou!d you (nd out the tota! nu&'e" o) "o%s in a D:0 ta'!e? 4se S55*( *O46(789 +++ in d/ &uery

0 Ho% do you e!i&inate du+!iate 3a!ues in D:0 SE4EC=?

 

4se S55*( DIS(I6*( +++ in d/ &uery

 Ho% do you se!et a "o% usin# inde$es in D:0? Specify the inde1ed columns in the W%5'5 clause of d/ &uery+ 9 Ho% do you (nd the &a$i&u& 3a!ue in a o!u&n in d'0? 4se S55*( M;7+++9 ++ in d/ &uery L Ho% do you "et"ie3e the ("st L ha"ate"s o) ;I<S=NAME o!u&n o) D:0 ta'!e EMP ? SQ Query : S55*( S4BS('7=I'S(6M5,.,>9 ='OM 5M)?  What a"e a##"e#ate )untions? Bulit-in mathematical functions for use in S55*( clause+

 Can you use MA8 on a CHA< o!u&n?  <5S+

1 My SQ4 state&ent SE4EC= A>GSA4A<Y A>GSA4A<Y ;<OM EMP yie!ds inau"ate "esu!ts5 Why? Because S'< is not declared to have 64s and the employees for whom the salary is not known are also counted+ / Ho% do you onatenate the ;I<S=NAME and 4AS=NAME )"o& EMP ta'!e to #i3e a o&+!ete na&e? S55*( =I'S(6M5 A A S(6M5 ='OM 5M)? 2 What is the use o) >A4UE )untion? .+ void -ve SQ*OD5s y handlin" nulls and eroes in computations /+ Sustitute a numeric value for any nulls used in computation

22 What is UNION6UNION A44? – 46IO6 : eliminates duplicates 46IO6 : retains duplicates Both these are used to comine the results of diCerent S55*( statements+ Suppose I have $ve SQ S55*( statements connected y 46IO6#46IO6 , how many times should I specify 46IO6 to eliminate the duplicate rows! Once+

 

20 What is the "est"ition on usin# UNION in e&'edded SQ4? It has to e in a *4'SO'+

2 In the WHE<E !ause %hat is :E=WEEN and IN? – B5(W556 supplies a ran"e of values while I6 supplies a list of values+

29 Is :E=WEEN in!usi3e o) the "an#e 3a!ues s+ei(ed? –  <  <es+ es+

2L What is 4IKE used )o" in WHE<E !ause? What a"e the %i!da"d ha"ate"s? I5 is used for partial strin" matches+ AEV 7 for a strin" of any character 9 and AFV 7for any sin"le character 9 are the two wild card characters+

2 When do you use a 4IKE state&ent?  (  (o o do partial search search e+"+ to search search employee y name, you need not sp specify ecify the complete name? usin" I5, you can search for partial strin" matches+ 2 What is the &eanin# o) unde"so"e  J  in the 4IKE state&ent? – Match for any sin"le character+ character+

21 What do you ao&+!ish 'y G<OUP :Y 555 HA>ING HA>ING !ause? – G'O4) B< partitions the selected rows on the distinct values of the column on which you "roup " roup y+ y+ %HI6G % HI6G selects G'O4)s which match the criteria speci$ed

2/ Conside" the e&+!oyee ta'!e %ith o!u&n P<OBEC= nu!!a'!e5 Ho% an you #et a !ist o) e&+!oyees %ho a"e not assi#ned to any +"o7et? S55*( 5M)6O ='OM 5M) W%5'5 )'O35*( IS 64?

0 What is the "esu!t o) this -ue"y i) no "o%s a"e se!eted S55*( S4M7S' S4M7S '<9 <9 ='OM 5M) W%5'5 Q4JAMS*V?

 

64

02 Why SE4EC= F is not +"e)e""ed in e&'edded SQ4 +"o#"a&s? =or three reasons: If the tale structure is chan"ed 7 a $eld is added 9, the pro"ram will have to e modi$ed )ro"ram mi"ht retrieve the columns which it mi"ht not use, leadin" on I#O over head+  (he chance of an inde1 only scan is lost+ What are correlated su&ueries!  su&uery in which the inner 7 nested 9 &uery refers ack to the tale in the outer &uery++ *orrelated su&ueries must e evaluated for each &uali$ed row of the outer &uery &uery that is referred to+ 00 What a"e the issues "e!ated %ith o""e!ated su'-ue"ies? 0 What is a u"so"? Why shou!d it 'e used? – *ursor is a pro"rammin" device that allows the S55*( to $nd a set of rows ut return them one at a time+ *ursor should e used ecause the host lan"ua"e can deal with only one row at a time+

09 Ho% %ou!d you "et"ie3e "o%s )"o& a D:0 ta'!e in e&'edded SQ4? – 5ither y usin" the sin"le row S55*( statements, or y usin" the *4'SO'+ part from cursor, what other ways are availale to you to retrieve a row from a tale in emedded SQ! Sin"le row S55*(s+

0L Whe"e %ou!d you s+ei)y the DEC4A<E CU<SO< state&ent? – See answer to ne1t &uestion+ 0 Ho% do you s+ei)y and use a u"so" in a CO:O4 +"o#"a&? – 4se D5*'5 *4'SO' statement st atement either in workin" stora"e or in procedure division division 7efore open cursor9, to specify the S55*( statement+ (hen u use se O)56, =5(*% rows in a loop and $nally *OS5+

0 What ha++ens %hen you say OPEN CU<SO<? If there is an O'D5' B< clause, rows are fetched, sorted and made availale for the =5(*% =5( *% statement+ Other wise simply the curs cursor or is placed on the $rst row+ row+

 

01 Is DEC4A<E CU<SO< e$euta'!e? 6o+

0/ Can you ha3e &o"e than one u"so" o+en at any one ti&e in a +"o#"a&? –  <  <es+ es+

 When you COMMI=6 is the u"so" !osed?  <  <es+ es+

2 Ho% do you !ea3e the u"so" o+en a)te" issuin# a COMMI=?  )o" D:0 05 o" a'o3e on!y  4se WI(% %OD option in D5*'5 *4'SO' statement+ But, it has not eCect in psuedo-conversational *I*S pro"rams+

0 Gi3e the CO:O4 de(nition o) a >A<CHA< >A<CHA< (e!d5  H'*%' H'*%' column '5M'S would e de$ned as follows:+++ .N '5M'S+ 0T '5M'S-56 )I* ST709 4SG5 *OM)+ 0T '5M'S-(5;( )I* ;7.T/N9+

 What is the +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M)! D(5: 0ytes  (IM5: Kytes  (IM5S(M):  (IM5S( M): .Nytes

9 What is the CO:O4 +itu"e !ause o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M)! D(5: )I* ;7.N9  (IM5 : )I* ;7N9  (IM5S(M):  (IM5S( M): )I* ;7/29

L What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? . PIC S//>// COMP.5

 

6ote: In D5*IM7..,/9, .. indicates the sie of the data type and / indicates the precision+

 What is DC4GEN ? De*arations G56erator: used to create the host lan"ua"e copy ooks for the tale de$nitions+ lso creates the D5*'5 tale+

 What a"e the ontents o) a DC4GEN? .+ 5;5* SQ D5*'5 (B5 statement which "ives the layout of the tale#view in terms of DB/ datatypes+ /+  host lan"ua"e copy ook that "ives the host variale de$nitions for the column names+

1 Is it &andato"y to use DC4GEN? I) not6 %hy %ou!d you use it at a!!? . It is not mandatory to use D*G56+ 4sin" D*G56, helps detect wron"ly spelt column names etc+ durin" the precompile sta"e itself 7 ecause of the D5*'5 (B5 9+ D*G56 ein" a tool, would "enerate accurate host variale de$nitions for the tale reducin" chances of error+ error+

/ Is DEC4A<E =A:4E in DC4GEN neessa"y? Why it used? It not necessary to have D5*'5 (B5 statement in D*G56+ (his is used y the pre-compiler to validate the tale-name, view-name, column name etc+, durin" precompile+

9 Wi!! +"eo&+i!e o) an D:0.CO:O4 +"o#"a& 'o&'6 i) D:0 is do%n? 6o+ Because the precompiler does not refer to the DB/ catalo"ue tales+

92 Ho% is a ty+ia! D:0 'ath +#& e$euted? .+ 4se DS6 utility to run a DB/ atch pro"ram from native (SO+ n e1ample is shown: DS6 S<S(5M7DS)K9 '46 )'OG'M75DD0LNBD9 )675DD0LNBD9 IB7@5D N.(+OB3+ODIB@9 56D /+ 4se I35=(N. utility pro"ram to run the aove DS6 command in a 3*+ ssumin" that a siteVs standard is that p"m name J plan name, what is the easiest way to $nd out which p"ms are aCected y chan"e in a taleVs structure ! Query the catalo"ue tales S<S)6D5) and S<S)*D5)+

 

90 Na&e so&e (e!ds )"o& SQ4CA5 SQ*OD5, SQ5''M, SQ5''D

9 Ho% an you -ui,!y (nd out the @ o) "o%s u+dated a)te" an u+date state&ent? *heck the value stored in SQ5''D7K9+

99 What is E8P4AIN? 5;)I6 is used to display the access path as determined y the optimier for a SQ statement+ It can e used in S)4=I 7for sin"le SQ statement9 or in BI6D step 7for emedded SQ9+

9L What do you need to do 'e)o"e you do E8P4AIN? Make sure that the )6F(B5 )6F(B5 is created under the 4(%ID+

9 Whe"e is the out+ut o) E8P4AIN sto"ed? – In userid+)6F(B5 userid+)6F(B5

9 E8P4AIN has out+ut %ith MA=CHCO4S  5 What does it &ean? –  nonmatchin" inde1 scan if **5SS(<)5 J I+

91 Ho% do you do the E8P4AIN o) a dyna&i SQ4 state&ent? .+ 4se S)4=I or QM= to 5;)I6 the dynamic SQ statement /+ Include 5;)I6 command in the emedded dynamic SQ statements

9/ Ho% do you si&u!ate the E8P4AIN o) an e&'edded SQ4 state&ent in SPU;IQM;? Gi3e an e$a&+!e %ith a host 3a"ia'!e in WHE<E !ause5 4se a &uestion mark in place of a host variale 7or an unknown value9+ e+"+ S55*( 5M)F6M5 ='OM 5M) W%5'5 5M)FS'<  !

L What a"e the iso!ation !e3e!s +ossi'!e? – *S: *ursor Staility '': 'epeatale 'ead

 

L2 What is the di*e"ene 'et%een CS and << iso!ation !e3e!s? *S: 'eleases the lock on a pa"e after use '': 'etains all locks ac&uired till end of transaction

L0 Whe"e do you s+ei)y the& ? ISO(IO6 ISO (IO6 5H5 is a parameter for the ind process+

L When do you s+ei)y the iso!ation !e3e!? Ho%? Durin" the BI6D process+ ISO(IO6 ISO(IO6 7*S#'' 9+++ I use *S and update u pdate a pa"e+ Will the lock e released after I am done with that pa"e! 6o+ L9 What a"e the 3a"ious !o,in# !e3e!s a3ai!a'!e? )G5, (B5, (B5S)*5

LL Ho% does D:0 dete"&ine %hat !o,.sie to use? .+ Based on the lock-sie "iven while creatin" the talespace /+ )ro"rammer can direct the DB/ what lock-sie to use K+ If lock-sie 6< is speci$ed, DB/ usually chooses a lock-sie of )G5 )G5

L What a"e the disad3anta#es o) PAGE !e3e! !o,? %i"h resource utiliation if lar"e updates are to e done D:0 Inte"3ie% Questions and Ans%e"s as,ed in 3a"ious o&+anies !i,e I:M6 Wi+"o 6In)osys6 =eh Mahind"a6 C=S6Patni6=CS Ho% %ou!d you "et"ie3e "o%s )"o& a D:0 ta'!e in e&'edded SQ4? 5ither y usin" the sin"le row S55*( statements, or y usin" the *4'SO' A+a"t )"o& u"so"6 u"so"6 %hat othe" %ays a"e a3ai!a'!e to you to "et"ie3e a "o% )"o& a ta'!e in e&'edded SQ4? Sin"le row S55*( S55 *(s s Ho% do you s+ei)y and use a u"so" in a CO:O4 +"o#"a&? 4se D5*'5 *4'SO' statement st atement either in workin" stora"e or in procedure division7efore open cursor9, to specify the S55*( statement (hen use O)56, division7efore =5(*% rows in a loop and $nally *OS5

 

What ha++ens %hen you say OPEN CU<SO<? If there is an O'D5' B< clause, rows are fetched, sorted and made availale for the =5(*% =5( *% statement Other wise simply the cursor is placed on the $rst row Is DEC4A<E CU<SO< e$euta'!e? 6o Can you ha3e &o"e than one u"so" o+en at any one ti&e in a +"o#"a&?  <  <es es When you COMMI=6 is the u"so" !osed?  <  <es es Ho% do you !ea3e the u"so" o+en a)te" issuin# a COMMI=? 7 for DB/ /K or aove only9 4se WI(% %OD option in D5*'5 *4'SO' statement But, it has not eCect in psuedo-conversational *I*S pro"rams Gi3e the CO:O4 de(nition o) a >A<CHA< >A<CHA< (e!d  H'*%' H'*%' column '5M'S would e de$ned as follows: .N '5M'S 0T '5M'S-56 )I* ST709 4SG5 *OM) 0T '5M'S-(5;( )I* ;7.T/N9 What is the +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M) and its picture clause in *OBO+ D(5: 0ytes D(5: )I* ;7.N9 (IM5: Kytes (IM5 )I* ;7N9 (IM5S(M): (IM5S(M): .Nytes (IM5S(M): )I* ;7/29 What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? )I* ST7T9HTT *OM)-K 6ote: In D5*IM7..,/9, .. indicates the sie of the data type and / indicates the precision What is DC4GEN ? Declaration Generator: used to create the host lan"ua"e copy ooks for the tale de$nitions lso creates the D5*'5 tale What a"e the ontents o) a DC4GEN? 5;5* SQ D5*'5 (B5 statement which "ives the layout of the tale#view in terms of DB/ datatypes+  host lan"ua"e copy ook that "ives the host variale de$nitions for the column 6ames+

 

it &andato"y to use DC4GEN? I) not6 %hy %ou!d you use it at a!!? It is not mandatory to use D*G56 4sin" D*G56, helps detect wron"ly spelt column names etc durin" the pre- compile sta"e itself 7 ecause of the D5*'5  (  (B5 B5 9 D*G56 ein" a tool, would "enerate "enerate accurate host variale de$nit de$nitions ions for the tale reducin" chances of error+ Is DEC4A<E =A:4E in DC4GEN neessa"y?Why it used? It not necessary to have D5*'5 (B5 statement in D*G56 (his is used y the pre-compiler to validate the tale-name, view-name, column name etc, durin" precompile+ Wi!! +"e.o&+i!e o) an D:0.CO:O4 +"o#"a& 'o&'6 i) D:0 is do%n? 6o Because the pre-compiler does not refer to the DB/ catalo"ue tales Ho% is a ty+ia! D:0 'ath P"o#"a& #& e$euted ? 4se DS6 utility to run a DB/ atch pro"ram from native (SO n e1ample is shown: DS6 S<S(5M7DS)K9 '46 )'OG'M75DD0LNBD9 )'OG'M75DD0LNBD9 )675DD0LNBD9 IB7@5DN.(OB3ODIB@9 IB7@5DN.(OB3 ODIB@9 56D 4se I35=(N. utility pro"ram to run the aove DS6 command in a 3* Assu&in# that a sites standa"d is that +#& na&e  +!an na&e6 %hat is the easiest %ay to (nd out %hih +#&s a"e a*eted 'y han#e in a ta'!es st"utu"e ? Query the catalo"ue tales S<S)6D5) and S<S)*D5) S<S)*D5) Na&e so&e (e!ds )"o& SQ4CA5 SQ*OD5, SQ5''M, SQ5''D Ho% an you Qui,!y (nd out the @ o) "o%s u+dated a)te" an u+date state&ent? *heck the value stored in SQ5''D7K9 What is E8P4AIN? 5;)I6 is used to display the access path as determined y the optimier for a SQ statement It can e used in S)4=I 7for sin"le SQ statement 9 or in BI6D step 7for emedded SQ 9+ What do you need to do 'e)o"e you do E8P4AIN? Make sure that the )6F(B5 )6F(B5 is created under the 4(%ID Whe"e is the out+ut o) E8P4AIN sto"ed? In userid )6F(B5 )6F(B5 E8P4AIN has out+ut %ith MA=CHCO4S   What does it &ean?

 

 non matchin" inde1 scan if **5SS(<)5 J I Ho% do you do the E8P4AIN o) a dyna&i SQ4 state&ent? .+ 4se S)4=I or M= to 5;)I6 the dynamic SQ statement /+ Include 5;)I6 command in the emedded dynamic SQ statements Ho% do you si&u!ate the E8P4AIN o) an e&'edded SQ4 state&ent in SPU;IM;? Gi3e an e$a&+!e %ith a host 3a"ia'!e in WHE<E !ause 4se a Question mark in place of a host variale 7 or an unknown value 9 e" S55*( 5M)F6M5 ='OM 5M) W%5'5 5M)FS'<  ! What a"e the iso!ation !e3e!s +ossi'!e ? *S: *ursor Staility '': 'epeatale 'ead What is the di*e"ene 'et%een CS and << iso!ation !e3e!s? *S: 'eleases the lock on a pa"e after use '': 'etains all locks ac&uired till end of transaction Whe"e do you s+ei)y the& ? ISO(IO6 ISO (IO6 5H5 is a parameter for the ind process When do you s+ei)y the iso!ation !e3e!?Ho%? Durin" the BI6D process ISO(IO6 ISO(IO6 7 *S#'' 9 I use CS and u+date a +a#e Wi!! the !o, 'e "e!eased a)te" I a& done %ith that +a#e? 6o What a"e the 3a"ious !o,in# !e3e!s a3ai!a'!e? )G5, (B5, (B5S)*5 Ho% does D:0 dete"&ine %hat !o,.sie to use? .+ Based on the lock-sie "iven while creatin" the talespace /+ )ro"rammer can direct the DB/ what lock-sie to use K+ If lock-sie 6< is speci$ed, DB/ usually choses a lock-sie of )G5 What a"e the disad3anta#es o) PAGE !e3e! !o,? %i"h resource utiliation if lar"e updates are to e done+ Sha"e You" You" Ideas and Su##estions A'out D:0 Inte"3ie% Questions5A!! 3isito"s an su'&it thei" o&&ents on D:0 Inte"3ie% Questions What a"e the di*e"ent data ty+es in D:0? Ans Ans  - Smallint

 

Inte"er D5*IM =O( *haracter,Harcharacter Graphic,Har"raphic Date  (ime  (imestamp Q0 . What is a 3ie% ? What a"e the ad3anta#es and "est"itions o) usin# a 3ie% ? Ans Ans  -  view is a virtual tale derived from one or more ase tales+ It prevents unauthoried users from havin" access to sensitive data+ *annot insert, delete or update a view, which is ased on more than one ase tale+ Q . What do you &ean 'y "e)e"entia! Inte#"ity? Ans Ans  - 'eferential inte"rity is a condition wherein all references from one tale to another are valid+ It is the enforcement of all referential constraints7a rule that the value of a forei"n key must appear as the value of a primary key of some other speci$c tale+9 Q9 . What is a Su'-ue"y ? Ans Ans  -  su&uery is a &uery that is written as part of another &uery@s W%5'5 clause+ QL . What is o""!eated su'-ue"y ? Ans Ans  -  correlated su&uery is one that has a correlation name as a tale or view desi"nator in the ='OM clause of the outer &uery and the same correlation name as &uali$er of a search condition in the W%5'5 clause of the su&uery+ su&uery+ Q . Ho% does the +"oessin# o) o""e!ated su'-ue"y di*e" )"o& a nono""e!ated ? Ans Ans  - (he su&uery in a correlated su&uery is reevaluated for every row of the tale or view named on the outer &uery, while the su&uery Of a noncorrelated su&uery is evaluated only once+ Q . What is D:0 'ind ? Ans Ans  -  ind is a process that uilds @access paths@ to DB/ tales+  ind uses the Dataase 'e&uest module7s9 from the DB/ precompile step as input and produces an application plan+ It also checks the user@s authority and validates the SQ Statements in the DB'M+ Q1 . What is a +!an? Ans Ans  -  plan in d/ produced durin" the ind process+ One or more dataase re&uest modules with a plan name+

 

Q/ . What is a synony&? Ho% is it used? Ans Ans  -  synonym is used to reference a tale or view y another name+ (he other name can then e written in the application code pointin" to test tales in the development sta"e and to production entities when the code is mi"rated+(he synonym is linked to the 4(%ID that created it+ Q2 . What is an a!ias and ho% does it di*e" )"o& ) "o& a synony&? Ans Ans  - n alias is an alternative to a synonym, desi"ned for a distriuted environment to avoid havin" to use the location &uali$er of a tale or view view++ (he alias is not dropped when the tale is dropped+ Q22 . Des"i'e the +"i&a"y ,ey and the )o"ei#n ,ey? Ans Ans  - (he primary key is a column or a set of columns that provide a uni&ue identi$er to each row of a tale+ (he forei"n key is a column or a set of columns that refers to the primary key of another tale+ Q20 . What is DD4 and DM4? Ans : Ans  : lack - DD - Data De$nition an"ua"e 7*'5(5, (5', ('46*(59 DM - Data Manipulation an"ua"e 7S55*(, I6S5'(, I6S5'(, D55(5  4)D(59 4)D(59 Q2 . What is DC4GEN? Ans Ans  - D*G56 stands for declarations "enerator? it is a facility to "enerate DB/ s&l data structures in *OBO or )#I pro"rams+ Q29 . What is the si#ni(ane o) the CU<SO< WI=H HO4D !ause in a u"so" de!a"ation? Ans Ans  - (he clause avoids closin" the cursor and repositionin" it to the last row processed when the cursor is reopened+ Q2L . What a"e the th"ee !o, ty+es? Ans Ans  - (he three types are shared, update and e1clusive+ Shar Shared ed locks allow two or more pro"rams to read simultaneously ut not chan"e the locked space+n e1clusive lock ars all other users from accessin" the space+n update lock is less restrictive? it allows other transactions to read or ac&uire shared locks on the space+ Q2 . What is dead!o, ? Ans Ans  - Deadlock occurs when transactions e1ecutin" at the same time lock each other out of data that they need to complete their lo"ical units of work+ Q2 . What is the di*e"ene 'et%een #"ou+ 'y and o"de" 'y ? Ans Ans  - Group y controls the presentation of the rows, order y controls the presentation of the columns for the results of the S55*( statement+

 

Q21 . What is a !uste"ed inde$ ? Ans Ans  - =or a clustered inde1 DB/ maintains rows in the same se&uence as the columns in the inde1 for as lon" as there is free space+ DB/ can then process that tale in that order ePciently+ Q2/ . What is the e-ui3a!ent o'o! de(niton )o" the dataty+es in D:0 ? Ans Ans  - Smallint - ST709 *OM) or ST709 *OM)-0 Inte"er - ST7T9 *OM) or ST7T9 *OM)-0 *har769 - )I* ;769 Harchar769 - N. 6M5+ 0T 6M5-56 )I* ST709 4SG5 *OM)+ 0T 6M5-(5;( )I* ;769+ D5*IM7),S9 - If pX.T: Q0 . Ho% do you add o!u&ns to an e$istin# ta'!e ? Ans Ans  - (5' (5' tale command can e used to add columns to an e1istin" tale+ We a"e !istin# 'e!o% L Most Co&&on!y As,ed Inte"3ie% Questions and Ans%e"s in D:0 Main)"a&e5=he Questions a"e o!!eted )"o& 3a"ious Inte"3ie% Sou"es 25What is !o, esa!ation? )romotin" a )G5 )G5 lock-sie to tale or talespace lock-sie when a transaction has ac&uired more locks than speci$ed in 64M(S+ 64M(S+ ocks should e taken on oects in sin"le talespace for escalation to occur+ 05What a"e the 3a"ious !o,s a3ai!a'!e? S%'5, 5;*4SIH5, 4)D(5 5Can I use 4OCK =A:4E on a 3ie%? 6o+ (o lock a view, take lock on the underlyin" tales+ 95What is A4=E<? – SQ command used to chan"e the de$nition of DB/ oects+ L5 What is a D:<M6 P4AN? DB'M: DataBase 'e&uest Module, has the SQ statements e1tracted from the host lan"ua"e pro"ram y the pre-compiler+ )6:  result of the BI6D process+ It has the e1ecutale code for the SQ statements in the DB'M+ 5 What is ACQUI<E<E4EASE in :IND? Determine the point at which DB/ ac&uires or releases locks a"ainst tale and talespaces, includin" intent locks+

 

5 What e!se is the"e in the P4AN a+a"t )"o& the aess +ath? + ath? – )6 has the e1ecutale e1ecutale code for the SQ statements in the host pro"ram 15What ha++ens to the P4AN i) inde$ used 'y it is d"o++ed? )lan is marked as invalid+ (he ne1t time the plan is accessed, it is reound+ /5 What a"e PACKAGES? –  (hey contain e1ecutale e1ecutale code for SQ SQ statements for one DB'M+ 25 What a"e the ad3anta#es o) usin# a PACKAGE? PACKAGE? .+ void havin" to ind a lar"e numer of DB'M memers into a plan /+ void cost of a lar"e ind K+ void the entire transaction ein" unavailale durin" ind and automatic reind of a plan 0+ Minimie fallack comple1ities if chan"es result in an error+ error+ 225What is a o!!etion? a user de$ned name that is the anchor for packa"es+ It has not physical e1istence+ Main usa"e is to "roup packa"es+ In S)4=I suppose you want to select ma1+ of .NNN rows , ut the select returns only /NN rows+ 205What a"e the 0 s-!odes that a"e "etu"ned? – .NN 7 for successful completion of the &uery 9, N 7for successful *OMMI( if 4(O*OMMI( is set to <es9+ 25Ho% %ou!d you +"int the out+ut o) an SQ4 state&ent )"o& SPU;I? – )rint the output dataset+ 295 4ot o) u+dates ha3e 'een done on a ta'!e due to %hih inde$es ha3e #one hay%i"e5 What do you do? – ooks like inde1 pa"e split has occurred+ DO a '5O'G of the inde1es+ 2L5 What is dyna&i SQ4? – Dynamic SQ is a SQ statement created at pro"ram e1ecution e1ecution time+ 25 When is the aess +ath dete"&ined )o" dyna&i SQ4? – t run time, when the )'5)'5 )'5)'5 statement is issued+ 25 Su++ose I ha3e a +"o#"a& %hih uses a dyna&i SQ4 and it has 'een +e")o"&in# %e!! ti!! no%5 O* !ate6 I (nd that the +e")o"&ane has dete"io"ated5 What ha++ened? – )roaly '46 S((S is not done and the pro"ram is usin" a wron" inde1 due to

 

incorrect stats+ )roaly )roa ly '46S((S '46S((S is done and optimier has chosen a wron" access path ased on the latest statistics+ 215Ho% does D:0 sto"e NU44 +hysia!!y? as an e1tra-yte pre$1 to the column value+ )hysically, the null pre$1 is %e1 VNNV if the value is present and %e1 A==V if it is not+ 2/5 Ho% do you "et"ie3e the data )"o& a nu!!a'!e o!u&n? – 4se null indicators+ Synta1 +++ I6(O :%OS(H':64I6D :%OS(H':64I6D 0 What is the +itu"e !ause o) the nu!! indiato" 3a"ia'!e? – ST709 *OM)+ 02 What does it &ean i) the nu!! indiato" has .26 6 .0? – -. : the $eld is null N : the $eld is not null -/ : the $eld value is truncated 00 Ho% do you inse"t a "eo"d %ith a nu!!a'!e o!u&n?  (  (o o insert a 64, move -. to the null indicator  (  (o o insert a valid value, move N to the null indic indicator ator 0 What is <UNS=A=S? –  DB/ utility used to collect statistics aout the data values in tales which can e used y the optimier to decide the access path+ It also collects statistics used for space mana"ement+ (hese statistics are stored in DB/ catalo" tales+ 09 When %i!! you hose to "un <UNS=A=S? fter fter a load, or after mass updates, inserts, deletes, or after '5O'G+ 0L Gi3e so&e e$a&+!e o) statistis o!!eted du"in# <UNS=A=S? <UNS=A=S? Y of rows in the tale )ercent )erc ent of rows in clusterin" se&uence Y of distinct values of inde1ed column Y of rows moved to a neary#farway pa"e due to row len"th increase 0 What is <EO<G? When is it used? '5O'G reor"anies data on physical stora"e to reclutser rows, positionin" overZowed rows in their proper se&uence, to reclaim space, to restore free space+ It is used after heavy updates, inserts and delete activity and after se"ments of a se"mented talespace have ecome fra"mented+ 0 What is IMAGECOPY? –

 

It is full ackup of a DB/ tale which can e used in recovery+ 01 When do you use the IMAGECOPY? –  (  (o o take routine routine ackup of of tales fter a OD with OG 6O fter '5O'G with OG 6O 0/ What is COPY PENDING status?  state in which, an ima"e copy on a tale needs to e taken, In this status, the tale is availale only for &ueries+ <ou cannot update this tale+ (o remove the *O)< )56DI6G status, you take an ima"e copy or use '5)I' utility+  What is CHECK PENDING? When a tale is ODed with 56=O'*5 6O option, then the tale is left in *%5* )56DI6G status+ It means that the OD utility did not perform constraint checkin"+ 2 What is QUIESCE?  Q4I5S*5 Zushes all DB/ uCers on to the disk+ (his "ives a correct snapshot of the dataase and should e used efore and after any IMG5*O)< to maintain consistency+ 0 What is a !uste"in# inde$ ? – *auses the data rows to e stored in the order speci$ed in the inde1+  mandatory inde1 de$ned on a partitioned tale space+  Ho% &any !uste"in# inde$es an 'e de(ned )o" a ta'!e? Only one+ 9 What is the di*e"ene 'et%een +"i&a"y ,ey  uni-ue inde$? )rimary : a relational dataase constraint+ )rimary key consists of one or more columns that uni&uely identify a row in the tale+ =or a normalied relation, there is one desi"nated primary key+ 4ni&ue inde1: a physical oect that stores only uni&ue values+ (here can e one or more uni&ue inde1es on a tale+ L What is s-!ode ./00? uthoriation failure  What is s-!ode .122? S55*( statement has resulted in retrieval of more than one row+ row+  What does the s-!ode o) .121 +e"tain to? –  (his is "enerated when the consistency consistency tokens in the DB DB'M 'M and the load module are diCerent+

 

1 A"e 3ie%s u+datea'!e? 6ot all of them+ Some views are updateale e+"+ sin"le tale view with all the $elds or mandatory $elds+ 51amples of non-updateale views are views which are oins, views that contain a""re"ate functions 7such as MI69, and views that have G'O4) B< clause+ / I) I ha3e a 3ie% %hih is a 7oin o) t%o o" &o"e ta'!es6 an this 3ie% 'e u+datea'!e? – 6o+ 9 What a"e the 9 en3i"on&ents %hih an aess D:0?  (SO, *I*S, IMS and and B B( (*% 92 What is an inne" 7oin6 and an oute" 7oin? Inner 3oin: comine information from two or more tales y comparin" all values that meet the search criteria in the desi"nated column or columns of on e tale with the entire clause in correspondin" columns of the other tale or tales+ (his kind of  oin which involve a match match in oth columns are called called inner oins+ Outer oin is one in which you want oth matchin" and non matchin" rows to e returned+ DB/ has no speci$c operator for outer oins? it can e simulated y cominin" a oin and a correlated su &uery with a 46IO6+ 90 What is ;<EEPAGE and PC=;<EE in =A:4ESPACE "eation? )*(='55: percenta"e of each pa"e to e left free ='55)G5: ='55) G5: 6umer of pa"es to e loaded with data etween each free pa"e 9 What a"e si&+!e6 se#&ented and +a"titioned ta'!e s+aes ? Si&+!e =a'!es+ae *an contain one or more tales 'ows from multiple tales tales can e interleaved on a pa"e under the DBs control and maintenance Se#&ented =a'!es+ae *an contain one or more tales  (  (alespace alespace is divided divided into se"ments of 0 to 20 pa"es in increments increments of 0 pa"es+ 5ach 5ach se"ment is dedicated to sin"le tale+  tale can occupy multiple se"ments Pa"titioned =a'!es+ae *an contain one tale  (  (alespace alespace is divided divided into parts and eac each h part is put in a separate H HSM SM dataset+ 99 What is (!te" )ato"? one divided y the numer of distinct values of a column+ 9L What is inde$ a"dina!ity? –

 

 (he numer of distinct values values a column or columns contain+ 9 What is a synony& ? Synonym is an alternate name for a tale or view used mainly to h hide ide the leadin" &uali$er of a tale or view++ view++  synonym syn onym is accessile only y the creator creator++ 9 What is the di*e"ene 'et%een SYNONYM and A4IAS? SYNONYM:: is dropped when the tale or talespace is dropped+ Synonym is SYNONYM availale only to the creator+ A4IAS:: is retained even if tale or talespace is dropped+ IS can e created A4IAS even if the tale does not e1ist+ It is used mainly in distriuted environment to hide the location info from pro"rams+ lias is a "loal oect  is availale to all+ 91 What do you &ean 'y NO= NU44 WI=H DE;AU4=? When %i!! you use it?  (his column cannot have nulls and while while insertion, if no value is supplied then it wil have eroes, spaces or date#time dependin" on whether it is numeric, character or date#time+ 4se it when you do not want to have nulls ut at the same time cannot "ive values all the time you insert this row+ 9/ What do you &ean 'y NO= NU44? When %i!! you use it?  (he column cannot have nulls+ 4se it for for key $elds+ L When %ou!d you +"e)e" to use >A<CHA<? When a column which contains lon" te1t, e+"+ remarks, notes, may have in most cases less than >NE of the ma1imum len"th+ .N9 What are the disadvanta"es of usin" H'*%'! H'*%'! .+ *an lead to hi"h space utiliation if most of the values are close to ma1imum+ /+ )ositionin" of H'*%' H'*%' column has to e done carefully as it has performance implications+ K+ 'elocation of rows to diCerent pa"es can lead to more I#Os on retrieval+ L2 Ho% do I "eate a ta'!e MANAGE<  EMP@6 MANAGE< %he"e MANAGE< is a )o"ei#n ,ey %hih "e)e"enes to EMP@ in the sa&e ta'!e? Gi3e the e$at DD45 =irst *'5(5 M6G5' tale with 5M)Y as the primary key+ (hen (5' it to de$ne the forei"n key+ key+ When is the authoriation check on DB/ oects done - at BI6D time or run time! t run time+ L0 What is auditin#? 'ecordin" 'ecor din" SQ statements that access a tale+ Speci$ed at tale creation time or throu"h alter+

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close