You are on page 1of 19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

mainframesguru.in

Searchthissite

COBOLInterviewQuestions
AboutUsServicesCoursesCaseStudiesMainframeForum
MainframeJobsContactUsMainframeConnectivity

Tutorials:
DB2Tutorial
CICSTutorial
VSAMTutorial
COBOLTutorials
JCLTutorial
Tools:
XpediterforBatch
FileAidTutorial

Utilities:
JCLUtilities
SortUtility
CompileJCL's

AbendCodes
FileStatusCodes
JCLABENDCodes
CICSABENDCodes
DB2/SQLReturn
Codes

Questions:
COBOLFAQ
CICSFAQ
JCLFAQ
VSAMFAQ
DB2FAQ

COBOLINTERVIEWQUESTIONS

Q1)NamethedivisionsinaCOBOLprogram?.
A1)IDENTIFICATIONDIVISION,ENVIRONMENT
DIVISION,DATADIVISION,PROCEDURE
DIVISION.

Q2)Whatarethedifferentdatatypesavailablein
COBOL?
A2)Alphanumeric(X),alphabetic(A)andnumeric(9).

Q3)WhatdoestheINITIALIZEverbdo?GS
A3)Alphabetic,Alphanumericfields&alphanumeric
editeditemsaresettoSPACES.Numeric,Numeric
editeditemssettoZERO.FILLER,OCCURS
DEPENDINGONitemsleftuntouched.

Q4)Whatis77levelusedfor?
A4)Elementarylevelitem.Cannotbesubdivisionsof
otheritems(cannotbequalified),norcantheybe
subdividedthemselves.

Q5)Whatis88levelusedfor?
A5)Forconditionnames.

Q6)Whatislevel66usedfor?
A6)ForRENAMESclause.

Q7)WhatdoestheISNUMERICclauseestablish?
A7)ISNUMERICcanbeusedonalphanumeric
items,signednumeric&packeddecimalitemsand
unsignednumeric&packeddecimalitems.IS
NUMERICreturnsTRUEiftheitemonlyconsistsof
09.However,iftheitembeingtestedisasigned
item,thenitmaycontain09,+and.

Q8)Howdoyoudefineatable/arrayinCOBOL?
A8)ARRAYS.
05ARRAY1PICX(9)OCCURS10
TIMES.
05ARRAY2PICX(6)OCCURS20
TIMESINDEXEDBYWSINDEX.

Q9)CantheOCCURSclausebeatthe01level?
A9)No.

Q10)Whatisthedifferencebetweenindexand

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

1/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

subscript?GS
A10)Subscriptreferstothearrayoccurrencewhile
indexisthedisplacement(innoofbytes)fromthe
beginningofthearray.
Anindexcanonlybemodifiedusing
PERFORM,SEARCH&SET.Needtohaveindexfor
atableinordertouseSEARCH,SEARCHALL.

Q11)WhatisthedifferencebetweenSEARCHand
SEARCHALL?GS
A11)SEARCHisaserialsearch.
SEARCHALLisabinarysearch&thetablemust
besorted(ASCENDING/DESCENDINGKEY
clausetobeused&dataloadedinthisorder)before
usingSEARCHALL.

Q12)WhatshouldbethesortingorderforSEARCH
ALL?GS
A12)ItcanbeeitherASCENDINGor
DESCENDING.ASCENDINGisdefault.Ifyou
wantthesearchtobedoneonanarraysortedin
descendingorder,thenwhiledefiningthearray,you
shouldgiveDESCENDINGKEYclause.(Youmust
loadthetableinthespecifiedorder).

Q13)Whatisbinarysearch?
A13)Searchonasortedarray.Comparetheitemto
besearchedwiththeitematthecenter.Ifitmatches,
fineelserepeattheprocesswiththelefthalforthe
righthalfdependingonwheretheitemlies.

Q14)Myprogramhasanarraydefinedtohave10
items.Duetoabug,Ifindthateveniftheprogram
accessthe
11thiteminthisarray,theprogramdoesnot
abend.Whatiswrongwithit?

A14)MustusecompileroptionSSRANGEifyou
wantarrayboundschecking.Defaultis
NOSSRANGE.

Q15)HowdoyousortinaCOBOLprogram?Give
sortfiledefinition,sortstatementsyntaxandmeaning.
GS
A15)Syntax:SORTfile1ON
ASCENDING/DESCENDINGKEYkey....USING
file2GIVINGfile3.

USINGcanbesubstitutedbyINPUT
PROCEDUREISpara1THRUpara2
GIVINGcanbesubstitutedbyOUTPUT
PROCEDUREISpara1THRUpara2.

file1isthesort(work)fileandmustbedescribed
usingSDentryinFILESECTION.
file2istheinputfilefortheSORTandmustbe
describedusinganFDentryinFILESECTIONand
SELECT
clauseinFILECONTROL.
file3istheoutfilefromtheSORTandmustbe
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

2/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

describedusinganFDentryinFILESECTIONand
SELECT
clauseinFILECONTROL.
file1,file2&file3shouldnotbeopenedexplicitly.

INPUTPROCEDUREisexecutedbeforethesort
andrecordsmustbeRELEASEdtothesortwork
filefromtheinputprocedure.
OUTPUTPROCEDUREisexecutedafterall
recordshavebeensorted.Recordsfromthesort
workfilemustbeRETURNedoneatatimetothe
outputprocedure.

Q16)HowdoyoudefineasortfileinJCLthatruns
theCOBOLprogram?
A16)UsetheSORTWK01,SORTWK02,.....dd
namesinthestep.Numberofsortdatasetsdepends
onthevolumeofdata
beingsorted,butaminimumof3isrequired.

