cobol interview questions answers 1
TRANSCRIPT
-
8/12/2019 COBOL Interview Questions Answers 1
1/29
Interview Basics - Mainframe: COBOL
1.Name the divisions in a COBOL program.
IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION,PROCEDURE DIVISION.
2.What are the different data tpes avai!a"!e in COBOL#
Alpha-numeric (!, alpha"e#ic (A! an$ numeric (%!.
$.What does the INI%I&LI'( ver" do#
Alpha"e#ic, Alphanumeric &iel$' alphanumeric e$i#e$ i#em' are 'e# #) SPACES.Numeric, Numeric e$i#e$ i#em' 'e# #) *ERO.
FI++ER , OCCURS DEPENDIN ON i#em' le un#)uche$.
).What is ** !eve! +sed for #
Elemen#ar leel i#em. Cann)# "e 'u"$ii'i)n' )& )#her i#em' (cann)# "e /uali&ie$!,
n)r can #he "e 'u"$ii$e$ #hem'ele'.
,.What is !eve! +sed for #
F)r c)n$i#i)n name'.
.What is !eve! +sed for #
F)r RENAMES clau'e.
*.What does the I/ N0M(IC c!a+se esta"!ish #
IS NUMERIC can "e u'e$ )n alphanumeric i#em', 'i0ne$ numeric pac1e$ $ecimal
i#em' an$ un'i0ne$ numeric pac1e$ $ecimal i#em'. IS NUMERIC re#urn' TRUE i&
#he i#em )nl c)n'i'#' )& 2-%. 3)4eer, i& #he i#em "ein0 #e'#e$ i' a 'i0ne$ i#em, #heni# ma c)n#ain 2-%, 5 an$ - .
.ow do o+ define a ta"!e3arra in COBOL#
26 ARRA7S.
28 ARRA76 PIC (%! OCCURS 62 TIMES.
28 ARRA79 PIC (:! OCCURS 92 TIMES INDEED ;7
-
8/12/2019 COBOL Interview Questions Answers 1
2/29
SEARC3 A++ - i' a "inar 'earch #he #a"le mu'# "e ')r#e$
( ASCENDIN>DESCENDIN ?E7 clau'e #) "e u'e$ $a#a l)a$e$ in #hi' )r$er!
"e&)re u'in0 SEARC3 A++.
12.What sho+!d "e the sorting order for /(&C &LL#
I# can "e ei#her ASCENDIN )r DESCENDIN. ASCENDIN i' $e&aul#. I& )u4an# #he 'earch #) "e $)ne )n an arra ')r#e$ in $e'cen$in0 )r$er, #hen 4hile $e&inin0
#he arra, )u 'h)ul$ 0ie DESCENDIN ?E7 clau'e. (7)u mu'# l)a$ #he #a"le in
#he 'peci&ie$ )r$er!.
1$.What is "inar search#
Search )n a ')r#e$ arra. C)mpare #he i#em #) "e 'earche$ 4i#h #he i#em a# #he cen#er.
I& i# ma#che', &ine el'e repea# #he pr)ce'' 4i#h #he le hal& )r #he ri0h# hal& $epen$in0)n 4here #he i#em lie'.
1).M program has an arra defined to have 15 items. 7+e to a "+g8 I find that
even if the program access the 11th item in this arra8 the program does nota"end. What is wrong with it#
Mu'# u'e c)mpiler )p#i)n SSRANE i& )u 4an# arra ")un$' chec1in0. De&aul# i'NOSSRANE.
1,.ow do o+ sort in a COBOL program# 9ive sort fi!e definition8 sort
statement snta6 and meaning.
Sn#a=@
SORT &ile-6 ON ASCENDIN>DESCENDIN ?E7 1e....
USIN &ile-9IVIN &ile-.
USIN can "e 'u"'#i#u#e$ " INPUT PROCEDURE IS para-6 T3RU para-9
IVIN can "e 'u"'#i#u#e$ " OUTPUT PROCEDURE IS para-6 T3RU para-9.&ile-6 i' #he ')r# 4)r1&ile an$ mu'# "e $e'cri"e$ u'in0 SD en#r in FI+E SECTION.
&ile-9 i' #he inpu# &ile &)r #he SORT an$ mu'# "e $e'cri"e$ u'in0 an FD en#r in FI+E
SECTION an$ SE+ECT clau'e in FI+E CONTRO+.&ile- i' #he )u#&ile &r)m #he SORT an$ mu'# "e $e'cri"e$ u'in0 an FD en#r in FI+E
SECTION an$ SE+ECT clau'e in FI+E CONTRO+.
&ile-6, &ile-9 &ile- 'h)ul$ n)# "e )pene$ e=plici#l.
INPUT PROCEDURE i' e=ecu#e$ "e&)re #he ')r# an$ rec)r$' mu'# "e RE+EASE$ #)#he ')r# 4)r1 &ile &r)m #he inpu# pr)ce$ure.
OUTPUT PROCEDURE i' e=ecu#e$ aer all rec)r$' hae "een ')r#e$. Rec)r$' &r)m
#he ')r# 4)r1 &ile mu'# "e RETURNe$ )ne a# a #ime #) #he )u#pu# pr)ce$ure.
1.ow do o+ define a sort fi!e in CL that r+ns the COBOL program#
U'e #he SORT
-
8/12/2019 COBOL Interview Questions Answers 1
3/29
-
8/12/2019 COBOL Interview Questions Answers 1
4/29
Sc)pe #ermina#)r i' u'e$ #) mar1 #he en$ )& a er" e.0. EVA+UATE, END-
EVA+UATE IF, END-IF.
2,.ow do o+ do in-!ine N(?% /(N%(NC( #
CONTINUE i' li1e a null '#a#emen# ($) n)#hin0! , 4hile NET SENTENCE
#ran'&er' c)n#r)l #) #he ne=# 'en#ence (! (A 'en#ence i' #ermina#e$ " a peri)$!
2.What does (?I% do #
D)e' n)#hin0 I& u'e$, mu'# "e #he )nl 'en#ence 4i#hin a para0raph.
24.Can I redefine an ?@155A fie!d with a fie!d of ?@255A#
7e'. Re$e&ine' Ju'# cau'e' ")#h &iel$' #) '#ar# a# #he 'ame l)ca#i)n. F)r e=ample@
26
-
8/12/2019 COBOL Interview Questions Answers 1
5/29
I& n)ne )& #he'e are help&ul, u'e Ju$0emen# an$ DISP+A7 #) l)caliLe #he ')urce )&
err)r.
S)me in'#all#i)n mi0h# hae "a#ch pr)0ram $e"u00in0 #))l'. U'e #hem.
$1.ow is sign stored in COM9! 5 6!!, 4here nK in #hi' e=ample.
$.ow man "tes does a /4@*A /I9N %&ILIN9 /(
-
8/12/2019 COBOL Interview Questions Answers 1
6/29
")un$arie' in #he mem)r. F)r e=ample, )n main &rame #he mem)r 4)r$ 'iLe i'
"#e'. Thi' mean' #ha# each 4)r$ 4ill '#ar# &r)m an a$$re'' $ii'i"le " . I& m &ir'#
aria"le i' =(! an$ ne=# )ne i' '%(! c)mp, #hen i& )u $) n)# 'peci& #he S7NCclau'e, S%(! COMP 4ill '#ar# &r)m "#e ( a''umin0 #ha# i# '#ar#' &r)m 2 !. I& )u
'peci& S7NC, #hen #he "inar $a#a i#em 4ill '#ar# &r)m a$$re'' . 7)u mi0h# 'ee
')me 4a'#a0e )& mem)r, "u# #he acce'' #) #hi' c)mpu#a#i)nal &iel$ i' &a'#er.
)2.What is the ma6im+m siDe of a 51 !eve! item in COBOL I# in COBOL II#
In CO;O+ II@ 6:KKK968
)$.ow do o+ reference the fo!!owing fi!e formats from COBOL programs:
Fi=e$ ;l)c1 File - U'e ORANISATION IS SEUENTIA+. U'e RECORDIN
MODE IS F, ;+OC? CONTAINS 2 .Fi=e$ Un"l)c1e$ - U'e ORANISATION IS SEUENTIA+. U'e RECORDIN
MODE IS F, $) n)# u'e ;+OC? CONTAINS
Varia"le ;l)c1 File - U'e ORANISATION IS SEUENTIA+. U'e RECORDIN
MODE IS V, ;+OC? CONTAINS 2. D) n)# c)$e #he "#e' &)r rec)r$ len0#h in FDie C+ rec len0#h 4ill "e ma= rec len0#h in p0m 5
Varia"le Un"l)c1e$ - U'e ORANISATION IS SEUENTIA+. U'e RECORDINMODE IS V, $) n)# u'e ;+OC? CONTAINS. D) n)# c)$e "#e' &)r rec)r$ len0#h
in FD ie C+ rec len0#h 4ill "e ma= rec len0#h in p0m 5 .
ESDS VSAM &ile - U'e ORANISATION IS SEUENTIA+.?SDS VSAM &ile - U'e ORANISATION IS INDEED, RECORD ?E7 IS,
A+TERNATE RECORD ?E7 IS
RRDS File - U'e ORANISATION IS RE+ATIVE, RE+ATIVE ?E7 IS
Prin#er File - U'e ORANISATION IS SEUENTIA+. U'e RECORDIN MODEIS F, ;+OC? CONTAINS 2. (U'e RECFMF;A in C+ DC;!.
)).What are different fi!e O
-
8/12/2019 COBOL Interview Questions Answers 1
7/29
Mi'ma#ch in +REC+ )r ;+OC?SI*E )r RECFM "e#4een )ur CO;O+ p0m #he
C+ ()r #he $a#a'e# la"el!. 7)u 4ill 0e# &ile '#a#u' % )n an OPEN.
,5.What is /tatic87namic !ining #
In '#a#ic lin1in0, #he calle$ 'u"r)u#ine i' lin1-e$i#e$ in#) #he callin0 pr)0ram , 4hile in
$namic lin1in0, #he 'u"r)u#ine #he main pr)0ram 4ill e=i'# a' 'epara#e l)a$m)$ule'. 7)u ch))'e '#a#ic>$namic lin1in0 " ch))'in0 ei#her #he D7NAM )r
NOD7NAM lin1 e$i# )p#i)n. (Een i& )u ch))'e NOD7NAM, a CA++ i$en#i&ier
(a' )pp)'e$ #) a CA++ li#eral!, 4ill #ran'la#e #) a D7NAMIC call!.A '#a#icall calle$ 'u"r)u#ine 4ill n)# "e in i#' ini#ial '#a#e #he ne=# #ime i# i' calle$
unle'' )u e=plici#l u'e INITIA+ )r )u $) a CANCE+. A $namicall calle$
r)u#ine 4ill al4a' "e in i#' ini#ial '#a#e.
,1.What is &MO7(@2)A8 &MO7(@$1A8 MO7(@2)A and MO7(@&NA#
@ app!ica"!e to on! M;/3(/& (nterprise /erverA.
The'e are c)mpile>lin1 e$i# )p#i)n'.
AMODE - A$$re''in0 m)$e. RMODE - Re'i$enc m)$e.AMODE(9! - 9 "i# a$$re''in0. AMODE(6! - 6 "i# a$$re''in0. AMODE(AN7! -
Ei#her 9 "i# )r 6 "i# a$$re''in0 $epen$in0 )n RMODE.RMODE(9! - Re'i$e' in ir#ual '#)ra0e "el)4 6: Me0 line. U'e #hi' &)r 6 "i#
pr)0ram' #ha# call 9 "i# pr)0ram'. (OS>VS C)")l p0m' u'e 9 "i# a$$re''e' )nl!.
RMODE(AN7! - Can re'i$e a")e )r "el)4 6: Me0 line.
,2.What compi!er option wo+!d o+ +se for dnamic !ining#
D7NAM.
,$.What is //&N9(8 NO//&N9( #
The'e are c)mpiler )p#i)n' 4.r.# 'u"'crip# )u# )& ran0e chec1in0. NOSSRANE i'
#he $e&aul# an$ i& ch)'en, n) run #ime err)r 4ill "e &la00e$ i& )ur in$e= )r 'u"'crip#0)e' )u# )& #he permi''i"le ran0e.
,).ow do o+ set a ret+rn code to the CL from a COBOL program#
M)e a alue #) RETURN-CODE re0i'#er. RETURN-CODE 'h)ul$ n)# "e $eclare$
in )ur pr)0ram.
,,.ow can o+ s+"mit a Eo" from COBOL programs#
>======= S7SOUT(A,INTRDR! 4here BAB i' )u#pu# cla'', an$ $a#a'e# 'h)ul$ "e
)pene$ &)r )u#pu# in #he pr)0ram. De&ine a 2 "#e rec)r$ la)u# &)r #he &ile.
,.What are the differences "etween O/ ;/ COBOL and ;/ COBOL II#
OS>VS C)")l p0m' can )nl run in 9 "i# a$$re''in0 m)$e, VS C)")l II p0m' canrun ei#her in 9 "i# )r 6 "i# a$$re''in0 m)$e'.
Rep)r# 4ri#er i' 'upp)r#e$ )nl in OS>VS C)")l.
USAE IS POINTER i' 'upp)r#e$ )nl in VS CO;O+ II.
-
8/12/2019 COBOL Interview Questions Answers 1
8/29
Re&erence m)$i&ica#i)n e0@ VS C)")l &)ll)4' ANSI K '#$' 4hile VS CO;O+ II &)ll)4' ANSI 8 '#$'.
Un$er CICS Call' "e#4een VS CO;O+ II pr)0ram' are 'upp)r#e$.
,*.What are the steps o+ go thro+gh whi!e creating a COBOL program
e6ec+ta"!e#
D;9 prec)mpiler(i& em"e$$e$ '/l u'e$!, CICS #ran'la#)r (i& CICS p0m!, C)")lc)mpiler, +in1 e$i#)r.
I& D;9 pr)0ram, crea#e plan " "in$in0 #he D;RM'.
,.Can o+ ca!! an O/ ;/ COBOL pgm from a ;/ COBOL II pgm #
In n)n-CICS enir)nmen#, i# i' p)''i"le. In CICS, #hi' i' n)# p)''i"le.
F1A Name the divisions in a COBOL program #.
A6! IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION,
PROCEDURE DIVISION.
Q2) What are the different data types available in COBOL?
A9! Alpha-numeric (!, alpha"e#ic (A! an$ numeric (%!.
Q3) What does the INITIALI! verb do? - GS
A! Alpha"e#ic, Alphanumeric &iel$' alphanumeric e$i#e$ i#em' are 'e# #) SPACES.Numeric, Numeric e$i#e$ i#em' 'e# #) *ERO. FI++ER , OCCURS DEPENDIN ON
i#em' le un#)uche$.
Q") What is ## level $sed for ?
A! Elemen#ar leel i#em. Cann)# "e 'u"$ii'i)n' )& )#her i#em' (cann)# "e /uali&ie$!,n)r can #he "e 'u"$ii$e$ #hem'ele'.
Q%) What is && level $sed for ?
-
8/12/2019 COBOL Interview Questions Answers 1
9/29
A8! F)r c)n$i#i)n name'.
Q') What is level '' $sed for ?
A:! F)r RENAMES clau'e.
Q#) What does the I( N*!+IC ,la$se establish ?
AK! IS NUMERIC can "e u'e$ )n alphanumeric i#em', 'i0ne$ numeric pac1e$
$ecimal i#em' an$ un'i0ne$ numeric pac1e$ $ecimal i#em'. IS NUMERIC re#urn'
TRUE i& #he i#em )nl c)n'i'#' )& 2-%. 3)4eer, i& #he i#em "ein0 #e'#e$ i' a 'i0ne$ i#em,
#hen i# ma c)n#ain 2-%, 5 an$ - .
Q&) -o. do yo$ define a table/array in COBOL?
A%! N).
Q10) What is the difference between index and subscript? - GS
A66! SEARC3 - i' a 'erial 'earch.
SEARC3 A++ - i' a "inar 'earch #he #a"le mu'# "e ')r#e$( ASCENDIN>DESCENDIN ?E7 clau'e #) "e u'e$ $a#a l)a$e$ in #hi' )r$er!
"e&)re u'in0 SEARC3 A++.
Q12) What should be the sorting order for SE!"# $$? - GS
A6! Search )n a ')r#e$ arra. C)mpare #he i#em #) "e 'earche$ 4i#h #he i#em a# #hecen#er. I& i# ma#che', &ine el'e repea# #he pr)ce'' 4i#h #he le hal& )r #he ri0h# hal&
$epen$in0 )n 4here #he i#em lie'.
Q1%) &' progra( has an arra' defined to hae 10 ite(s* +ue to a bug, find thateen if the progra( access the
11th ite( in this arra', the progra( does not abend* What is wrong with it?
-
8/12/2019 COBOL Interview Questions Answers 1
10/29
A68! Sn#a=@ SORT &ile-6 ON ASCENDIN>DESCENDIN ?E7 1e.... USIN &ile-
9 IVIN &ile-.
USIN can "e 'u"'#i#u#e$ " INPUT PROCEDURE IS para-6 T3RU para-9
IVIN can "e 'u"'#i#u#e$ " OUTPUT PROCEDURE IS para-6 T3RU para-9.
&ile-6 i' #he ')r# (4)r1! &ile an$ mu'# "e $e'cri"e$ u'in0 SD en#r in FI+E
SECTION.
&ile-9 i' #he inpu# &ile &)r #he SORT an$ mu'# "e $e'cri"e$ u'in0 an FD en#r inFI+E SECTION an$ SE+ECT
clau'e in FI+E CONTRO+.
&ile- i' #he )u# &ile &r)m #he SORT an$ mu'# "e $e'cri"e$ u'in0 an FD en#r in
FI+E SECTION an$ SE+ECT
clau'e in FI+E CONTRO+.
&ile-6, &ile-9 &ile- 'h)ul$ n)# "e )pene$ e=plici#l.
INPUT PROCEDURE i' e=ecu#e$ "e&)re #he ')r# an$ rec)r$' mu'# "e RE+EASE$
#) #he ')r# 4)r1 &ile &r)m #he inpu# pr)ce$ure.
OUTPUT PROCEDURE i' e=ecu#e$ aer all rec)r$' hae "een ')r#e$. Rec)r$'
&r)m #he ')r# 4)r1 &ile mu'# "e RETURNe$ )ne a# a #ime #) #he )u#pu# pr)ce$ure.
Q1.) #ow do 'ou define a sort file in /"$ that runs the "$ progra(?
A6K! Per&)rmin0 a SECTION 4ill cau'e all #he para0raph' #ha# are par# )& #he 'ec#i)n,#) "e per&)rme$.
Per&)rmin0 a PARARAP3 4ill cau'e )nl #ha# para0raph #) "e per&)rme$.
Q1) What is the use of E3$45E state(ent? - GS
-
8/12/2019 COBOL Interview Questions Answers 1
11/29
-
8/12/2019 COBOL Interview Questions Answers 1
12/29
Q22) What is a scope ter(inator? Gie exa(ples*
A9! PERFORM ... GUNTI+H ...
G'en#ence'H
END-PERFORM
Q2%) When would 'ou use in-line perfor(?
A98! The appear #) "e 'imilar, #ha# i', #he c)n#r)l 0)e' #) #he ne=# 'en#ence in #he
para0raph. ;u#, Ne=# Sen#ence 4)ul$
#a1e #he c)n#r)l #) #he 'en#ence aer i# &in$' a &ull '#)p (.!. Chec1 )u# " 4ri#in0 #he
&)ll)4in0 c)$e e=ample, )ne i&
'en#ence &)ll)4e$ " $i'pla '#a#emen#' (')rr #he appear )ne line here "ecau'e)& &)rma##in0 re'#ric#i)n'! I& 6 H 2
#hen ne=# 'en#ence en$ i& $i'pla Bline 6B $i'pla Bline 9B. $i'pla Bline B. N)#e-
#here i' a $)# (.! )nl a# #he en$ )&
#he la'# 9 '#a#emen#', 'ee #he e&&ec# " replacin0 Ne=# Sen#ence 4i#h C)n#inue
Q2.) What does E75 do ?
A9K! 7e'. Re$e&ine' Ju'# cau'e' ")#h &iel$' #) '#ar# a# #he 'ame l)ca#i)n. F)r e=ample@
26
-
8/12/2019 COBOL Interview Questions Answers 1
13/29
Q2&) Can I redefine an 012) field .ith a field of 01) ?
A6! 7e'.
Q81) What do yo$ do to resolve (OC4# error? 4 5(
A6! ;a'icall )u nee$ #) c)rrec#in0 #he )&&en$in0 $a#a. Man #ime' #he rea')n &)rSOCK i' an un-ini#ialiLe$ numeric i#em.
E=amine #ha# p)''i"ili# &ir'#. Man in'#alla#i)n' pr)i$e )u a $ump &)r run #ime
a"en$' ( i# can "e 0enera#e$ al')
" callin0 ')me 'u"r)u#ine' )r OS 'erice' #hru a''em"l lan0ua0e!. The'e $ump'
pr)i$e #he )&&'e# )& #he la'#
in'#ruc#i)n a# 4hich #he a"en$ )ccurre$. E=amine #he c)mpila#i)n )u#pu# REF
li'#in0 #) 0e# #he er" an$ #he line
num"er )& #he ')urce c)$e a# #hi' )&&'e#. Then )u can l))1 a# #he ')urce c)$e #)
&in$ #he "u0. T) 0e# cap#ure #he
run#ime $ump', )u 4ill hae #) $e&ine ')me $a#a'e#' (S7SA;OUT e#c ! in #heC+. I& n)ne )& #he'e are help&ul, u'e
Ju$0emen# an$ DISP+A7 #) l)caliLe #he ')urce )& err)r. S)me in'#alla#i)n mi0h#
hae "a#ch pr)0ram $e"u00in0
#))l'. U'e #hem.
Q82) #ow is sign stored in 9ac:ed +eci(al fields and ;oned +eci(al fields?
A9! Pac1e$ Decimal &iel$'@ Si0n i' '#)re$ a' a he= alue in #he la'# ni""le (
"i#' ! )& #he '#)ra0e.
*)ne$ Decimal &iel$'@ A' a $e&aul#, 'i0n i' )er punche$ 4i#h #he numericalue '#)re$ in #he la'# "i#e.
Q88) #ow is sign stored in a co(p-8 field? - GS
A! I# i' '#)re$ in #he la'# ni""le. F)r e=ample i& )ur num"er i' 5622, i# '#)re' he=
2C in #he la'# "#e, he= 6C i&
-
8/12/2019 COBOL Interview Questions Answers 1
14/29
-
8/12/2019 COBOL Interview Questions Answers 1
15/29
-
8/12/2019 COBOL Interview Questions Answers 1
16/29
Fi=e$ Un"l)c1e$ - U'e ORANISATION IS SEUENTIA+. U'e RECORDIN
MODE IS F,
$) n)# u'e ;+OC? CONTAINS
Varia"le ;l)c1 File - U'e ORANISATION IS SEUENTIA+. U'eRECORDIN MODE IS V, ;+OC?
CONTAINS 2. D) n)# c)$e #he "#e' &)r rec)r$ len0#h in
FD ie C+ rec len0#h 4ill "e ma= rec len0#h in p0m 5
Varia"le Un"l)c1e$ - U'e ORANISATION IS SEUENTIA+. U'eRECORDIN MODE IS V, $) n)# u'e
;+OC? CONTAINS. D) n)# c)$e "#e' &)r rec)r$
len0#h in FD ie C+ rec len0#h 4ill
"e ma= rec len0#h in p0m 5 .
ESDS VSAM &ile - U'e ORANISATION IS SEUENTIA+.
?SDS VSAM &ile - U'e ORANISATION IS INDEED, RECORD ?E7 IS,A+TERNATE RECORD ?E7 IS RRDS File - U'e ORANISATION IS
RE+ATIVE, RE+ATIVE ?E7 IS
Prin#er File - U'e ORANISATION IS SEUENTIA+. U'e
RECORDIN MODE IS F, ;+OC?
CONTAINS 2. (U'e RECFMF;A in C+ DC;!.
Q"%) What are different file O7!N :odes available in COBOL?
A8! Open &)r INPUT, OUTPUT, I-O, ETEND.
Q"') What is the :ode in .hi,h yo$ .ill O7!N a file for .ritin6? 4 5(
A:! OUTPUT, ETEND
Q"#) In the CL@ ho. do yo$ define the files referred to in a s$bro$tine ?
-
8/12/2019 COBOL Interview Questions Answers 1
17/29
AK! Suppl #he DD car$' Ju'# a' )u 4)ul$ &)r &ile' re&erre$ #) in #he main pr)0ram.
Q"&) Can yo$ +!W+IT! a re,ord in an !(( file? Can yo$ !L!T! a re,ord
fro: it?
A! Can re4ri#e (rec)r$ len0#h mu'# "e 'ame!, "u# n)# $ele#e.
Q"9) What is file stat$s 92? 4 5(
A%! +)0ic err)r. e.0., a &ile i' )pene$ &)r inpu# an$ an a##emp# i' ma$e #) 4ri#e #) i#.
Q%) What is file stat$s 39 ?
A82! Mi'ma#ch in +REC+ )r ;+OC?SI*E )r RECFM "e#4een )ur CO;O+ p0m #he C+ ()r #he $a#a'e# la"el!. 7)u
4ill 0e# &ile '#a#u' % )n an OPEN.
Q%) What is (tati, and yna:i, linin6 ?
A86! In '#a#ic lin1in0, #he calle$ 'u"r)u#ine i' lin1-e$i#e$ in#) #he callin0 pr)0ram ,4hile in $namic lin1in0, #he 'u"r)u#ine
#he main pr)0ram 4ill e=i'# a' 'epara#e l)a$ m)$ule'. 7)u ch))'e '#a#ic>$namic
lin1in0 " ch))'in0 ei#her #he
D7NAM )r NOD7NAM lin1 e$i# )p#i)n. (Een i& )u ch))'e NOD7NAM, a
CA++ i$en#i&ier (a' )pp)'e$ #) a
CA++ li#eral!, 4ill #ran'la#e #) a D7NAMIC call!.
A '#a#icall calle$ 'u"r)u#ine 4ill n)# "e in i#' ini#ial '#a#e #he ne=# #ime i# i' calle$unle'' )u e=plici#l u'e INITIA+
)r )u $) a CANCE+. A $namicall calle$ r)u#ine 4ill al4a' "e in i#' ini#ial
'#a#e.
-
8/12/2019 COBOL Interview Questions Answers 1
18/29
Q%2) What is A*O!12")@ A*O!13)@ +*O!12") and +*O!1AN
-
8/12/2019 COBOL Interview Questions Answers 1
19/29
Q%') -o. ,an yo$ s$b:it a Eob fro: COBOL pro6ra:s?
A8:! >======= S7SOUT (A,INTRDR! 4here BAB
i' )u#pu# cla'', an$ $a#a'e# 'h)ul$ "e
)pene$ &)r )u#pu# in #he pr)0ram. De&ine a 2 "#e rec)r$ la)u# &)r #he &ile.
Q%#) What are the differen,es bet.een O( ( COBOL and ( COBOL II?
A8K! OS>VS C)")l p0m' can )nl run in 9 "i# a$$re''in0 m)$e, VS C)")l II p0m'
can run ei#her in 9 "i# )r 6 "i#
a$$re''in0 m)$e'.
I. Rep)r# 4ri#er i' 'upp)r#e$ )nl in OS>VS C)")l.
II. USAE IS POINTER i' 'upp)r#e$ )nl in VS CO;O+ II.
III. Re&erence m)$i&ica#i)n e.0.@ VS C)")l &)ll)4' ANSI K '#$' 4hile VS CO;O+ II &)ll)4' ANSI 8
'#$'.
VII. Un$er CICS Call' "e#4een VS CO;O+ II pr)0ram' are 'upp)r#e$.
Q%&) What are the steps yo$ 6o thro$6h .hile ,reatin6 a COBOL pro6ra:e;e,$table?
A8! D;9 prec)mpiler (i& em"e$$e$ S+ u'e$!, CICS #ran'la#)r (i& CICS p0m!,
C)")l c)mpiler, +in1 e$i#)r. I& D;9
pr)0ram, crea#e plan " "in$in0 #he D;RM'.
-
8/12/2019 COBOL Interview Questions Answers 1
20/29
Q%9) Can yo$ ,all an O( ( COBOL p6: fro: a ( COBOL II p6: ?
A8%! In n)n-CICS enir)nmen#, i# i' p)''i"le. In CICS, #hi' i' n)# p)''i"le.
Q') What are the differen,es bet.een COBOL and COBOL II?
A:2! There are a# lea'# &ie $i&&erence'@
CO;O+ II 'upp)r#' '#ruc#ure$ pr)0rammin0 " u'in0 in line Per&)rm' an$ e=plici#'c)pe #ermina#)r', I# in#r)$uce'
ne4 &ea#ure' (EVA+UATE, SET. TO TRUE, CA++. ;7 CONTET, e#c! I#
permi#' pr)0ram' #) "e l)a$e$ an$
a$$re''e$ a")e #he 6:-me0a"#e line I# $)e' n)# 'upp)r# man )l$ &ea#ure'(READ7 TRACE, REPORT-
-
8/12/2019 COBOL Interview Questions Answers 1
21/29
Q63) What is the diffeen!e between "E#$ %E"$E"&E and&O"$'"(E?
A:! NET SENTENCE 0ie' c)n#r)l #) #he er" &)ll)4in0 #he ne=# peri)$.CONTINUE 0ie' c)n#r)l #) #he ne=# er" aer #he e=plici# 'c)pe #ermina#)r. (Thi'
i' n)# )ne )& CO;O+ IIB' &iner implemen#a#i)n'!. I#B' 'a&e'# #) u'e CONTINUEra#her #han NET SENTENCE in CO;O+ II.
Q6) What &O*O+ !onstu!t is the &O*O+ '' E,A+(A$E-eant to e.la!e?
A:! EVA+UATE can "e u'e$ in place )& #he ne'#e$ IF T3EN E+SE '#a#emen#'.
Q6/) What is the signifi!an!e of 0abo1e the line0 and 0below theline0?
A:8! ;e&)re I;M in#r)$uce$ MVS>A archi#ec#ure in #he 6%2B' a pr)0ramB' ir#ual
'#)ra0e 4a' limi#e$ #) 6: me0'. Pr)0ram' c)mpile$ 4i#h a 9 "i# m)$e can )nl
a$$re'' 6: M" )& 'pace, a' #h)u0h #he 4ere 1ep# un$er an ima0inar '#)ra0e line.
-
8/12/2019 COBOL Interview Questions Answers 1
22/29
Q6) What is the linage se!tion?
A:! The lin1a0e 'ec#i)n i' par# )& a calle$ pr)0ram #ha# Blin1'B )r map' #) $a#a i#em'
in #he callin0 pr)0ramB' 4)r1in0 '#)ra0e. I# i' #he par# )& #he calle$ pr)0ram 4here#he'e 'hare i#em' are $e&ine$.
Q64) What is the diffeen!e between a subs!i.t and an inde5in a table definition?
A:%! A 'u"'crip# i' a 4)r1in0 '#)ra0e $a#a $e&ini#i)n i#em, #picall a PIC (%%%! 4herea alue mu'# "e m)e$ #) #he 'u"'crip# an$ #hen incremen#e$ )r $ecremen#' "
ADD TO an$ SU;TRACT FROM '#a#emen#'. An in$e= i' a re0i'#er i#em #ha#
e=i'#' )u#'i$e #he pr)0ramB' 4)r1in0 '#)ra0e. 7)u SET an in$e= #) a alue an$SET i# UP ;7 alue an$ DO
-
8/12/2019 COBOL Interview Questions Answers 1
23/29
-
8/12/2019 COBOL Interview Questions Answers 1
24/29
Q) What is +E";$: in &O*O+ ''?
AK! +ENT3 ac#' li1e a 'pecial re0i'#er #) #ell #he len0#h )& a 0r)up )r elemen#ar
i#em.
Q=6) What is the difference between a binar' search and a se@uential search? Whatare the pertinent "$
commands#
AK%! In a "inar 'earch #he #a"le elemen# 1e alue' mu'# "e in a'cen$in0 )r
$e'cen$in0 'e/uence. The #a"le i' Bhale$B #) 'earch &)r e/ual #), 0rea#er #han )rle'' #han c)n$i#i)n' un#il #he elemen# i' &)un$. In a 'e/uen#ial 'earch #he #a"le i'
'earche$ &r)m #)p #) ")##)m, ') (ir)nicall! #he elemen#' $) n)# hae #) "e in a
'peci&ic 'e/uence. The "inar 'earch i' much &a'#er &)r lar0er #a"le', 4hile'e/uen#ial 4)r1' 4ell 4i#h 'maller )ne'. SEARC3 A++ i' u'e$ &)r "inar
'earche' SEARC3 &)r 'e/uen#ial.
Q7) What is the .oint of the REP+A&'"; o.tion of a !o.ystate-ent?
A2! REP+ACIN all)4' &)r #he 'ame c)p #) "e u'e$ m)re #han )nce in #he 'ame
c)$e " chan0in0 #he replace alue.
COBOL Interview F+estions &nswers 1
ow is sign stored in
-
8/12/2019 COBOL Interview Questions Answers 1
25/29
%he ma6im+m n+m"er of dimensions that an arra can have in COBOL-, is
HHHHHHHH.
&ns:SEVEN in CO;O+ - 8 an$ T3REE in CO;O+ -
Name the divisions in a COBOL program.&ns:IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION,
PROCEDURE DIVISION.
What do o+ do to reso!ve /OC-* error#
&ns:There i' a nee$ e$ #) c)rrec# #he )&&en$in0 $a#a. Man #ime' #he rea')n &)r SOCK i'
an un-ini#ialiLe$ numeric i#em. E=amine #ha# p)''i"ili# &ir'#. Man in'#alla#i)n' pr)i$e
)u a $ump &)r run #ime a"en$' ( i# can "e 0enera#e$ al') " callin0 ')me 'u"r)u#ine' )rOS 'erice' #hru a''em"l lan0ua0e!. The'e $ump' pr)i$e #he )&&'e# )& #he la'#
in'#ruc#i)n a# 4hich #he a"en$ )ccurre$. E=amine #he c)mpila#i)n )u#pu# REF li'#in0 #)
0e# #he er" an$ #he line num"er )& #he ')urce c)$e a# #hi' )&&'e#. Then )u can l))1 a#
#he ')urce c)$e #) &in$ #he "u0. T) 0e# cap#ure #he run#ime $ump', )u 4ill hae #)$e&ine ')me $a#a'e#' (S7SA;OUT e#c ! in #he C+. I& n)ne )& #he'e are help&ul, u'e
Ju$0emen# an$ DISP+A7 #) l)caliLe #he ')urce )& err)r. 7)u ma een u'e "a#chpr)0ram $e"u00in0 #))l'.
What are the different data tpes avai!a"!e in COBOL#
&ns:Alpha-numeric (!, alpha"e#ic (A! an$ numeric (%!.
What is !eve! +sed for #
&ns:F)r RENAMES clau'e.
What does the I/ N0M(IC c!a+se esta"!ish#
&ns:IS NUMERIC can "e u'e$ )n alphanumeric i#em', 'i0ne$ numeric pac1e$$ecimal i#em' an$ un'i0ne$ numeric pac1e$ $ecimal i#em'. IS NUMERIC re#urn'
TRUE i& #he i#em )nl c)n'i'#' )& 2-%. 3)4eer, i& #he i#em "ein0 #e'#e$ i' a 'i0ne$ i#em,
#hen i# ma c)n#ain 2-%, 5 an$ - .
M program has an arra defined to have 15 items. 7+e to a "+g8 I find that even if
the program access the 11th item in this arra8 the program does not a"end. What is
wrong with it#
&ns:Mu'# u'e c)mpiler )p#i)n SSRANE i& )u 4an# arra ")un$' chec1in0. De&aul# i'
NOSSRANE.
What is the difference "etween performing a /(C%ION and a
-
8/12/2019 COBOL Interview Questions Answers 1
26/29
What does (?I% do#
&ns:D)e' n)#hin0 I& u'e$, mu'# "e #he )nl 'en#ence 4i#hin a para0raph.
ow is sign stored in a comp-$ fie!d#
&ns:I# i' '#)re$ in #he la'# ni""le. F)r e=ample i& )ur num"er i' 5622, i# '#)re' he= 2Cin #he la'# "#e, he= 6C i& )ur num"er i' 626, he= 6D i& #he num"er i' -626, he= 9D i& #he
num"er i' -629 e#c...
ow is sign stored in a COM< fie!d #
&ns:In #he m)'# 'i0ni&ican# "i#. ;i# i' )n i& -e, )&& i& 5e.
What are some e6amp!es of command terminators#
&ns:END-IF, END-EVA+UATE
Can I redefine an ?@155A fie!d with a fie!d of ?@255A#
&ns:7e'. Re$e&ine' Ju'# cau'e' ")#h &iel$' #) '#ar# a# #he 'ame l)ca#i)n. F)r e=ample@26
-
8/12/2019 COBOL Interview Questions Answers 1
27/29
show. 7o o+ do o+r checing for "reas and how do o+ do add to each !eve!#
&ns:Al4a' c)mpare )n #he hi0he'#-leel &ir'#, "ecau'e i& )u hae a "rea1 a# a hi0he'#
leel, each leel "enea#h i# mu'# al') "rea1. A$$ #) #he l)4e'# leel &)r each rec "u# a$$#) #he hi0her leel )nl )n "rea1.
What is the Importance of 9LOB&L c!a+se &ccording to new standards of COBOL&ns:
-
8/12/2019 COBOL Interview Questions Answers 1
28/29
ow can I te!! if a mod+!e is "eing ca!!ed 7N&MIC&LL or /%&%IC&LL#
&ns:The ON+7 4a i' #) l))1 a# #he )u#pu# )& #he lin1a0e e$i#)r (IE
-
8/12/2019 COBOL Interview Questions Answers 1
29/29
&ns:PIC %.%% i' a &)ur p)'i#i)n &iel$ #ha# ac#uall c)n#ain' a $ecimal p)in# 4here a'
%%% i' a #hree p)'i#i)n numeric &iel$ 4i#h an implie$ )r a''ume$ $ecimal p)in#.