Overview:IMS DB Interview ,Mainframe IMS Interview Questions,IMS Interview Overview:IMS Questions asked in top companies What is the physical nature of a dataase called! Is it necessary that all the se"ments in a DI#i dataase 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 dataase e uni&ue! What is a key $eld in an IMS dataase! What is a dataase 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 dataase ! %ow many se"ment types can you have in a D#I dataase! 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"ene '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 aess +ath dete"&ined )o" dyna&i SQ4? – Su++ose I ha3e a +"o#"a& %hih uses a dyna&i SQ4 and it has 'een +e")o"&in# %e!! ti!! no%55 O* !ate6 I (nd that the +e")o"&ane has dete"io"ated5 What no% ha++ened? –– I) I ha3e a 3ie% %hih 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+aes ? What is (!te" )ato"? 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 %hih an aess 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"ene '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 %hih "e)e"enes to EMP@ in the sa&e ta'!e? Gi3e the e$at DD45 What is auditin#? Ho% do you onatenate 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+ae 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 )untion ? Ho% do you (nd the &a$i&u& 3a!ue in a o!u&n?
What a"e a##"e#ate )untions? At %hat sta#e D:0 &ust 'e u+? What tehni-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!et a "o% usin# inde$es? Ho% do you e!i&inate du+!iate 3a!ues in SE4EC= What is a synony&? Ho% is it used? What is a +"eo&+i!e? Ho% do %e un!oad the D:0 ta'!es usin# BC4? Ho% to "ead !ast "eo"d in >SAM (!e56 I dont ,no% ho% &any "eo"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#sMain)"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" )ato"? What is an inne" 7oin6 and an oute" 7oin What a"e the 9 en3i"on&ents %hih an aess D:0 A"e 3ie%s u+datea'!e %hat is s-!ode .122 What is s-!ode ./00 What is the di*e"ene '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!eted? 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+ei)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$euta'!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 "eo"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 +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es? What is the CO:O4 +itu"e !ause o) the )o!!o%in# D:0 data ty+es? What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? 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 neessa"y? Why it used? Wi!! +"eo&+i!ed o) an D:0.CO:O4 +"o#"a& 'o&'6 i) D:0 is do%n? Ho% is a ty+ia! D:0 'ath +#& e$euted? 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 Dei&a!J data to O"a!e en3i"on&ent 05 4oadin# o) Co'o! Data st"ea&s %ith HE8 Cha"ate" data to O"a!e en3i"on&ent A"e the"e any too!s6 &ehanis&s in O"a!e o" any othe" thi"d +a"ty +"odut? 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 "eo"ds say D6E6;6C6A . Ho% to o+y D and A "eo"ds on!y 'y usin# (!e.aid? 5 Ho% to !oad data to a ta'!e? 15 A dataset ontains 2 "eo"ds6 Ho% do you '"o%se +a"tiu!a" "eo"d usin# (!e.id? /5 What is di*e"ene 'et%een QM; S+oo(? 25 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? 25 Can you see s/9o&+ data? 295 Ho% to ,no% othe" +e"son 7o' status? 2L5 Ho% &any !uste"in# inde$es a"e +asin# )o" a ta'!e? 25 Ho% to "ead !ast "eo"d in 3sa& (!e %hen the nu&'e" o) "eo"ds is not ,no%n?
25 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$? 05 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+ae? 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 tehni-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 comines data from more that two tales
Question What is a )o"ei#n ,ey? Ans%e" It Ans%e" It identi$es a releated row in another tale and estalishes a lo"ical relationship etween rows in two tales+ 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 variale+ Ho% %ou!d you (nd out the tota! nu&'e" o) "o%s in a ta'!e? 4se S55*( *O46(789 Ho% do you e!i&inate du+!iate 3a!ues in SE4EC=? 4se S55*( DIS(I6*( Ho% do you se!et a "o% usin# inde$es? Specify the inde1ed inde1ed columns in the W%5'5 clause What a"e a##"e#ate )untions? Built-in mathematical functions for use in S55*( clause Ho% do you (nd the &a$i&u& 3a!ue in a o!u&n? 4se S55*( M;7
Can you use MA8 on a CHA< o!u&n? <5S My SQ4 state&ent SE4EC= A>GSA4A< A>GSA4A<Y Y ;<OM EMP yie!ds inau"ate "esu!ts Why? Because S'< is not declared to have 64s and the employees for whom the salary is not known are also counted Ho% do you "et"ie3e the ("st L ha"ate"s o) ;I<S=NAME o!u&n o) EMP ta'!e? S55*( S4BS('7=I'S(6M5,.,>9 ='OM 5M)? Ho% do you onatenate the ;I<S=NAME and 4AS=NAME )"o& EMP ta'!e to #i3e a o&+!ete na&e? S55*( =I'S(6M5 @ A S(6M5 ='OM 5M)? What is the use o) >A4UE )untion? void vo id -ve SQ *OD5 y handlin" nulls and eroes in computations Sustitute a numeric value for any nulls used in computation What is UNION6UNION A44? 46IO6 : eliminates duplicates 46IO6 : retains duplicates Both these are used to comine the results of diCerent S55*( statements Su++ose I ha3e (3e SQ4 SE4EC= state&ents onneted 'y UNIONUNION A446 ho% &any ti&es shou!d I s+ei)y UNION to e!i&inate the du+!iate "o%s? Once What is the "est"ition 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+ei(ed? <es <es What is 4IKE used )o" in WHE<E !ause?What a"e the %i!da"d ha"ate"s? I5 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" I5, you can search for partial strin" matches What is the &eanin# o) unde"so"e in the 4IKE state&ent? Match for any sin"le character What do you ao&+!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 tale with column )'O35*( nullale %ow can you "et a ist of employees who are not assi"ned to any proect! S55*( 5M)6O ='OM 5M) W%5'5 )'O35*( IS 64? What is the result of this uery if no rows are selected: S55*( S4M7S'<9 ='OM 5M) W%5'5 4J@MS*@? 64 Why SE4EC= F is not +"e)e""ed in e&'edded SQ4 +"o#"a&s? =or three reasons: If the tale 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 tale 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 S55*( 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"sPa"t Question What is E8P4AIN in D:0 A 5;)I6 A 5;)I6 is used to detail the access paths chosen y DB/ optimier 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 authoriation checkin"+It inds to"ether all packa"es into an application plan hence the name BI6D+part from this ind has optimiser as a sucomponent+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 +!ae o) >SAM KSDS in D:0 is? Ans%e" BSDS Ans%e" BSDS is a HSM 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%O4D B5 G'6(5D )'IHIG5 (O 4S5 I(+ Question What is the sie o) a data +a#e? Ans%e" 0 Ans%e" 0 to Question %hats the 'est !o,sie that you ou!d use %hen you "eate a ta'!es+ae? Ans%e" (he Ans%e" (he answer is ocksie J 6<+4nless you are Sure what@s the )urpose of talespace ie+,'ead-only or '#W+If '#W+If you use lock sie Jany, D/ would automatically determine what type of locks it should use+ Question %hats the e""o" ode )o" Uni-ue Inde$ >oi!ation Ans%e" -NK Ans%e" -NK Question %hats the +e"enta#e )"ee s+ae )o" Ans%e" 5'O Ans%e" 5'O Question Can you de(ne an Inde$ i) the ta'!e sie !ess than 2 PAGES? Ans%e" the Ans%e" the nswer is : 6O Question Whats the Ma$i&u& 4en#th o) SQ4CA and %hats 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 sie !ess than 2 PAGES? Ans%e" (he Ans%e" (he answer is Question %hats the +e"enta#e )"ee s+ae )o" Ans%e" (he Ans%e" (he answer is 5'O+ Question Whats 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 Whats the &a$i&u& nu&'e" o) ha"ate"s that a ta'!ena&e an ha3e? Ans%e" (he Ans%e" (he answer is . characters+ Question What is the &eanin# o) .1L 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$euted %hen you use u"so" in the a++!iation +"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 indiate Ans%e" *4''56(D( Ans%e" *4''56(D( option ensures lock fetch while selectin" rows from a tale+ 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"ene '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 tale+ (<)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 availale option for data inte"rity data concurrency is *S+ Question Ho% do you ahie3e "eo"d !o,in# in D:0 in the 3e"sions %hih do not su++o"t "eo"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 sie R Sorry a"ain (han1 Question Ho% do u ahie3e "eo"d !e3e! !o,in# in D:0 3e"sions %hen "eo"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& %hih is ats as o.o"dinato" and
%hih is +a"tii+ant? Ans%e" DB/ Ans%e" DB/ - participant *I*S- coordinator Question Ho% to de(ne the dataite&s to "eei3e the )eth ite&s )o" the SQ4? Ans%e" 4sin" Ans%e" 4sin" the DS5*(, followed y lines of - @dataitems DS datatype@+ Question <eHo% %i!! you de!ete du+!iate "eo"ds )"o& a ta'!e? Ans%e" Delete Ans%e" Delete =r =rom om (ale.Whe (ale.Where re Id In 7Select 7 Select Id =rom (ael. (ael. s s (emp (emp Group By Id %avin" *ount789 .9 Question What is the di*e"ene '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"utu"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-6M5 )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+ae ? Ans%e" O65 Ans%e" O65 Question Na&e the di*e"ent ty+es o) =a'!e s+aes5 Ans%e" .+ Ans%e" .+ Simple (ale Space/+ Se"mented (ale Space andK+ )artitioned (ale (ale Space Main)"a&e D:0 ;"e-uent!y As,ed Inte"3ie% Questions and Ans%e"sPa"t 2 What is an intent !o,? n intent lock is at the th e tale level for a se"mented tale space or at the tale space level for a non se"mented tale space (hey indicate at the tale or tale space level the kinds of locks at lower levels+ What is the di*e"ene '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 staility 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(ane 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&&uniations 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 feedack aout 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"enes5 mer"e oin re&uires that the tales 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 numer of rows DB/ reads the outer tale values and each time scans the inner tale for matches (he hyrid oin is a nested oin that re&uires the outer tale e in se&uence+ Co&+a"e a su' se!et 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"ene 'et%een IN su' se!ets and E8IS=S su' se!et? If there is an inde1 on the attriutes 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 +"odut? *artesian product results from a faulty &uery It is a row in the results for every comination in the oin tales+
What is the di*e"ene '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/ susystem! )acka"e )ack a"e and plan are usually used synonymously as in this site Both contain optimied code for SQ statements - a packa"e for a sin"le pro"ram, module or suroutine contained in the data ase re&uest module 7DB'M9 lirary 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 asyh"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 tale spaces+ What is &eant 'y iso!ation !e3e!? (his is a key concept for any relational relational dataase Isol Isolation ation level is the manner in which locks are applied and released durin" a transaction =or DB/ a @repeatale read@ holds all locks until un til the (ransaction (ransaction completes or a sync point is issued+ =or transactions usin" @cursor staility@ the pa"e lock releases are issued as the cursor @moves@, ie as the transaction releases address aility to the records+ Main)"a&e D:0 ;"e-uent!y As,ed Inte"3ie% Questions and Ans%e"sPa"t 2 Q What is BOIN and %hat a"e the di*e"ent ty+es o) BOIN5 A (he A (he aility to oin rows and comine data from two or more tales is one of the most powerful features of relational system+ (here are three type of oins:.+ 5&ui oin? /+6on-e&uioin? K+self-o K+self-oin in Q Whih is the &ost %ide!y used 'ath +e")o"&ane &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!etin# 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 possile until the updatin" or selection is committed, DB/ tale will not e restructured+ 6ew column de$nition will e there ut it will not e included until all the tasks on the tale 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 ðods o) aessin# D:0 )"o& =SO? Ho% is the onnetion esta'!ished 'et%een =SO D:0? A
(here are three three ways in estalishin" (SO#DB/ connection .+ S)4=I S)4=I /+ QM= K+ *(OG HISIBII(<? thread etween (SO DB/ is estalished 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/ sie uCerpools and $fty 0 sie 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 possile 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!!etion? A A collection is somethin" that every pro"rammer should assi"n#specify for every packa"e+ (his is aout .-. characters lon"+ Q What is S,e!eton Cu"so" =a'!e SKC=? A (he A (he 51ecutale form of a )lan+ (his is stored st ored in S<SIBM+S*(N/ tale+ Q What is the e-ui3a!ent Co'o! Data ty+e )o" Dei&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 SQID contains the current authoriation 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 variale in *OBO *O)< ook, at the time of )recompilation we "et the host variale 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 6M5 56D-5;5* or we directly hardcode it in the workin" stora"e section+ Q What shou!d 'e s+ei(ed a!on# %ith a u"so" in o"de" to ontinue u+datin# +"oess 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"ene 'et%een BOIN and UNION? A 3OI6 A 3OI6 is used to retrieve data from diCerent tales usin" a sin"le SQ statement+ 46IO6 is used to comine 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 )untions o) :ind? A BI6D A BI6D mainly performs two thin"s: Synta1 checkin" and uthoriation checkin"+ It inds to"ether all packa"es into an application plan hence the name BI6D+ part from this ind has optimier as a sucomponent+ 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 =ehnia! =ehnia! 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 dataase oects+ Q0 . Na&e a )e% uti!ities a3ai!a'!e in D:0 ? Ans Ans - OD M5'G5 MODI=< Q4I5S*5 '5B4ID '5*OH5' '5O'G '5)O'( '5)I' '46S((S
Q . What a"e the di*e"ent CO4UMN )untions ? 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 numer of selected rows+ S(DD5H-'eturns S(DD5H -'eturns the standard deviation of the column values+ H'I6*5- 'eturns the variance of the column values+ Q9 . What is a sa!a" )untion ? 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 )untion ? 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+aes ? Ans Ans - Simple (ale Space Se"mented (ale Space )artitioned (ale Space Q . What is Cu"so" Sta'i!ityCS ? 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 'OB*+ Q1 . What is the +u"+ose o) a nu!! indiato" 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 variale 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 variale contains null+ N means the associated host variale does not contain null, nor the returned value is truncated+ U/ means the associated host variale contains null due to a numeric or arithmetic conversion error error++ N means the value assi"ned to the host h ost variale is truncated+ (he value represented y the indicator variale 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 otain access to the data+ ny open cursors are automatically closed+ ll dataase chan"es are made permanent+If any chan"es made to the tales 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? AnsSelect Ans Select empFidfromemployee"roup empFidfromemployee"roup y empFid,depthavin" count789.? Q22 . Ho% an you s+!it a ta'!e in to e$at!y ha!)? Q20 . Say CUS= =a'!e ontains "eo"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!! "eo"ds %ith CUS=4OC no data5 S55*( 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 Dei&a!605 I %ant to inse"t the dei&a! in to this o!u&n th"uo'o!.d'0 +"o#"a&5 Ho% shou!d I de!a"e &y !oa! 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 tale has .NNN records and we are "ettin" aend 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 tale is in copy pendin" # check pendin" status! 4se repair utility '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 6O*O)<)56D '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 6O'*H')56D '5)I' S5( (B5S)*5 D(BS5+(B5S)*56M5 D(BS5+(B5S)*56M5 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"#aniations5 2 Ho% %ou!d you (nd out the tota! nu&'e" o) "o%s in a D:0 ta'!e? 4se S55*( *O46(789 +++ in d/ &uery
0 Ho% do you e!i&inate du+!iate 3a!ues in D:0 SE4EC=?
4se S55*( DIS(I6*( +++ in d/ &uery
Ho% do you se!et 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 S55*( M;7+++9 ++ in d/ &uery L Ho% do you "et"ie3e the ("st L ha"ate"s o) ;I<S=NAME o!u&n o) D:0 ta'!e EMP ? SQ Query : S55*( S4BS('7=I'S(6M5,.,>9 ='OM 5M)? What a"e a##"e#ate )untions? Bulit-in mathematical functions for use in S55*( clause+
Can you use MA8 on a CHA< o!u&n? <5S+
1 My SQ4 state&ent SE4EC= A>GSA4A<Y A>GSA4A<Y ;<OM EMP yie!ds inau"ate "esu!ts5 Why? Because S'< is not declared to have 64s and the employees for whom the salary is not known are also counted+ / Ho% do you onatenate the ;I<S=NAME and 4AS=NAME )"o& EMP ta'!e to #i3e a o&+!ete na&e? S55*( =I'S(6M5 A A S(6M5 ='OM 5M)? 2 What is the use o) >A4UE )untion? .+ void -ve SQ*OD5s y handlin" nulls and eroes in computations /+ Sustitute 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 comine the results of diCerent S55*( statements+ Suppose I have $ve SQ S55*( statements connected y 46IO6#46IO6 , how many times should I specify 46IO6 to eliminate the duplicate rows! Once+
20 What is the "est"ition 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+ei(ed? – < <es+ es+
2L What is 4IKE used )o" in WHE<E !ause? What a"e the %i!da"d ha"ate"s? I5 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" I5, you can search for partial strin" matches+ 2 What is the &eanin# o) unde"so"e J in the 4IKE state&ent? – Match for any sin"le character+ character+
21 What do you ao&+!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 +"o7et? S55*( 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!eted S55*( S4M7S' S4M7S '<9 <9 ='OM 5M) W%5'5 Q4JAMS*V?
64
02 Why SE4EC= F is not +"e)e""ed in e&'edded SQ4 +"o#"a&s? =or three reasons: If the tale 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 tale 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 S55*( 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 S55*( statements, or y usin" the *4'SO'+ part from cursor, what other ways are availale to you to retrieve a row from a tale in emedded SQ! Sin"le row S55*(s+
0L Whe"e %ou!d you s+ei)y the DEC4A<E CU<SO< state&ent? – See answer to ne1t &uestion+ 0 Ho% do you s+ei)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 7efore open cursor9, to specify the S55*( 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 availale 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$euta'!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(% %OD 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 4SG5 *OM)+ 0T '5M'S-(5;( )I* ;7.T/N9+
What is the +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M)! D(5: 0ytes (IM5: Kytes (IM5S(M): (IM5S( M): .Nytes
9 What is the CO:O4 +itu"e !ause o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M)! D(5: )I* ;7.N9 (IM5 : )I* ;7N9 (IM5S(M): (IM5S( M): )I* ;7/29
L What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? . PIC S//>// COMP.5
6ote: In D5*IM7..,/9, .. indicates the sie 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 tale de$nitions+ lso creates the D5*'5 tale+
What a"e the ontents o) a DC4GEN? .+ 5;5* SQ D5*'5 (B5 statement which "ives the layout of the tale#view in terms of DB/ datatypes+ /+ host lan"ua"e copy ook that "ives the host variale 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 (B5 9+ D*G56 ein" a tool, would "enerate accurate host variale de$nitions for the tale reducin" chances of error+ error+
/ Is DEC4A<E =A:4E in DC4GEN neessa"y? Why it used? It not necessary to have D5*'5 (B5 statement in D*G56+ (his is used y the pre-compiler to validate the tale-name, view-name, column name etc+, durin" precompile+
9 Wi!! +"eo&+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 tales+
92 Ho% is a ty+ia! D:0 'ath +#& e$euted? .+ 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+ODIB@9 56D /+ 4se I35=(N. utility pro"ram to run the aove 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 taleVs structure ! Query the catalo"ue tales S<S)6D5) and S<S)*D5)+
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 SQ5''D7K9+
99 What is E8P4AIN? 5;)I6 is used to display the access path as determined y the optimier for a SQ statement+ It can e used in S)4=I 7for sin"le SQ statement9 or in BI6D step 7for emedded SQ9+
9L What do you need to do 'e)o"e you do E8P4AIN? Make sure that the )6F(B5 )6F(B5 is created under the 4(%ID+
9 Whe"e is the out+ut o) E8P4AIN sto"ed? – In userid+)6F(B5 userid+)6F(B5
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 emedded dynamic SQ statements
9/ Ho% do you si&u!ate the E8P4AIN o) an e&'edded SQ4 state&ent in SPU;IQM;? Gi3e an e$a&+!e %ith a host 3a"ia'!e in WHE<E !ause5 4se a &uestion mark in place of a host variale 7or an unknown value9+ e+"+ S55*( 5M)F6M5 ='OM 5M) W%5'5 5M)FS'< !
L What a"e the iso!ation !e3e!s +ossi'!e? – *S: *ursor Staility '': 'epeatale 'ead
L2 What is the di*e"ene '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+ei)y the& ? ISO(IO6 ISO (IO6 5H5 is a parameter for the ind process+
L When do you s+ei)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, (B5, (B5S)*5
LL Ho% does D:0 dete"&ine %hat !o,.sie to use? .+ Based on the lock-sie "iven while creatin" the talespace /+ )ro"rammer can direct the DB/ what lock-sie to use K+ If lock-sie 6< is speci$ed, DB/ usually chooses a lock-sie of )G5 )G5
L What a"e the disad3anta#es o) PAGE !e3e! !o,? %i"h resource utiliation 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 =eh 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 S55*( 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 S55*( S55 *(s s Ho% do you s+ei)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 division7efore open cursor9, to specify the S55*( statement (hen use O)56, division7efore =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 availale for the =5(*% =5( *% statement Other wise simply the cursor is placed on the $rst row Is DEC4A<E CU<SO< e$euta'!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 aove only9 4se WI(% %OD 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 4SG5 *OM) 0T '5M'S-(5;( )I* ;7.T/N9 What is the +hysia! sto"a#e !en#th o) eah o) the )o!!o%in# D:0 data ty+es D(5, (IM5, (IM5S(M) and its picture clause in *OBO+ D(5: 0ytes D(5: )I* ;7.N9 (IM5: Kytes (IM5 )I* ;7N9 (IM5S(M): (IM5S(M): .Nytes (IM5S(M): )I* ;7/29 What is the CO:O4 +itu"e !ause )o" a D:0 o!u&n de(ned as DECIMA42260? )I* ST7T9HTT *OM)-K 6ote: In D5*IM7..,/9, .. indicates the sie 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 tale de$nitions lso creates the D5*'5 tale What a"e the ontents o) a DC4GEN? 5;5* SQ D5*'5 (B5 statement which "ives the layout of the tale#view in terms of DB/ datatypes+ host lan"ua"e copy ook that "ives the host variale 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 ( (B5 B5 9 D*G56 ein" a tool, would "enerate "enerate accurate host variale de$nit de$nitions ions for the tale reducin" chances of error+ Is DEC4A<E =A:4E in DC4GEN neessa"y?Why it used? It not necessary to have D5*'5 (B5 statement in D*G56 (his is used y the pre-compiler to validate the tale-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 tales Ho% is a ty+ia! D:0 'ath P"o#"a& #& e$euted ? 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.(OB3ODIB@9 IB7@5DN.(OB3 ODIB@9 56D 4se I35=(N. utility pro"ram to run the aove DS6 command in a 3* Assu&in# that a sites standa"d is that +#& na&e +!an na&e6 %hat is the easiest %ay to (nd out %hih +#&s a"e a*eted 'y han#e in a ta'!es st"utu"e ? Query the catalo"ue tales S<S)6D5) and S<S)*D5) S<S)*D5) Na&e so&e (e!ds )"o& SQ4CA5 SQ*OD5, SQ5''M, SQ5''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 SQ5''D7K9 What is E8P4AIN? 5;)I6 is used to display the access path as determined y the optimier for a SQ statement It can e used in S)4=I 7for sin"le SQ statement 9 or in BI6D step 7for emedded SQ 9+ What do you need to do 'e)o"e you do E8P4AIN? Make sure that the )6F(B5 )6F(B5 is created under the 4(%ID Whe"e is the out+ut o) E8P4AIN sto"ed? In userid )6F(B5 )6F(B5 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 emedded dynamic SQ statements Ho% do you si&u!ate the E8P4AIN o) an e&'edded SQ4 state&ent in SPU;IM;? Gi3e an e$a&+!e %ith a host 3a"ia'!e in WHE<E !ause 4se a Question mark in place of a host variale 7 or an unknown value 9 e" S55*( 5M)F6M5 ='OM 5M) W%5'5 5M)FS'< ! What a"e the iso!ation !e3e!s +ossi'!e ? *S: *ursor Staility '': 'epeatale 'ead What is the di*e"ene '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+ei)y the& ? ISO(IO6 ISO (IO6 5H5 is a parameter for the ind process When do you s+ei)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, (B5, (B5S)*5 Ho% does D:0 dete"&ine %hat !o,.sie to use? .+ Based on the lock-sie "iven while creatin" the talespace /+ )ro"rammer can direct the DB/ what lock-sie to use K+ If lock-sie 6< is speci$ed, DB/ usually choses a lock-sie of )G5 What a"e the disad3anta#es o) PAGE !e3e! !o,? %i"h resource utiliation 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"itions o) usin# a 3ie% ? Ans Ans - view is a virtual tale derived from one or more ase tales+ It prevents unauthoried users from havin" access to sensitive data+ *annot insert, delete or update a view, which is ased on more than one ase tale+ Q . What do you &ean 'y "e)e"entia! Inte#"ity? Ans Ans - 'eferential inte"rity is a condition wherein all references from one tale 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 tale+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 tale 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 +"oessin# o) o""e!ated su'-ue"y di*e" )"o& a nono""e!ated ? Ans Ans - (he su&uery in a correlated su&uery is reevaluated for every row of the tale 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/ tales+ ind uses the Dataase '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 dataase re&uest modules with a plan name+
Q/ . What is a synony&? Ho% is it used? Ans Ans - synonym is used to reference a tale or view y another name+ (he other name can then e written in the application code pointin" to test tales 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 distriuted environment to avoid havin" to use the location &uali$er of a tale or view view++ (he alias is not dropped when the tale 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 tale+ (he forei"n key is a column or a set of columns that refers to the primary key of another tale+ 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 7S55*(, I6S5'(, I6S5'(, D55(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(ane 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"ene '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 S55*( 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 tale 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. 6M5+ 0T 6M5-56 )I* ST709 4SG5 *OM)+ 0T 6M5-(5;( )I* ;769+ D5*IM7),S9 - If pX.T: Q0 . Ho% do you add o!u&ns to an e$istin# ta'!e ? Ans Ans - (5' (5' tale command can e used to add columns to an e1istin" tale+ 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!!eted )"o& 3a"ious Inte"3ie% Sou"es 25What is !o, esa!ation? )romotin" a )G5 )G5 lock-sie to tale or talespace lock-sie when a transaction has ac&uired more locks than speci$ed in 64M(S+ 64M(S+ ocks should e taken on oects in sin"le talespace 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" tales+ 95What is A4=E<? – SQ command used to chan"e the de$nition of DB/ oects+ 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 e1ecutale 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 tale and talespaces, includin" intent locks+
5 What e!se is the"e in the P4AN a+a"t )"o& the aess +ath? + ath? – )6 has the e1ecutale e1ecutale 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 reound+ /5 What a"e PACKAGES? – (hey contain e1ecutale e1ecutale code for SQ SQ statements for one DB'M+ 25 What a"e the ad3anta#es o) usin# a PACKAGE? PACKAGE? .+ void havin" to ind a lar"e numer of DB'M memers into a plan /+ void cost of a lar"e ind K+ void the entire transaction ein" unavailale durin" ind and automatic reind of a plan 0+ Minimie fallack comple1ities if chan"es result in an error+ error+ 225What is a o!!etion? 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+ 25Ho% %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 %hih 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+ 25 When is the aess +ath dete"&ined )o" dyna&i SQ4? – t run time, when the )'5)'5 )'5)'5 statement is issued+ 25 Su++ose I ha3e a +"o#"a& %hih uses a dyna&i SQ4 and it has 'een +e")o"&in# %e!! ti!! no%5 O* !ate6 I (nd that the +e")o"&ane has dete"io"ated5 What ha++ened? – )roaly '46 S((S is not done and the pro"ram is usin" a wron" inde1 due to
incorrect stats+ )roaly )roa ly '46S((S '46S((S is done and optimier has chosen a wron" access path ased on the latest statistics+ 215Ho% does D:0 sto"e NU44 +hysia!!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':64I6D :%OS(H':64I6D 0 What is the +itu"e !ause o) the nu!! indiato" 3a"ia'!e? – ST709 *OM)+ 02 What does it &ean i) the nu!! indiato" 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 "eo"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 aout the data values in tales which can e used y the optimier to decide the access path+ It also collects statistics used for space mana"ement+ (hese statistics are stored in DB/ catalo" tales+ 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) statistis o!!eted du"in# <UNS=A=S? <UNS=A=S? Y of rows in the tale )ercent )erc ent of rows in clusterin" se&uence Y of distinct values of inde1ed column Y of rows moved to a neary#farway pa"e due to row len"th increase 0 What is <EO<G? When is it used? '5O'G reor"anies 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 talespace have ecome fra"mented+ 0 What is IMAGECOPY? –
It is full ackup of a DB/ tale which can e used in recovery+ 01 When do you use the IMAGECOPY? – ( (o o take routine routine ackup of of tales fter a OD with OG 6O fter '5O'G with OG 6O 0/ What is COPY PENDING status? state in which, an ima"e copy on a tale needs to e taken, In this status, the tale is availale only for &ueries+ <ou cannot update this tale+ (o remove the *O)< )56DI6G status, you take an ima"e copy or use '5)I' utility+ What is CHECK PENDING? When a tale is ODed with 56=O'*5 6O option, then the tale is left in *%5* )56DI6G status+ It means that the OD 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 dataase and should e used efore and after any IMG5*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 tale space+ Ho% &any !uste"in# inde$es an 'e de(ned )o" a ta'!e? Only one+ 9 What is the di*e"ene 'et%een +"i&a"y ,ey uni-ue inde$? )rimary : a relational dataase constraint+ )rimary key consists of one or more columns that uni&uely identify a row in the tale+ =or a normalied relation, there is one desi"nated primary key+ 4ni&ue inde1: a physical oect that stores only uni&ue values+ (here can e one or more uni&ue inde1es on a tale+ L What is s-!ode ./00? uthoriation failure What is s-!ode .122? S55*( 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 updateale e+"+ sin"le tale view with all the $elds or mandatory $elds+ 51amples of non-updateale 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% %hih 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 %hih an aess D:0? (SO, *I*S, IMS and and B B( (*% 92 What is an inne" 7oin6 and an oute" 7oin? Inner 3oin: comine information from two or more tales y comparin" all values that meet the search criteria in the desi"nated column or columns of on e tale with the entire clause in correspondin" columns of the other tale or tales+ (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 cominin" 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: 6umer 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+aes ? Si&+!e =a'!es+ae *an contain one or more tales 'ows from multiple tales tales can e interleaved on a pa"e under the DBs control and maintenance Se#&ented =a'!es+ae *an contain one or more tales ( (alespace alespace 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 tale+ tale can occupy multiple se"ments Pa"titioned =a'!es+ae *an contain one tale ( (alespace alespace is divided divided into parts and eac each h part is put in a separate H HSM SM dataset+ 99 What is (!te" )ato"? one divided y the numer of distinct values of a column+ 9L What is inde$ a"dina!ity? –
(he numer of distinct values values a column or columns contain+ 9 What is a synony& ? Synonym is an alternate name for a tale or view used mainly to h hide ide the leadin" &uali$er of a tale or view++ view++ synonym syn onym is accessile only y the creator creator++ 9 What is the di*e"ene 'et%een SYNONYM and A4IAS? SYNONYM:: is dropped when the tale or talespace is dropped+ Synonym is SYNONYM availale only to the creator+ A4IAS:: is retained even if tale or talespace is dropped+ IS can e created A4IAS even if the tale does not e1ist+ It is used mainly in distriuted environment to hide the location info from pro"rams+ lias is a "loal oect is availale 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+ .N9 What are the disadvanta"es of usin" H'*%'! H'*%'! .+ *an lead to hi"h space utiliation 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 %hih "e)e"enes to EMP@ in the sa&e ta'!e? Gi3e the e$at DD45 =irst *'5(5 M6G5' tale with 5M)Y as the primary key+ (hen (5' it to de$ne the forei"n key+ key+ When is the authoriation check on DB/ oects done - at BI6D time or run time! t run time+ L0 What is auditin#? 'ecordin" 'ecor din" SQ statements that access a tale+ Speci$ed at tale creation time or throu"h alter+