Q17)Whatisthedifferencebetweenperforminga
SECTIONandaPARAGRAPH?GS
A17)PerformingaSECTIONwillcauseallthe
paragraphsthatarepartofthesection,tobe
performed.
PerformingaPARAGRAPHwillcauseonlythat
paragraphtobeperformed.

Q18)WhatistheuseofEVALUATEstatement?
GS
A18)Evaluateislikeacasestatementandcanbe
usedtoreplacenestedIfs.Thedifferencebetween
EVALUATEand
caseisthatno'break'isrequiredforEVALUATE
i.e.controlcomesoutoftheEVALUATEassoonasone
matchis
made.

Q19)WhatarethedifferentformsofEVALUATE
statement?
A19)
EVALUATE
EVALUATESQLCODEALSOFILESTATUS
WHENA=BANDC=D
WHEN100ALSO'00'
imperative
stmt
imperativestmt
WHEN(D+X)/Y=4
WHEN305ALSO'32'
imperative
stmt
imperativestmt
WHENOTHER
WHENOTHER
imperative
stmt
imperativestmt
ENDEVALUATEEND
EVALUATE

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

3/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

EVALUATESQLCODEALSOA=B
EVALUATESQLCODEALSOTRUE
WHEN100ALSOTRUE
WHEN100ALSOA=B
imperative
stmtimperativestmt
WHEN305ALSOFALSE
WHEN305ALSO(A/C=4)
imperative
stmtimperativestmt
ENDEVALUATE
ENDEVALUATE

Q20)HowdoyoucomeoutofanEVALUATE
statement?GS
A20)Aftertheexecutionofoneofthewhenclauses,
thecontrolisautomaticallypassedontothenext
sentenceafterthe
EVALUATEstatement.Thereisnoneedofany
extracode.

Q21)InanEVALUATEstatement,canIgivea
complexconditiononawhenclause?
A21)Yes.

Q22)Whatisascopeterminator?Giveexamples.
A22)Scopeterminatorisusedtomarktheendofa
verbe.g.EVALUATE,ENDEVALUATEIF,ENDIF.

Q23)HowdoyoudoinlinePERFORM?GS
A23)PERFORM...<UNTIL>...
<sentences>
ENDPERFORM

Q24)Whenwouldyouuseinlineperform?
A24)Whenthebodyoftheperformwillnotbeused
inotherparagraphs.Ifthebodyoftheperformisa
generictypeofcode
(usedfromvariousotherplacesintheprogram),it
wouldbebettertoputthecodeinaseparateParaanduse
PERFORMParanameratherthaninlineperform.

Q25)WhatisthedifferencebetweenCONTINUE&
NEXTSENTENCE?
A25)Theyappeartobesimilar,thatis,thecontrol
goestothenextsentenceintheparagraph.But,Next
Sentencewould
takethecontroltothesentenceafteritfindsafull
stop(.).Checkoutbywritingthefollowingcodeexample,
oneif
sentencefollowedby3displaystatements(sorry
theyappearonelineherebecauseofformatting
restrictions)If1>0
thennextsentenceendifdisplay'line1'display'line
2'.display'line3'.***Notethereisadot(.)onlyatthe
endof
thelast2statements,seetheeffectbyreplacing
NextSentencewithContinue***

Q26)WhatdoesEXITdo?
A26)Doesnothing!Ifused,mustbetheonly
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

4/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

sentencewithinaparagraph.

Q27)CanIredefineanX(100)fieldwithafieldof
X(200)?
A27)Yes.Redefinesjustcausesbothfieldstostart
atthesamelocation.Forexample:

01WSTOPPICX(1)
01WSTOPREDREDEFINESWSTOPPICX(2).
IfyouMOVE'12'toWSTOPRED,
DISPLAYWSTOPwillshow1while
DISPLAYWSTOPREDwillshow12.

A28)CanIredefineanX(200)fieldwithafieldof
X(100)?
Q31)1Yes.

Q31)2WhatdoyoudotoresolveSOC7error?GS
Q31)Basicallyyouneedtocorrectingtheoffending
data.ManytimesthereasonforSOC7isanun
initializednumericitem.
Examinethatpossibilityfirst.Manyinstallations
provideyouadumpforruntimeabends(itcanbe
generatedalso
bycallingsomesubroutinesorOSservicesthru
assemblylanguage).Thesedumpsprovidetheoffsetof
thelast
instructionatwhichtheabendoccurred.Examine
thecompilationoutputXREFlistingtogettheverbandthe
line
numberofthesourcecodeatthisoffset.Thenyou
canlookatthesourcecodetofindthebug.Toget
capturethe
runtimedumps,youwillhavetodefinesome
datasets(SYSABOUTetc)intheJCL.Ifnoneofthese
arehelpful,use
judgementandDISPLAYtolocalizethesourceof
error.Someinstallationmighthavebatchprogram
debugging
tools.Usethem.

Q32)HowissignstoredinPackedDecimalfields
andZonedDecimalfields?
Q32)PackedDecimalfields:Signisstoredas
ahexvalueinthelastnibble(4bits)ofthestorage.
ZonedDecimalfields:Asadefault,signis
overpunchedwiththenumericvaluestoredinthelast
bite.

Q33)Howissignstoredinacomp3field?GS
Q33)Itisstoredinthelastnibble.Forexampleif
yournumberis+100,itstoreshex0Cinthelastbyte,
hex1Cif
yournumberis101,hex2Cifyournumberis102,
hex1Difthenumberis101,hex2Difthenumberis102
etc...

Q34)HowissignstoredinaCOMPfield?GS
Q34)Inthemostsignificantbit.BitisONifve,
OFFif+ve.

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

5/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q35)WhatisthedifferencebetweenCOMP&
COMP3?
Q35)COMPisabinarystorageformatwhileCOMP
3ispackeddecimalformat.

Q36)WhatisCOMP1?COMP2?
Q36)COMP1Singleprecisionfloatingpoint.Uses
4bytes.
COMP2Doubleprecisionfloatingpoint.Uses8
bytes.

Q37)HowdoyoudefineavariableofCOMP1?
COMP2?
Q37)Nopictureclausetobegiven.Example01WS
VARUSAGECOMP1.

Q38)HowmanybytesdoesaS9(7)COMP3field
occupy?
Q38)Willtake4bytes.Signisstoredashexvalue
inthelastnibble.GeneralformulaisINT((n/2)+1)),
wheren=7inthis
example.

Q39)HowmanybytesdoesaS9(7)SIGN
TRAILINGSEPARATEfieldoccupy?
Q39)Willoccupy8bytes(oneextrabyteforsign).

Q40)HowmanybyteswillaS9(8)COMPfield
occupy?
Q40)4bytes.

Q41)Whatisthemaximumvaluethatcanbestored
inS9(8)COMP?
Q41)99999999

Q42)WhatisCOMPSYNC?
Q42)Causestheitemtobealignedonnatural
boundaries.CanbeSYNCHRONIZEDLEFTor
RIGHT.Forbinarydata
items,theaddressresolutionisfasteriftheyare
locatedatwordboundariesinthememory.Forexample,
onmain
framethememorywordsizeis4bytes.This
meansthateachwordwillstartfromanaddressdivisible
by4.Ifmy
firstvariableisx(3)andnextoneiss9(4)comp,
thenifyoudonotspecifytheSYNCclause,S9(4)COMP
willstart
frombyte3(assumingthatitstartsfrom0).Ifyou
specifySYNC,thenthebinarydataitemwillstartfrom
address4.
Youmightseesomewastageofmemory,butthe
accesstothiscomputationalfieldis
faster.

Q43)Whatisthemaximumsizeofa01levelitemin
COBOLI?inCOBOLII?
Q43)InCOBOLII:16777215

Q44)Howdoyoureferencethefollowingfileformats
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

6/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

fromCOBOLprograms:
Q44)
FixedBlockFileUse
ORGANISATIONISSEQUENTIAL.Use
RECORDINGMODEISF,
BLOCKCONTAINS0.
FixedUnblockedUse
ORGANISATIONISSEQUENTIAL.Use
RECORDINGMODEISF,
donotuseBLOCK
CONTAINS
VariableBlockFileUse
ORGANISATIONISSEQUENTIAL.Use
RECORDINGMODEISV,BLOCK
CONTAINS0.Donot
codethe4bytesfor
recordlengthinFDie
JCLreclengthwillbe
maxreclengthinpgm+
4
VariableUnblockedUse
ORGANISATIONISSEQUENTIAL.Use
RECORDINGMODEISV,donotuse
BLOCKCONTAINS.Do
notcode4bytesforrecordlength
inFDieJCLreclengthwill
bemaxreclengthinpgm
+4.
ESDSVSAMfileUse
ORGANISATIONISSEQUENTIAL.
KSDSVSAMfileUseORGANISATIONIS
INDEXED,RECORDKEYIS,ALTERNATE
RECORDKEYISRRDSFileUse
ORGANISATIONISRELATIVE,RELATIVEKEY
IS
PrinterFileUse
ORGANISATIONISSEQUENTIAL.Use
RECORDINGMODEISF,BLOCK
CONTAINS0.(Use
RECFM=FBAinJCL
DCB).

Q45)WhataredifferentfileOPENmodesavailable
inCOBOL?
Q45)OpenforINPUT,OUTPUT,IO,EXTEND.

Q46)WhatisthemodeinwhichyouwillOPENafile
forwriting?GS
Q46)OUTPUT,EXTEND

Q47)IntheJCL,howdoyoudefinethefilesreferred
toinasubroutine?
Q47)SupplytheDDcardsjustasyouwouldforfiles
referredtointhemainprogram.

Q48)CanyouREWRITEarecordinanESDSfile?
CanyouDELETEarecordfromit?
Q48)Canrewrite(recordlengthmustbesame),but
notdelete.

Q49)Whatisfilestatus92?GS
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

7/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q49)Logicerror.e.g.,afileisopenedforinputand
anattemptismadetowritetoit.

Q50)Whatisfilestatus39?
Q50)MismatchinLRECLorBLOCKSIZEor
RECFMbetweenyourCOBOLpgm&theJCL(orthe
datasetlabel).You
willgetfilestatus39onanOPEN.

Q51)WhatisStaticandDynamiclinking?
Q51)Instaticlinking,thecalledsubroutineislink
editedintothecallingprogram,whileindynamic
linking,thesubroutine&themainprogramwillexist
asseparateloadmodules.Youchoosestatic/dynamic
linkingbychoosingeithertheDYNAMorNODYNAM
linkeditoption.(EvenifyouchooseNODYNAM,a
CALLidentifier(asopposedtoaCALLliteral),will
translatetoaDYNAMICcall).Astaticallycalled
subroutinewillnotbeinitsinitialstatethenexttimeit
iscalledunlessyouexplicitlyuseINITIALoryoudoa
CANCEL.Adynamicallycalledroutinewillalwaysbe
initsinitialstate.

Q52)WhatisAMODE(24),AMODE(31),
RMODE(24)andRMODE(ANY)?(applicabletoonly
MVS/ESA
EnterpriseServer).
Q52)Thesearecompile/linkeditoptions.Basically
AMODEstandsforAddressingmodeandRMODEfor
Residency
mode.
AMODE(24)24bitaddressing
AMODE(31)31bitaddressing
AMODE(ANY)Either24bitor31bitaddressing
dependingonRMODE.
RMODE(24)Residesinvirtualstoragebelow16
Megline.Usethisfor31bitprogramsthatcall24bit
programs.
(OS/VSCobolpgmsuse24bit
addressesonly).
RMODE(ANY)Canresideaboveorbelow16Meg
line.

Q53)Whatcompileroptionwouldyouusefor
dynamiclinking?
Q53)DYNAM.

Q54)WhatisSSRANGE,NOSSRANGE?
Q54)Thesearecompileroptionswithrespectto
subscriptoutofrangechecking.NOSSRANGEisthe
defaultandifchosen,
noruntimeerrorwillbeflaggedifyourindexor
subscriptgoesoutofthepermissiblerange.

Q55)HowdoyousetareturncodetotheJCLfrom
aCOBOLprogram?
Q55)MoveavaluetoRETURNCODEregister.
RETURNCODEshouldnotbedeclaredinyour
program.

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

8/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q56)HowcanyousubmitajobfromCOBOL
programs?
Q56)WriteJCLcardstoadatasetwith//xxxxxxx
SYSOUT=(A,INTRDR)where'A'isoutputclass,and
datasetshouldbe
openedforoutputintheprogram.Definea80byte
recordlayoutforthefile.

Q57)WhatarethedifferencesbetweenOSVS
COBOLandVSCOBOLII?
Q57)OS/VSCobolpgmscanonlyrunin24bit
addressingmode,VSCobolIIpgmscanruneitherin
24bitor31bit
addressingmodes.

I.Reportwriterissupportedonlyin
OS/VSCobol.
II.USAGEISPOINTERissupported
onlyinVSCOBOLII.
III.Referencemodificatione.g.:WS
VAR(1:2)issupportedonlyinVSCOBOL
II.
IV.EVALUATEissupportedonlyinVS
COBOLII.
V.Scopeterminatorsaresupportedonly
inVSCOBOLII.
VI.OS/VSCobolfollowsANSI74stds
whileVSCOBOLIIfollowsANSI85stds.
VII.UnderCICSCallsbetweenVSCOBOL
IIprogramsaresupported.

Q58)Whatarethestepsyougothroughwhile
creatingaCOBOLprogramexecutable?
Q58)DB2precompiler(ifembeddedSQLused),
CICStranslator(ifCICSpgm),Cobolcompiler,Link
editor.IfDB2
program,createplanbybindingtheDBRMs.

Q59)CanyoucallanOSVSCOBOLpgmfroma
VSCOBOLIIpgm?
Q59)InnonCICSenvironment,itispossible.In
CICS,thisisnotpossible.

Q60)WhatarethedifferencesbetweenCOBOLand
COBOLII?
A60)Thereareatleastfivedifferences:
COBOLIIsupportsstructuredprogrammingby
usinginlinePerformsandexplicitscopeterminators,It
introduces
newfeatures(EVALUATE,SET.TOTRUE,CALL.
BYCONTEXT,etc)Itpermitsprogramstobeloadedand
addressedabovethe16megabytelineItdoesnot
supportmanyoldfeatures(READYTRACE,REPORT
WRITER,
ISAM,Etc.),andItoffersenhancedCICSsupport.

Q61)Whatisanexplicitscopeterminator?
A61)Ascopeterminatorbracketsitspreceding
verb,e.g.IF..ENDIF,sothatallstatements
betweentheverbanditsscopeterminatorare
groupedtogether.OthercommonCOBOLIIverbs
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

9/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

areREAD,PERFORM,EVALUATE,SEARCHand
STRING.

Q62)WhatisaninlinePERFORM?Whenwould
youuseit?Anythingelsetosayaboutit?
A62)ThePERFORMandENDPERFORM
statementsbracketallCOBOLIIstatements
betweenthem.TheCOBOLequivalentisto
PERFORMorPERFORMTHRUaparagraph.In
linePERFORMsworkaslongasthereareno
internalGOTOs,noteventoanexit.Theinline
PERFORMforreadabilityshouldnotexceedapage
lengthoftenitwillreferenceotherPERFORM
paragraphs.

Q63)WhatisthedifferencebetweenNEXT
SENTENCEandCONTINUE?
A63)NEXTSENTENCEgivescontroltotheverb
followingthenextperiod.CONTINUEgivescontrol
tothenextverbaftertheexplicitscopeterminator.
(ThisisnotoneofCOBOLII'sfiner
implementations).It'ssafesttouseCONTINUE
ratherthanNEXTSENTENCEinCOBOLII.

Q64)WhatCOBOLconstructistheCOBOLII
EVALUATEmeanttoreplace?
A64)EVALUATEcanbeusedinplaceofthenested
IFTHENELSEstatements.

Q65)Whatisthesignificanceof'abovetheline'and
'belowtheline'?
A65)BeforeIBMintroducedMVS/XAarchitecture
inthe1980'saprogram'svirtualstoragewaslimited
to16megs.Programscompiledwitha24bitmode
canonlyaddress16Mbofspace,asthoughthey
werekeptunderanimaginarystorageline.With
COBOLIIaprogramcompiledwitha31bitmode
canbe'abovethe16Mbline.(This'belowtheline',
'abovetheline'imageryconfusesmostmainframe
programmers,whotendtobealiteralminded
group.)

Q66)WhatwasremovedfromCOBOLinthe
COBOLIIimplementation?
A66)Partiallist:REMARKS,NOMINALKEY,
PAGECOUNTER,CURRENTDAY,TIMEOF
DAY,STATE,FLOW,COUNT,EXAMINE,
EXHIBIT,READYTRACEandRESETTRACE.

Q67)Explaincallbycontextbycomparingittoother
calls.
A67)Theparameterspassedinacallbycontext
areprotectedfrommodificationbythecalled
program.Inanormalcalltheyareabletobe
modified.

Q68)Whatisthelinkagesection?
A68)Thelinkagesectionispartofacalled
programthat'links'ormapstodataitemsinthe
callingprogram'sworkingstorage.Itisthepartof
thecalledprogramwheretheseshareitemsare
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

10/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

defined.

Q69)Whatisthedifferencebetweenasubscriptand
anindexinatabledefinition?
A69)Asubscriptisaworkingstoragedata
definitionitem,typicallyaPIC(999)whereavalue
mustbemovedtothesubscriptandthen
incrementedordecrementsbyADDTOand
SUBTRACTFROMstatements.Anindexisa
registeritemthatexistsoutsidetheprogram's
workingstorage.YouSETanindextoavalueand
SETitUPBYvalueandDOWNBYvalue.

Q70)Ifyouwerepassingatablevialinkage,which
ispreferableasubscriptoranindex?
A70)Wakeupyouhaven'tbeenpaying
attention!It'snotpossibletopassanindexvia
linkage.Theindexisnotpartofthecalling
programsworkingstorage.Thoseofuswho've
madethismistake,appreciatethelessonmorethan
others.

Q71)Explainthedifferencebetweenaninternaland
anexternalsort,theprosandcons,internalsort
syntaxetc.
A71)AnexternalsortisnotCOBOLitis
performedthroughJCLandPGM=SORT.Itis
understandablewithoutanycodereference.An
internalsortcanusetwodifferentsyntaxs:1.)
USING,GIVINGsortsarecomparabletoexternal
sortswithnoextrafileprocessing2)INPUT
PROCEDURE,OUTPUTPROCEDUREsorts
allowfordatamanipulationbeforeand/orafterthe
sort.

Q72)Whatisthedifferencebetweencompand
comp3usage?ExplainotherCOBOLusages.
A72)Compisabinaryusage,whilecomp3
indicatespackeddecimal.Theothercommon
usagesarebinaryanddisplay.Displayisthe
default.

Q73)Whenisascopeterminatormandatory?
A73)Scopeterminatorsaremandatoryforinline
PERFORMSandEVALUATEstatements.For
readability,it'srecommendedcodingpracticeto
alwaysmakescopeterminatorsexplicit.

Q74)InaCOBOLIIPERFORMstatement,whenis
theconditionaltested,beforeoraftertheperform
execution?
A74)InCOBOLIItheoptionalclauseWITHTEST
BEFOREorWITHTESTAFTERcanbeaddedto
allperformstatements.Bydefaultthetestis
performedbeforetheperform.

Q75)InanEVALUTEstatementistheorderofthe
WHENclausessignificant?
A75)Absolutely.EvaluationoftheWHENclauses
proceedsfromtoptobottomandtheirsequencecan
determineresults.
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

11/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q76)Whatisthedefaultvalue(s)foranINITIALIZE
andwhatkeywordallowsforanoverrideofthe
default.
A76)INITIALIZEmovesspacestoalphabetic
fieldsandzerostoalphanumericfields.The
REPLACINGoptioncanbeusedtooverridethese
defaults.

Q77)WhatisSETTOTRUEallabout,anyway?
A77)InCOBOLIIthe88levelscanbesetrather
thanmovingtheirassociatedvaluestotherelated
dataitem.(Webnote:Thischangeisnotoneof
COBOLII'sbetterspecifications.)

Q78)WhatisLENGTHinCOBOLII?
A78)LENGTHactslikeaspecialregistertotellthe
lengthofagrouporelementaryitem.

Q79)Whatisthedifferencebetweenabinarysearch
andasequentialsearch?Whatarethepertinent
COBOL
commands?
A79)Inabinarysearchthetableelementkey
valuesmustbeinascendingordescending
sequence.Thetableis'halved'tosearchforequal
to,greaterthanorlessthanconditionsuntilthe
elementisfound.Inasequentialsearchthetableis
searchedfromtoptobottom,so(ironically)the
elementsdonothavetobeinaspecificsequence.
Thebinarysearchismuchfasterforlargertables,
whilesequentialworkswellwithsmallerones.
SEARCHALLisusedforbinarysearches
SEARCHforsequential.

Q80)WhatisthepointoftheREPLACINGoptionof
acopystatement?
A80)REPLACINGallowsforthesamecopytobe
usedmorethanonceinthesamecodebychanging
thereplacevalue.

Q81)WhatwillhappenifyoucodeGOBACK
insteadofSTOPRUNinastandaloneCOBOL
programi.e.a
programwhichisnotcallinganyotherprogram.
A81)Theprogramwillgoinaninfiniteloop.

Q82)HowcanItellifamoduleisbeingcalled
DYNAMICALLYorSTATICALLY?
A82)TheONLYwayistolookattheoutputofthe
linkageeditor(IEWL)ortheloadmoduleitself.Ifthe
moduleisbeingcalledDYNAMICALLYthenitwill
notexistinthemainmodule,ifitisbeingcalled
STATICALLYthenitwillbeseenintheloadmodule.
Callingaworkingstoragevariable,containinga
programname,doesnotmakeaDYNAMICcall.
ThistypeofcallingisknownasIMPLICITEcalling
asthenameofthemoduleisimpliedbythe
contentsoftheworkingstoragevariable.Callinga
programnameliteral(CALL

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

12/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q83)WhatisthedifferencebetweenaDYNAMIC
andSTATICcallinCOBOL.
A83)Tocorrectanearlieranswer:Allcalled
modulescannotrunstandaloneiftheyrequire
programvariablespassedtothemviatheLINKAGE
section.DYNAMICallycalledmodulesarethose
thatarenotboundwiththecallingprogramatlink
edittime(IEWLforIBM)andsoareloadedfromthe
programlibrary(jobliborsteplib)associatedwiththe
job.ForDYNAMICcallingofamoduletheDYNAM
compileroptionmustbechosen,elsethelinkage
editorwillnotgenerateanexecutableasitwill
expectuaddressresolutionofallcalledmodules.A
STATICallycalledmoduleisonethatisboundwith
thecallingmoduleatlinkedit,andtherefore
becomespartoftheexecutableloadmodule.

Q84)HowmaydivisionsarethereinJCLCOBOL?
A84)SIX

Q85)WhatisthepurposeofIdentificationDivision?
A85)Documentation.

Q86)WhatisthedifferencebetweenPIC9.99and
9v99?
A86)PIC9.99isaFOURPOSITIONfieldthat
actuallycontainsadecimalpointwhereasPIC
9v99isTHREEPOSITIONnumericfieldwith
impliedorassumeddecimalposition.

Q87)whatisPic9v99Indicates?
A87)PICTURE9v99isathreepositionNumeric
fieldwithanimpliedorassumeddecimalpointafter
thefirstpositionthevmeansanimplieddecimal
point.

Q88)Whatguidelinesshouldbefollowedtowritea
structuredCobolprg'm?
A88)
1)use'evaluate'stmtforconstructingcases.
2)usescopeterminatorsfornesting.
3)useinlineperformstmtforwriting'do'
constructions.
4)usetestbeforeandtestafterintheperform
stmtforwritingdowhileconstructions.

Q89)Readthefollowingcode.01wsnpic9(2)value
zero.aparamove5towsn.performbparawsn
times.bpara.
move10towsn.howmanytimeswillbparabe
executed?
A89)5timesonly.itwillnottakethevalue10thatis
initializedintheloop.

Q90)WhatisthedifferencebetweenSEARCHand
SEARCHALL?Whatismoreefficient?
A90)SEARCHisasequentialsearchfromthe
beginningofthetable.SEARCHALLisabinary
search,continuallydividingthetableintwohalves
untilamatchisfound.SEARCHALLismore
efficientfortableslargerthan70items.
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

13/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q91)Whataresomeexamplesofcommand
terminators?
A91)ENDIF,ENDEVALUATE

Q92)Whatcarehastobetakentoforceprogramto
executeabove16Megline?
A92)MakesurethatlinkoptionisAMODE=31and
RMODE=ANY.Compileoptionshouldneverhave
SIZE(MAX).BUFSIZEcanbe2K,efficientenough.
Q93)HowdoyousubmitJCLviaaCobolprogram?
A93)Useafile//dd1DDsysout=(*,intrdr)writeyour
JCLtothisfile.Plsomeontrythisout.

Q94)HowtoexecuteasetofJCLstatementsfrom
aCOBOLprogram
A94)UsingEXECCICSSPOOLWRITE(var
name)ENDEXECcommand.varnameisa
COBOLhoststructurecontainingJCLstatements.

Q95)GivesomeadvantagesofREDEFINESclause.
A95)
1.YoucanREDEFINEaVariablefromone
PICTUREclasstoanotherPICTUREclassby
usingthesamememory
location.
2.ByREDEFINESwecanINITIALISEthe
variableinWORKINGSTORAGESection
itself.
3.WecanREDEFINEaSingleVariableinto
somanysubvariables.(Thisfacilityisvery
usefulinsolvingY2000
Problem.)

Q96)Whatisthedifferencebetweenstaticcall&
Dynamiccall
A96)InthecaseofStaticcall,thecalledprogram
isastandaloneprogram,itisanexecutable
program.Duringruntimewecancallitinourcalled
program.AsaboutDynamiccall,thecalledprogram
isnotanexecutableprogramitcanexecuted
throughthecalledprogram

Q97)Whatdoyoufeelmakesagoodprogram?
A97)Aprogramthatfollowsatopdownapproach.
Itisalsoonethatotherprogrammersoruserscan
followlogicallyandiseasytoreadandunderstand.

Q98)HowdoyoucodeCoboltoaccessaparameter
thathasbeendefinedinJCL?Anddoyoucodethe
PARM
parameterontheEXEClineinJCL?
A98)
1)usingJCLwithsysin.//sysindd*hereu
codetheparameters(value)topassintocobol
program/*andinprogram
youuseacceptvariablename(oneacceptwill
readonerow)/.anotherway.
2)injclusingparmstatementex:inexec
statementparm='john','david'incobolpgmu
havetocodelinkagesectioninthatforfirst
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

14/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

valueyoucodelengthvariableandvariable
namesay,abcpicx(4).itwilltakejohninsideto
readnextvalueuhavetocodeanothervariable
inthesamewayabovementioned.

Q99)WhydowecodeS9(4)comp.Inspiteof
knowingcomp3willoccupylessspace.
A99)Heres9(4)compissmallinteger,sotwo
wordsequalto1bytesototallyitwilloccupy2
bytes(4words).hereins9(4)comp3asonewordis
equalto1/2byte.4wordsequalto2bytesandsign
willoccupy1/2bytesototallyitwilloccupy3bytes.

Q100)Themaximumnumberofdimensionsthatan
arraycanhaveinCOBOL85is?
A100)SEVENinCOBOL85andTHREEin
COBOL84

Q101)Howdoyoudeclareahostvariable(in
COBOL)foranattributenamedEmpNameoftype
VARCHAR(25)?
A101)
01EMPGRP.
49ELENPICS9(4)COMP.
49ENAMEPICX(25).

Q102)WhatisComm?
A102)COMMHALFWORDBINARY

Q103)DifferentiateCOBOLandCOBOLII.(Most
ofourprogramsarewritteninCOBOLII,so,itisgood
toknow,
how,thisisdifferentfromCOBOL)
A103)ThefollowingfeaturesareavailablewithVS
COBOLII:
1.MVS/XAandMVS/ESAsupportThecompiler
andtheobjectprogramsitproducescanberun
ineither
24or31bitaddressing
mode.
2.VM/XAandVM/ESAsupportThecompiler
andtheobjectprogramsitproducescanberun
ineither
24or31bitaddressing
mode.
3.VSE/ESAsupportThecompilerandthe
objectprogramsitproducescanberununder
VSE/ESA.

Q104)WhatisPERFORM?WhatisVARYING?
(Moredetailsabouttheseclauses)
A104)ThePERFORMstatementisa
PROCEDUREDIVISIONstatementwhich
transferscontroltooneormorespecified
proceduresandcontrolsasspecifiedthenumber
oftimestheproceduresareexecuted.After
executionofthespecifiedproceduresis
completed(i.e.,fortheappropriatenumberof
timesoruntilsomespecifiedconditionis
met),controlistransferredtothenext
executablestatementfollowingthe
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

15/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

PERFORMstatement.Thereare5typesof
PERFORMstatements:

a)Basic
PERFORM
b)PERFORM
TIMES
c)PERFORMUNTIL

d)PERFORMVARYING
e)INLINEPERFORM

Q105)Howmanysectionsarethereindata
division?.
A105)SIXSECTIONS1.FILESECTION
2.WORKINGSTORAGESECTION3.LOCAL
STORAGESECTION4.SCREENSECTION
5.REPORTSECTION6.LINKAGESECTION

Q106)WhatisRedefinesclause?
A106)Redefinesclauseisusedtoallowthesame
storageallocationtobereferencedbydifferentdata
names.

Q107)Howmanybytesdoesas9(4)comp3field
occupy?
A107)3Bytes(formula:n/2+1))

Q108)Whatisthedifferentbetweenindexand
subscript?
A108)Subscriptreferstothearrayof
occurrence,whereasIndexrepresentsan
occurrenceofatableelement.Anindexcanonly
modifiedusingperform,search&set.Needto
haveanindexforatableinordertouseSEARCH
andSEARCHAll.

Q109)WhatisthedifferencebetweenStructured
COBOLProgrammingandObjectOrientedCOBOL
programming?
A109)StructuredprogrammingisaLogicalway
ofprogramming,youdividethefunctionalitiesinto
modulesandcodelogically.OOPisaNaturalway
ofprogrammingyouidentifytheobjectsfirst,and
thenwritefunctions,proceduresaroundthe
objects.Sorry,thismaynotbeanadequate
answer,buttheyaretwodifferentprogramming
paradigms,whichisdifficulttoputinasentence
ortwo.

Q110)Whatdivisions,sectionsandparagraphsare
mandatoryforaCOBOLprogram?
A110)IDENTIFICATIONDIVISIONandPROGRAMID
paragrapharemandatoryforacompilationerrorfree
COBOL
program.

Q111)CanJUSTIFIEDbeusedforallthedata
types?
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

16/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

A111)No,itcanbeusedonlywithalphabetic
andalphanumericdatatypes.

Q112)Whathappenswhenwemoveacomp3
fieldtoanedited(sayz(9).ZZ)
A112)theeditingcharactersrtobeusedwith
dataitemswithusageclauseasdisplaywhichis
thedefault.Whenutriesdisplayingadataitem
withusageascomputationalitdoesnotgivethe
desireddisplayformatbecausethedataitemis
storedaspackeddecimal.Soifuwantthis
particulardataitemtobeediteduhavetomoveit
intoadataitemwhoseusageisdisplayandthen
havethatparticulardataitemeditedintheformat
desired.

Q113)WhatwillhappenifyoucodeGOBACK
insteadofSTOPRUNinastandaloneCOBOL
programi.e.aprogramwhichisnotcallingany
otherprogram?
A113)Bothgivethesameresultswhena
programisnotcallinganyotherprogram.GO
BACKwillgivethecontroltothesystemeven
thoughitisasingleprogram.

Q114)whatisthedifferencebetweenexternal
andglobalvariables?
A114)Globalvariablesareaccessibleonlyto
thebatchprogramwhereasexternalvariablescan
bereferencedfromanybatchprogramresidingin
thesamesystemlibrary.

Q115)Youarewritingreportprogramwith4
levelsoftotals:city,state,regionandcountry.
Thecodesbeingusedcanbethesameoverthe
differentlevels,meaningacitycodeof01canbe
inanynumberofstates,andthesameappliesto
stateandregioncodesohowdoyoudoyour
checkingforbreaksandhowdoyoudoaddto
eachlevel?

A115)Alwayscompareonthehighestlevel
first,becauseifyouhaveabreakatahighest
level,eachlevelbeneathitmustalsobreak.Add
tothelowestlevelforeachrecordbutaddtothe
higherlevelonlyonabreak.

Q116)WhatisdifferencebetweenCOBOLand
VSCOBOLII?.
A116)InusingCOBOLonPCwehaveonlyflat
filesandtheprogramscanaccessonlylimited
storage,whereasinVSCOBOLIIonM/Fthe
programscanaccessupto16MBor2GB
dependingontheaddressingandcanuseVSAM
filestomakeI/Ooperationsfaster.

Q117)Whyoccurscannotbeusedin01level
?
A117)Because,Occursclauseisthereto
repeatfieldswithsameformat,nottherecords.

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

17/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

Q118)Whatisreportitem?
A118)AReportItemIsAFieldToBePrinted
ThatContainsEditSymbols

Q119)Differencebetweennextandcontinue
clause
A119)Thedifferencebetweenthenextand
continueverbisthatinthecontinueverbitisused
forasituationwherethereinnoEOFcondition
thatistherecordsaretobeaccessedagainand
againinanfile,whereasinthenextverbthe
indexedfileisaccessedsequentially,readnext
recordcommandisused.

Q120)WhatistheImportanceofGLOBAL
clauseAccordingtonewstandardsofCOBOL
A120)Whenanydataname,filename,Record
name,conditionnameorIndexdefinedinan
IncludingProgramcanbereferencedbyadirectly
orindirectlyinanincludedprogram,Providedthe
saidnamehasbeendeclaredtobeaglobalname
byGLOBALFormatofGlobalClauseis01data1
pic9(5)ISGLOBAL.

Q121)WhatisthePurposeofPOINTER
PhraseinSTRINGcommand
A121)ThePurposeofPOINTERphraseisto
specifytheleftmostpositionwithinreceivingfield
wherethefirsttransferredcharacterwillbestored

Q122)Howdowegetcurrentdatefromsystem
withcentury?
A122)ByusingIntrinsicfunction,FUNCTION
CURRENTDATE

Q123)Whatisthemaximumlengthofafield
youcandefineusingCOMP3?
A123)10Bytes(S9(18)COMP3).

Q124)Whydowecodes9(4)comp?Inspite
ofknowingcomp3willoccupylessspace?
A124)Heres9(4)compissmallinteger,sotwo
wordsequalto1bytesototallyitwilloccupy2
bytes(4words).hereins9(4)comp3asoneword
isequalto1/2byte.4wordsequalto2bytesand
signwilloccupy1/2bytesototallyitwill
occupy3bytes.

Q125)WhatistheLINKAGESECTIONused
for?
A125)Thelinkagesectionisusedtopassdata
fromoneprogramtoanotherprogramortopass
datafromaPROCtoaprogram.

Q126)Describethedifferencebetween
subscriptingandindexing?
A126)Indexingusesbinarydisplacement.
Subscriptsusethevalueoftheoccurrence.

1.WhatarethecommonformsoftheEVALUATE
STATEMENT?
https://sites.google.com/site/indusitfactory/cobolinterviewquestions

18/19

5/3/2016

COBOLInterviewQuestionsmainframesguru.in

2.Whatdoestheinitializestatementdo?
3.Whatisthereferencemodification.
4.NamesomeoftheexamplesofCOBOl11?
5.WhatareVSCOBOL11specialfeatures?
6.WhatareoptionshavebeenremovedinCOBOL
11?
7.Whatisthefileorganizationclause?
8.Whatisasubscript?
9.Whatisanindexfortables?
10.Whatarethetwosearchtechniques?
11.Whatisaninlineperform?
12.WhatisCALLstatementinCOBOL?
13.WhencantheUSINGphrasebeincludedinthe
callstatement?
14.InEBCDIC,howwouldthenumber1234be
stored?
15.Howwouldthenumber+1234bestoredifaPIC
clauseofPICTUREs9(4)comp3wereused?
16.WhatisAlternateIndex?Howisitdifferentfrom
regularindex?

IBMMainframesCOBOL,JCL,VSAM,DB2,CICS,PL/I,IMS/DC,IMS/DB,DB2DBA,CICSAdministration,
DB2DatabaseAdministration,Xpediter,Endevor,Changeman,FileAid,DITTO,XpediterforBatch,Xpediterfor
Online,XpediterforIMS,CA7,ControlM,Omegamon,BMCSuiteofproducts,IBMSuiteofproducts,
SYNCSORT,DFSORT,IEBGEBER,IEBCOPY,IDCAMS,SPUFI,QMF,SDSF,Easytrieve,Assembler,REXX,
CLIST,IMS/DBDatabaseAdministrationTraininginHyderabad,Chennai,Pune,BangaloreforAffordablePrices.
IBMMainframeTraininginhyderabad.DB2DBAtraininginhyderabad,CICSadministrationtraininginhyderabad.
DB2DBAtraininginchennai.DB2UDBDBATraininginhyderabad.DB2UDBDBATrainingin
chennai.Mainframesuserids,mainframeuserid,mainframesconnectivity,mainframeconnectivityfortraining
needs,AS/400training,COBOL/400training,CL/400training,DB2/400training,OS/400training,indus
mainframes,mainframestraininginhyderbad,mainframeidforrent,mainframeconnectivity,COBOLQuestions
andanswers,COBOLQuestionsandanswers,JCLQuestionsandanswers,DB2Questionsandanswers,
VSAMQuestionsandanswers,CICSQuestionsandanswers,JCLAbends,JCLAbendcodes,COBOLabends,
CICSAbends,DB2SQLCodes,COBOLfilestatuscodes,VSAMfilestatuscodes,COBOLTutorials,JCL
Tutorials,DB2tutorials,CICSTutorials,VSAMTutorials,Z/OSTutorias

Comments
Youdonothavepermissiontoaddcomments.

Signin | RecentSiteActivity | ReportAbuse | PrintPage | PoweredBy GoogleSites

https://sites.google.com/site/indusitfactory/cobolinterviewquestions

19/19