Anda di halaman 1dari 53

1/23/2016 Mainframerefresherpart1

SlideShareExploreSearchYou

Upload
Login
Signup

Search

Home
Technology
Education
MoreTopics

ForUploaders
CollectLeads

GetStarted

Tips&Tricks

Tools

ForBusiness

Search

http://www.slideshare.net/vishwas17/mainframerefresherpart1 1/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 2/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 3/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 4/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 5/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 6/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 7/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 8/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 9/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 10/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 11/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 12/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 13/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 14/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 15/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 16/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 17/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 18/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 19/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 20/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 21/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 22/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 23/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 24/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 25/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 26/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 27/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 28/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 29/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 30/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 31/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 32/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 33/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 34/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 35/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 36/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 37/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 38/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 39/53
1/23/2016 Mainframerefresherpart1

UpcomingSlideShare

Loadingin...5

29of39

Mainframerefresherpart1
6,838
1

Share
Like

vishwas17
Follow
0 4 0 3

PublishedonMar08,2013

0Comments
4Likes

http://www.slideshare.net/vishwas17/mainframerefresherpart1 40/53
1/23/2016 Mainframerefresherpart1
Statistics
Notes

FullName
Commentgoeshere.
12hoursagoDeleteReplySpamBlock
AreyousureyouwanttoYesNo
Yourmessagegoeshere

Shareyourthoughts...
Post

Bethefirsttocomment

bathula8
3monthsago

naasroth
5monthsago

SujathaVoorella
1yearago

HariprasannaV,SeniorEngineerQAatVirtusaSoftwareServices
1yearago

NoDownloads
Views
TotalViews
6,838
OnSlideshare
0
FromEmbeds
0
NumberofEmbeds
2
Actions
Shares
7
Downloads
0
Comments
0
Likes
4
Embeds0
Noembeds

Nonotesforslide

Mainframerefresherpart1
1. 1.MainframeRefresherPart1COBOLPage:1COBOL(COmmonBusinessOrientedLanguage)History.Developedby1959byagroupcalled
COnferenceonDataSystemsLanguage(CODASYL).FirstCOBOLcompilerwasreleasedbyDecember1959.FirstANSIapprovedversion
1968ModifiedANSIapprovedversion1974(OS/VSCOBOL)ModifiedANSIapprovedversion1985(VSCOBOL2)Thisbookiswrittenbasedon
IBMCOBOLforOS/390V2R2.Speciality.1.Firstlanguagedevelopedforcommercialapplicationdevelopment,whichcanefficientlyhandlemillions
ofdata.2.ProcedureOrientedLanguageProblemissegmentedintoseveraltasks.EachtaskiswrittenasaParagraphinProcedureDivisionand
executedinalogicalsequenceasmentioned.3.EnglishLikelanguageEasytolearn,codeandmaintain.CodingSheet.17127280COLA
COLUMNB16Page/linenumbersOptional(automaticallyassignedbycompiler)7Continuity(),Comment(*),Startinganewpage(/)Debugging
lines(D)811ColumnADivision,Section,Paragraph,01,77declarationsmustbeginhere.12.72ColumnBAlltheotherdeclarations/statements

http://www.slideshare.net/vishwas17/mainframerefresherpart1 41/53
1/23/2016 Mainframerefresherpart1
beginhere.7380Identificationfield.Itwillbeignoredbythecompilerbutvisibleinthesourcelisting.LanguageStructure.CharacterDigits(09),
Alphabets(AZ),Space(b),SpecialCharacters(+*/()=$><.,)WordOneormorecharactersUserdefinedorReservedClauseOneormore
words.ItspecifiesanattributeforanentryStatementOneormorevalidwordsandclausesSentenceOneormorestatementsterminatedbya
periodParagraphOneormoresentences.SectionOneormoreparagraphs.DivisionOneormoresectionsorparagraphsProgramMadeupoffour
divisions
2. 2.MainframeRefresherPart1COBOLPage:2DivisionsinCOBOL.TherearefourdivisionsinaCOBOLprogramandDatadivisionisoptional.
1.IdentificationDivision.2.EnvironmentDivision.3.DataDivision.4.ProcedureDivision.IdentificationDivision.Thisisthefirstdivisionandthe
programisidentifiedhere.ParagraphPROGRAMIDfollowedbyuserdefinednameismandatory.Allotherparagraphsareoptionalandusedfor
documentation.ThelengthofuserdefinednameforIBMCOBOLisEIGHT.IDENTIFICATIONDIVISION.PROGRAMID.PROGRAMNAME.
AUTHOR.COMMENTENTRY.INSTALLATION.COMMENTENTRY.DATEWRITTEN.COMMENTENTRY.DATECOMPILED.
COMMENTENTRY.SECURITY.COMMENTENTRY.Securitydoesnotpertaintotheoperatingsystemsecurity,buttheinformationthatispassed
totheuseroftheprogramaboutthesecurityfeaturesoftheprogram.EnvironmentDivision.OnlymachinedependantdivisionofCOBOLprogram.It
suppliesinformationaboutthehardwareorcomputerequipmenttobeusedontheprogram.Whenyourprogrammovesfromonecomputertoanother
computer,theonlysectionthatmayneedtobechangedisENVIRONMENTdivision.ConfigurationSection.Itsuppliesinformationconcerningthe
computeronwhichtheprogramwillbecompiled(SOURCECOMPUTER)andexecuted(OBJECTCOMPUTER).Itconsistsofthreeparagraphs
SOURCECOMPUTER,OBJECTCOMPUTERandSPECIALNAMES.ThisisOPTIONALsectionfromCOBOL85.SOURCECOMPUTER.IBM
4381(Computerandmodel#suppliedbymanufacturer)WITHDEBUGGINGMODEclausespecifiesthatthedebugginglinesintheprogram
(statementscodedwithDincolumn7)arecompiled.OBJECTCOMPUTER.IBM4381(Usuallysameassourcecomputer)SPECIALNAMES.This
paragraphisusedtorelatehardwarenamestouserspecifiedmnemonicnames.1.Substitutecharacterforcurrencysign.(CURRENCYSIGNISlitearal
1)2.Commacanbeusedasdecimalpoint.(DECIMALPOINTISCOMMA)3.Defaultcollatingsequencecanbechanged.Itwillbeexplainedlater.4.
NewclasscanbedefinedusingCLASSkeyword.(CLASSDIGITis0thru9)
3. 3.MainframeRefresherPart1COBOLPage:3InputOutputSection.Itcontainsinformationregardingthefilestobeusedintheprogramanditconsists
oftwoparagraphsFILECONTROL&IOCONTROL.FILECONTROL.Filesusedintheprogramareidentifiedinthisparagraph.IOCONTROL.It
specifieswhencheckpointstobetakenandstorageareasthataresharedbydifferentfiles.DataDivision.Datadivisionisusedtodefinethedatathat
needtobeaccessedbytheprogram.Ithasthreesections.FILESECTIONdescribestherecordstructureofthefiles.WORKINGSTORAGESECTION
isusedtofordefineintermediatevariables.LINKAGESECTIONisusedtoaccesstheexternaldata.Ex:Datapassedfromotherprogramsorfrom
PARMofJCL.Literals,Constants,Identifier,1.Literalisaconstantanditcanbenumericornonnumeric.2.Numericliteralcanhold18digitsandnon
numericliteralcanhold160charactersinit.(COBOL74supports120charactersonly)3.Literalstoredinanamedmemorylocationiscalledasvariable
oridentifier.4.FigurativeConstantisaCOBOLreservedwordrepresentingfrequentlyusedconstants.TheyareZERO/ZEROS/ZEROES,
QUOTE/QUOTES,SPACE/SPACES,ALL,HIGHVALUE/HIGHVALUES,LOWVALUE/LOWVALUES.Example:01WSVAR1PICX(04)
VALUEMUSA.MUSAisanonnumericliteral.WSVAR1isaidentifierorvariable.DeclarationofvariableLevel#$Variable$Pictureclause$
Valueclause$UsageClause$Syncclause.FILLERLevel#Itspecifiesthehierarchyofdatawithinarecord.Itcantakeavaluefromthesetofintegers
between0149orfromoneofthespeciallevelnumbers66778801level.Specifiestherecorditself.ItmaybeeitheragroupitemoranElementary
item.ItmustbegininAreaA.0249levels.Specifygrouporelementaryitemswithinarecord.Grouplevelitemsmustnothavepictureclause.66level.
IdentifytheitemsthatcontaintheRENAMESclause.77level.Identifyindependentdataitem.88level.Conditionnames.VariablenameandQualifier
Variablenamecanhave130characterswithatleastonealphabetinit.Hyphenistheonlyallowedspecialcharacterbutitcannotbefirstorlastletterof
thename.Nameshouldbeuniquewithintherecord.Iftwovariableswithsamenamearethere,thenuseOFqualifierofhighlevelgroupingtorefera
variableuniquely.Ex:MOVEbalanceOFrecord1TObalanceOFrecord2.
4. 4.MainframeRefresherPart1COBOLPage:4FILLERWhentheprogramisnotintendedtouseselectedfieldsinarecordstructure,definethemas
FILLER.FILLERitemscannotbeinitializedorusedinanyoperationoftheproceduredivision.PICTUREClauseDescribestheattributesof
variable.Numeric9(Digit),V(Implieddecimalpoint),S(Sign)NumericEdited+(PlusSign),(MinusSign),CRDB(CreditDebitSign).(Period),b
(Blank),,(comma),0(Zero),/(Slash)BLANKWHENZERO(Insertblankwhendatavalueis0),Z(ZEROsuppression),*(ASTERISK),$(Currency
Sign)NonNumericA(alphabet),B(BlankinsertionCharacter),X(Alphanumeric),G(DBCS)Exclusivesets1.+CRDB2.V.3.$+Z*(But$
Canappearasfirstplaceand*asfloating.$***.**)DBCS(DoubleByteCharacterSet)isusedintheapplicationsthatsupportlargecharactersets.16
bitsareusedforonecharacter.Ex:Japaneselanguageapplications.RefreshingBasicsNibble.4Bitsisonenibble.Inpackeddecimal,eachnibblestores
onedigit.Byte.8Bitsisonebyte.Bydefault,everycharacterisstoredinonebyte.Halfword.16bitsor2bytesisonehalfword.(MVS)Fullword.32
bitsor4bytesisonefullword.(MVS)Doubleword.64bitsor8bytesisonedoubleword.(MVS)UsageClauseDISPLAYDefault.Numberofbytes
requiredequalstothesizeofthedataitem.COMPBinaryrepresentationofdataitem.PICclausecancontainSand9only.S9(01)S9(04)Halfword.
S9(05)S9(09)Fullword.S9(10)S9(18)Doubleword.MostsignificantbitisONifthenumberisnegative.COMP1Singlewordfloatingpointitem.
PICClauseshouldnotbespecified.COMP2Doublewordfloatingpointitem.PICClauseshouldnotbespecified.COMP3PackedDecimal
representation.Twodigitsarestoredineachbyte.Lastnibbleisforsign.(Fforunsignedpositive,CforsignedpositiveandDforsignednegative)
FormulaforBytes:Integer((n/2)+1))=>nisnumberof9s.INDEXItisusedforpreservetheindexvalueofanarray.PICClauseshouldnotbe
specified.
5. 5.MainframeRefresherPart1COBOLPage:5VALUEClauseItisusedforinitializingdataitemsintheworkingstoragesection.Valueofitemmust
notexceedpicturesize.Itcannotbespecifiedfortheitemswhosesizeisvariable.Syntax:VALUEISliteral.VALUESAREliteral1THRU|
THROUGHliteral2VALUESAREliteral1,literal2LiteralcanbenumericwithoutquotesORnonnumericwithinquotesOR
figurativeconstant.SIGNClauseSyntaxSIGNIS(LEADING)SEPARATECHARACTER(TRAILING).Itisapplicablewhenthepicturestringcontain
S.DefaultisTRAILINGWITHNOSEPARATECHARACTER.SoSdoesnttakeanyspace.Itisstoredalongwithlastdigit.+1=A+2=B+3=C
+4=D+5=E+6=F+7=G+8=H+9=I0=},1=J,2=K,3=L,4=M,5=N,6=O,7=P,8=Q,9=RNumberTRAILINGSIGNLEADINGSIGN
LEADING(Default)SEPARATE.12512NJ25125+12512EA25+125SYNCClauseandSlackBytesSYNCclauseisspecifiedwithCOMP,
COMP1andCOMP2items.Theseitemsareexpectedtostartathalf/full/doublewordboundariesforfasteraddressresolution.SYNCclausedoesthis
butitmayintroduceslackbytes(unusedbytes)beforethebinaryitem.01WSTEST.10WSVAR1PICX(02).10WSVAR2PICS9(6)COMPSYNC.
AssumesWSTESTstartsatrelativelocation0inthememory,WSVAR1occupieszeroandfirstbyte.WSVAR2isexpectedtostartatsecondbyte.
AsthecompitemintheexampleneedsonewordanditiscodedwithSYNCclause,itwillstartonlyatthenextwordboundarythatis4thbyte.Sothis
introducestwoslackbytesbetweenWSVAR1andWSVAR2.REDEFINESTheREDEFINESclauseallowsyoutousedifferentdatadescription
entriestodescribethesamecomputerstoragearea.Redefiningdeclarationshouldimmediatelyfollowtheredefineditemandshouldbedoneatthesame
level.Multipleredefinitionsarepossible.Sizeofredefinedandredefiningneednotbethesame.Example:01WSDATEPIC9(06).01WSREDEF
DATEREDEFINESWSDATE.05WSYEARPIC9(02).05WSMONPIC9(02).05WSDAYPIC9(02).
6. 6.MainframeRefresherPart1COBOLPage:6RENAMESItisusedforregroupingofelementarydataitemsinarecord.Itshouldbedeclaredat66
level.Itneednotimmediatelyfollowsthedataitem,whichisbeingrenamed.ButallRENAMESentriesassociatedwithonelogicalrecord
mustimmediatelyfollowthatrecordslastdatadescriptionentry.RENAMEScannotbedonefora01,77,88oranother66entry.01WSREPSONSE.05
WSCHAR143PICX(03).05WSCHAR4PICX(04).66ADDREPSONSERENAMESWSCHAR143.CONDITIONnameItisidentifiedwith
speciallevel88.Aconditionnamespecifiesthevaluethatafieldcancontainandusedasabbreviationinconditionchecking.01SEXPICX.88
MALEVALUE188FEMALEVALUE23.IFSEX=1canalsobecodedasIFMALEinProceduredivision.SETFEMALETOTRUEmoves
value2toSEX.IfmultiplevaluesarecodedonVALUEclause,thefirstvaluewillbemovedwhenitissettotrue.JUSTIFIEDRIGHTThisclausecan

http://www.slideshare.net/vishwas17/mainframerefresherpart1 42/53
1/23/2016 Mainframerefresherpart1
bespecifiedwithalphanumericandalphabeticitemsforrightjustification.Itcannotbeusedwith66and88levelitems.OCCURSClauseOCCURS
Clauseisusedtoallocatephysicallycontiguousmemorylocationstostorethetablevaluesandaccessthemwithsubscriptorindex.Detailexplanation
isgiveninTableHandlingsection.LINKAGESECTIONItisusedtoaccessthedatathatareexternaltotheprogram.JCLcansendmaximum100
characterstoaprogramthruPARM.LinkagesectionMUSTbecodedwithahalfwordbinaryfield,priortoactualfield.Iflengthfieldisnotcoded,the
firsttwobytesofthefieldcodedinthelinkagesectionwillbefilledwithlengthandsotherearechancesof2bytesdatatruncationintheactualfield.01
LKDATA.05LKLENGTHPICS9(04)COMP.05LKVARIABLEPICX(08).LINKAGEsectionofsubprogramswillbeexplainedlater.
7. 7.MainframeRefresherPart1COBOLPage:7ProcedureDivision.Thisisthelastdivisionandbusinesslogiciscodedhere.Ithasuser
definedsectionsandparagraphs.Sectionnameshouldbeuniquewithintheprogramandparagraphnameshouldbeuniquewithinthesection.Procedure
divisionstatementsarebroadlyclassifiedintofollowingcategories.StatementTypeMeaningImperativeDirecttheprogramtotakeaspecificaction.Ex:
MOVEADDEXITGOTOConditionalDecidethetruthorfalseofrelationalconditionandbasedonit,executedifferentpaths.Ex:IF,
EVALUATECompilerDirectiveDirectsthecompilertotakespecificactionduringcompilation.Ex:COPYSKIPEJECTExplicitScopeTerminatethe
scopeofconditionalandimperativestatements.terminatorEx:ENDADDENDIFENDEVALUATEImplicitScopeTheperiodattheendofany
sentence,terminatesthescopeofterminatorallpreviousstatementsnotyetterminated.MOVEStatementItisusedtotransferdatabetweeninternal
storageareasdefinedineitherfilesectionorworkingstoragesection.Syntax:MOVEidentifier1/literal1/figurativeconstantTOidentifier2(identifier3)
Multiplemovestatementscanbeseparatedusingcomma,semicolons,blanksorthekeywordTHEN.Numericmoverules:Anumericornumericedited
itemreceivesdatainsuchawaythatthedecimalpointisalignedfirstandthenfillingofthereceivingfieldtakesplace.Unfilledpositionsarefilledwith
zero.Zerosuppressionorinsertionofeditingsymbolstakesplacesaccordingtotherulesofeditingpictures.Ifthereceivingfieldwidthissmallerthan
sendingfieldthenexcessdigits,totheleftand/ortotherightofthedecimalpointaretruncated.AlphanumericMoveRules:Alphabetic,alphanumericor
alphanumericediteddatafieldreceivesthedatafromlefttoright.Anyunfilledfieldofthereceivingfiledisfilledwithspaces.Whenthelengthof
receivingfieldisshorterthanthatofsendingfield,thenreceivingfieldacceptscharactersfromlefttorightuntilitisfilled.Theunaccomodated
charactersontherightofthesendingfieldaretruncated.Whenanalphanumericfieldismovedtoanumericornumericeditedfield,theitemismoved
asifitwereinanunsignednumericintegermode.CORRESPONDINGcanbeusedtotransferdatabetweenitemsofthesamenamesbelongingto
differentgroupitemsbyspecifyingthenamesofgroupitemstowhichtheybelong.MOVECORRESPONDINGgroup1TOgroup2
8. 8.MainframeRefresherPart1COBOLPage:8GroupMoveruleWhenMOVEstatementisusedtomoveinformationatgrouplevel,themovementof
datatakesplaceasifbothsendingandreceivingfieldsarespecifiedasalphanumericitems.Thisisregardlessofthedescriptionoftheelementary
itemsconstitutingthegroupitem.SamplesforunderstandingMOVEstatement(MOVEATOB)PictureofAValueofAPictureofBValueofBafter
MovePIC99V9912.35PIC999V99012.35PIC99V9912.35PIC9999V99990012.3500PIC99V99912.345PIC9V992.34PIC9(05)V9(03)
54321.543PIC9(03)V9(03)321.543PIC9(04)V9(02)23.24PICZZZ99.923.2PIC99V9900.34PIC$$$.99$.34PICX(04)MUSAXBXBXB
MUSARITHMETICVERBSAllthepossiblearithmeticoperationsinCOBOLusingADD,SUBTRACT,MULTIPLYandDIVIDEaregiven
below:ArithmeticOperationABCDADDATOBAA+BADDABCTODABCA+B+C+DADDABCGIVINGDABCA+B+CADDATOB
CAA+BA+CSUBTRACTAFROMBABASUBTRACTABFROMABC(A+B)CSUBTRACTABFROMABCC(A+B)CGIVING
DMULTIPLYABYBAA*BMULTIPLYABYBABA*BGIVINGCDIVIDEAINTOBAB/ADIVIDEAINTOBABB/AGIVINGCDIVIDE
ABYBABA/BGIVINGCDIVIDEAINTOBABInteger(B/A)IntegerGIVINGCremainderREMAINDERDGIVINGisusedinthefollowing
cases:1.Toretainthevaluesofoperandsparticipatingintheoperation.2.Theresultantvalueofoperationexceedsanyoftheoperandsize.
9. 9.MainframeRefresherPart1COBOLPage:9ROUNDEDoptionWithROUNDEDoption,thecomputerwillalwaysroundtheresulttothePICTURE
clausespecificationofthereceivingfield.Itisusuallycodedafterthefieldtoberounded.ItisprefixedwithREMAINDERkeywordONLYinDIVIDE
operation.ADDABGIVINGCROUNDED.DIVIDE..ROUNDEDREMAINDERCaution:Dontuseforintermediatecomputation.ONSIZEERROR
IfA=20(PIC9(02))andB=90(PIC9(02)),ADDATOBwillresult10inBwheretheexpectedvalueinBis110.ONSIZEERRORclauseiscodedto
trapsuchsizeerrorsinarithmeticoperation.Ifthisiscodedwitharithmeticstatement,anyoperationthatendedwithSIZEerrorwillnotbecarriedout
butthestatementfollowsONSIZEERRORwillbeexecuted.ADDATOBONSIZEERRORDISPLAYERROR!.COMPUTEComplexarithmetic
operationscanbecarriedoutusingCOMPUTEstatement.Wecanusearithmeticsymbolsthankeywordsandsoitissimpleandeasytocode.+For
ADD,forSUBTRACT,*forMULTIPLY,/forDIVIDEand**forexponentiation.Rule:Lefttoright1.Parentheses2.Exponentiation
3.MultiplicationandDivision4.AdditionandSubtractionCaution:WhenROUNDEDiscodedwithCOMPUTE,somecompilerwilldoroundingfor
everyarithmeticoperationandsothefinalresultwouldnotbeprecise.77APIC999VALUE10COMPUTEAROUNDED=(A+2.95)*10.99Result:
(ROUNDED(ROUNDED(12.95)*ROUNDED(10.99))=120orROUNDED(142.3205)=142Sotheresultcanbe120or142.Becautiouswhenusing
ROUNDEDkeywordwithCOMPUTEstatement.Allarithmeticoperatorshavetheirownexplicitscopeterminators.(ENDADD,ENDSUBTRACT,
ENDMULTIPLY,ENDDIVIDE,ENDCOMPUTE).Itissuggestedtousethem.CORRESPONDINGisavailableforADDandSUBTRACT
only.INITIALIZEVALUEclauseisusedtoinitializethedataitemsintheworkingstoragesectionwhereasINITIALIZEisusedtoinitializethedata
itemsintheproceduredivision.INITIALIZEsetsthealphabetic,alphanumericandalphanumericediteditemstoSPACESandnumericandnumeric
editeditemstoZERO.ThiscanbeoverriddenbyREPLACINGoptionofINITIALIZE.FILLER,OCCURSDEPENDINGONitemsare
notaffected.Syntax:INITIALIZEidentifier1REPLACING(ALPHABETIC/ALPHANUMERIC/ALPHANUMERICEDITED
NUMERIC/NUMERICEDITED)DATABY(identifier2/Literal2)
10. 10.MainframeRefresherPart1COBOLPage:10ACCEPTACCEPTcantransferdatafrominputdeviceorsysteminformationcontaininthereserved
dataitemslikeDATE,TIME,DAY.ACCEPTWSVAR1(FROMDATE/TIME/DAY/OTHERSYSTEMVARS).IfFROMClauseisnotcoded,then
thedataisreadfromterminal.Atthetimeofexecution,batchprogramwillABENDifthereisnoinstreamdatafromJCLandthereisnoFROMclause
intheACCEPTclause.DATEoptionreturnssixdigitcurrentdateinYYYYMMDDDAYreturns5digitcurrentdateinYYDDDTIMEreturns8digit
RUNTIMEinHHMMSSTTDAYOFWEEKreturnssingledigitwhosevaluecanbe17(MondaySundayrespectively)DISPLAYItisusedtodisplay
data.BydefaultdisplaymessagesareroutedtoSYSOUT.Syntax:DISPLAYidentifier1|literal1(UPONmnemonicname)STOPRUN,EXIT
PROGRAM&GOBACKSTOPRUNisthelastexecutablestatementofthemainprogram.ItreturnscontrolbacktoOS.EXITPROGRAMisthelast
executablestatementofsubprogram.Itreturnscontrolbacktomainprogram.GOBACKcanbecodedinmainprogramaswellassubprogramasthe
laststatement.Itjustgivesthecontrolbackfromwhereitreceivedthecontrol.CollatingSequenceTherearetwofamousCollatingSequenceavailablein
computers.IBMandIBMCompatiblemachineuseEBCDICcollatingsequencewhereasmostmicroandmanymainframesystemsuseASCIIcollating
sequence.Theresultofarithmeticandalphabeticcomparisonwouldbesameinbothcollatingsequenceswhereasthesameisnottrueforalphanumeric
comparison.EBCDIC(AscendingOrder)ASCII(AscendingOrder)SpecialCharactersSpecialCharactersaz09AZAZ09azDefaultcollating
sequencecanbeoverriddenbyanentryinOBJECTCOMPUTERandSPECIALNAMESparagraphs.1.CodethePROGRAMCOLLATING
SEQUENCEClauseintheObjectcomputerparagraph.PROGRAMCOLLATINGSEQUENCEISalphabetname2.Mapthealphabetnameinthe
SPECIALNAMESparagraphasfollows:ALPHABETalphabetnameisSTANDARD1|NATIVENATIVEstandsforcomputersowncollating
sequencewhereasSTANDARD1standsforASCIIcollatingsequence.
11. 11.MainframeRefresherPart1COBOLPage:11IF/THEN/ELSE/ENDIFThemostfamousdecisionmakingstatementinalllanguageisIF.The
syntaxofIFstatementisgivenbelow:IFcanbecodedwithoutanyELSEstatement.THENisanoisewordanditisoptional.IfORs&ANDsareused
inthesamesentence,ANDsareevaluatedfirstfromlefttoright,followedbyORs.Thisrulecanbeoverriddenbyusingparentheses.Thepermitted
relationconditionsare=,<,>,<=,>=,<>CONTINUEisnooperationstatement.ThecontrolisjustpassedtonextSTATEMENT.NEXTSENTENCE
passesthecontroltothenextSENTENCE.Ifyouforgotthedifferencebetweenstatementandsentence,referthefirstpage.ItisadvisedtouseENDIF,
explicitscopeterminatorfortheIFstatementsthanperiod,implicitscopeterminator.IFcondition1ANDcondition2THENStatementBlock1ELSEIF
condition3THENCONTINUEELSEIFcondition4THENStatementBlock2ELSENEXTSENTENCEENDIFENDIFENDIFStatementBlock2

http://www.slideshare.net/vishwas17/mainframerefresherpart1 43/53
1/23/2016 Mainframerefresherpart1
willbeexecutedonlywhencondition1,2and4areTRUEandcondition3isFALSE.Impliedoperand:Incompoundconditions,itisnotalways
necessarytospecifybothoperandsforeachcondition.IFTOTAL=7or8isacceptable.HereTOTAL=8isimpliedoperation.SIGNtestandCLASS
testSIGNtestisusedtocheckthesignofadataitem.ItcanbedoneasfollowsIFidentifierisPOSITIVE/NEGATIVE/ZEROCLASStestisusedto
checkthecontentofdataitemagainstpredefinedrangeofvalues.ItcanbedoneasfollowsIFidentifieris
NUMERIC/ALPHABETIC/ALPHABETICHIGHER/ALPHABETICLOWERYoucandefineyourownclassesinthespecialnamesparagraph.We
havedefinedaclassDIGITinourspecialnamesparagraph.Itcanbeusedinthefollowingway.IFidentifierisDIGITNegatedconditions.Anysimple,
relational,class,signtestcanbenegatedusingNOT.ButitisnotalwaystruethatNOTNEGATIVEisequaltoPOSITIVE.(ExampleZERO)
12. 12.MainframeRefresherPart1COBOLPage:12EVALUATEWithCOBOL85,weusetheEVALUATEverbtoimplementthecasestructureofother
languages.MultipleIFstatementscanbeefficientlyandeffectivelyreplacedwithEVALUATEstatement.Aftertheexecutionofoneofthewhen
clauses,thecontrolisautomaticallycometothenextstatementaftertheENDEVALUATE.AnycomplexconditioncanbegivenintheWHENclause.
Breakstatementisnotneeded,asitissoinotherlanguages.GeneralSyntaxEVALUATEsubject1(ALSOsubject2..)WHENobject1(ALSO
object2..)WHENobject3(ALSOobject4..)WHENOTHERimperativestatementENDEVALUATE1.NumberofSubjectsinEVALUATEclause
shouldbeequaltonumberofobjectsineveryWHENclause.2.Subjectcanbevariable,expressionorthekeywordTRUE/FLASEandrespectively
objectscanbevalues,TRUE/FALSEoranycondition.3.IfnoneoftheWHENconditionissatisfied,thenWHENOTHERpathwill
beexecuted.SampleEVALUATESQLCODEALSOTRUEWHEN100ALSOA=BimperativestatementWHEN305ALSO(A/C=4)imperative
statementWHENOTHERimperativestatementENDEVALUATE
13. 13.MainframeRefresherPart1COBOLPage:13PERFORMSTATEMENTSPERFORMwillbeusefulwhenyouwanttoexecuteasetofstatements
inmultipleplacesoftheprogram.WriteallthestatementsinoneparagraphandinvokeitusingPERFORMwhereverneeded.Oncetheparagraphis
executed,thecontrolcomesbacktonextstatementfollowingthePERFORM.1.SIMPLEPERFORM.PERFORMPARA1.DISPLAYPARA1
executedSTOPRUN.PARA1.Statement1Statement2.ItexecutesalltheinstructionscodedinPARA1andthentransfersthecontroltothenext
instructioninsequence.2.INLINEPERFORM.WhensetsofstatementsareusedonlyinoneplacethenwecangroupallofthemwithinPERFORM
ENDPERFORMstructure.ThisiscalledINLINEPERFORM.ThisisequaltoDO..ENDstructureofotherlanguages.PERFORMADDATOB
MULTIPLEBBYCDISPLAYVALUEOFA+B*CCENDPERFORM3.PERFORMPARA1THRUPARAN.Alltheparagraphsbetween
PARA1andPARANareexecutedonce.4.PERFORMPARA1THRUPARANUNTILcondition(s).TheidentifiersusedintheUNTILcondition(s)
mustbealteredwithintheparagraph(s)beingperformedotherwisetheparagraphswillbeperformedindefinitely.IftheconditionintheUNTILclauseis
metatfirsttimeofexecution,thennamedparagraph(s)willnotbeexecutedatall.5.PERFORMPARA1THRUPARANNTIMES.Ncanbeliteral
definedasnumericiteminworkingstorageorhardcodedconstant.6.PERFORMPARA1THRUPARANVARYINGidentifier1FROMidentifier2
BYidentifier3UNTILcondition(s)Initializeidentifier1withidentifier2andtestthecondition(s).Iftheconditionisfalseexecutethestatementsin
PARA1thruPARANandincrementidentifier1BYidentifier3andcheckthecondition(s)again.Iftheconditionisagainfalse,repeatthisprocesstill
theconditionissatisfied.7.PERFORMPARA1WITHTESTBEFORE/AFTERUNTILcondition(s).WithTESTBEFORE,Conditionischeckedfirst
andifitfoundfalse,thenPARA1isexecutedandthisisthedefault.(FunctionslikeDOWHILE)WithTESTAFTER,PARA1isexecutedonceand
thentheconditionischecked.(FunctionslikeDOUNTIL)ReferTablesessionforeighthtypeofPERFORM.
14. 14.MainframeRefresherPart1COBOLPage:14EXITstatement.COBOLreservedwordthatperformsNOTHING.Itisusedasasinglestatementina
paragraphthatindicatetheendofparagraph(s)execution.EXITmustbetheonlystatementinaparagraphinCOBOL74whereasitcanbeusedwith
otherstatementsinCOBOL85.GOTOUsage:InastructuredtopdownprogrammingGOTOisnotpreferable.Itofferspermanentcontroltransferto
anotherparagraphandthechancesoflogicerrorsismuchgreaterwithGOTOthanPERFORM.Thereadabilityoftheprogramwillalsobebadly
affected.ButstillGOTOcanbeusedwithintheparagraphsbeingperformed.i.e.WhenusingtheTHRUoptionofPERFORMstatement,branchesor
GOTOstatements,arepermittedaslongastheyarewithintherangeofnamedparagraphs.PERFORM100STEP1THRUSTEP4..100STEP1.
ADDATOBGIVINGC.IFD=ZERODISPLAYMULTIPLICATIONNOTDONEGOTO300STEP3ENDIF.200STEP2.MULTIPLYCBY
D.300STEP3.DISPLAYVALUEOFC:C.HereGOTOusedwithintherangeofPERFORM.ThiskindofControlledGOTOisfinewith
structuredprogrammingalso!
15. 15.MainframeRefresherPart1COBOLPage:15TABLESAnOCCURSclauseisusedtoindicatetherepeatedoccurrencesofitemsofthesame
formatinastructure.OCCURSclauseisnotvalidfor01,77,88levels.Itcanbedefinedaselementaryorgroupitem.Initializationoflarge
tableoccurrenceswithspecificvaluesareusuallydoneusingperformloopsinproceduredivision.Simpletablescanbeinitializedinthefollowingway.
01WEEKARRAYVALUEMONTUEWEDTHUFRISATSUN.05WSWEEKDAYSOCCURS7TIMESPICX(03).Dynamicarrayisthearray
whosesizeisdecidedduringruntimejustbeforetheaccessoffirstelementofthearray.01WSMONTHDAYCAL.05WSDAYSOCCURS31
TIMESDEPENDINGONWSOCCURENCE.IFMONTH=FEBMOVE28toWSOCCURRENCE.ArrayItemscanbeaccessedusingINDEX
orsubscriptandthedifferencebetweenthemarelistedinthetable.RelativesubscriptsandrelativeindexesaresupportedonlyinCOBOL85.Literals
usedinrelativesubscripting/indexingmustbeanunsignedinteger.ADDWSSAL(SUB)WSSAL(SUB+1)TOWSSAL(SUB+2).Sl#Subscript
Index1WorkingStorageitemInternalItemNoneedtodeclareit.2ItmeansoccurrenceItmeansdisplacement3Occurrence,inturntranslatedto
Fasterandefficient.displacementtoaccesselementsandsoslowerthanINDEXaccess.4ItcanbeusedinanyarithmeticItcannotbeusedfor
arithmeticoperationsorfordisplay.operationorfordisplaypurpose.5SubscriptscanbemodifiedbyanyINDEXcanonlybemodifiedwithSET,
arithmeticstatement.SEARCHandPERFORMstatements.Sometimes,youmayfaceaquestionlikehowtorandomlyaccesstheinformationinthe
sequentialfileof50recordsthatcontainsallthedesignationandtherespectivelowerandhighersalaryinformation.Obviously,OSdoesnotallowyou
torandomlyaccessthesequencefile.Youhavetodobyyourselfandthebestwayis,loadthefileintoaworkingstoragetableinthefirstsectionofthe
programandthenaccessasyouwish.Thetablelookupcanbedoneintwoways.Sequentialsearch.Binarysearch.
16. 16.MainframeRefresherPart1COBOLPage:16SequentialSEARCHDuringSERIALSEARCH,thefirstentryofthetableissearched.If
theconditionismet,thetablelookupiscompleted.Iftheconditionisnotmet,thenindexorsubscriptisincrementedbyoneandthenextentryis
searchedandtheprocesscontinuesuntilamatchisfoundorthetablehasbeencompletelysearched.SETindexname1TO1.SEARCHidentifier1AT
ENDdisplaymatchnotfound:WHENcondition1imperativestatement1/NEXTSENTENCEWHENcondition2imperativestatement2/NEXT
SENTENCEENDSEARCHIdentifier1shouldbeOCCURSitemandnot01item.Condition1,Condition2comparesaninputfieldorsearch
argumentwithatableargument.ThoughATENDClauseisoptional,itishighlyrecommendedtocodethat.Becauseifitisnotcodedandelement
lookingforisnotfound,thenthecontrolsimplycomestothenextstatementafterSEARCHwhereaninvalidtableitemcanbereferredandthatmay
leadtoincorrectresults/abnormalends.SETstatementSyntax:SETindexname1TO/UPBY/DOWNBYinteger1.BinarySEARCHWhenthesize
ofthetableislargeanditisarrangedinsomesequenceeitherascendingordescendingonsearchfield,thenBINARYSEARCHwouldbetheefficient
method.SEARCHALLidentifier1ATENDimperativestatement1WHENdataname1=identifier2/literal1/arithmeticexpression1AND
dataname2=identifier3/literal2/arithmeticexpression2ENDSEARCH.Identifier2andidentifier3aresubscripteditemsanddataname1
anddataname2areworkingstorageitemsthatarenotsubscripted.Comparetheitemtobesearchedwiththeitematthecenter.Ifitmatchesfine,else
repeattheprocesswiththeleftorrighthalfdependingonwheretheitemlies.Sl#SequentialSEARCHBinarySEARCH1SEARCHSEARCHALL2
TableshouldhaveINDEXTableshouldhaveINDEX3TableneednotbeinSORTEDTableshouldbeinsortedorderoftheorder.searchingargument.
ThereshouldbeASCENDING/DESCENDINGClause.4MultipleWHENconditionscanbeOnlyoneWHENconditioncanbecoded.coded.5.Any
logicalcomparisonispossible.Only=ispossible.OnlyANDispossibleincompoundconditions.6Indexshouldbesetto1beforeIndexneednotbe
setto1beforeusingSEARCHSEARCHALL.7PreferwhenthetablesizeissmallPreferwhenthetablesizeissignificantlylarge.
17. 17.MainframeRefresherPart1COBOLPage:17MultiDimensionalArraysCOBOL74supportsarrayofmaximumofthreedimensionswhereas
COBOL85supportsuptosevendimensions.ThelowestlevelOCCURSdatanameoranitemsubordinatetoitisusedtoaccessanentryinthearrayor

http://www.slideshare.net/vishwas17/mainframerefresherpart1 44/53
1/23/2016 Mainframerefresherpart1
thetable.IfweuseSEARCHforaccessingmultidimensiontable,thenINDEXEDBYmustbeusedonallOCCURSlevels.Expandednestedperform
isavailableforprocessingmultileveltables.Thesyntaxofthisperformisgivenbelow:PERFORMpara1thruparanVARYINGindex1from1BY1
UNTILindex1>sizeofouteroccursAFTERVARYINGindex2from1by1untilindex2>sizeofinneroccurs.SEARCHexampleformultilevel
tables:01EMPTABLE.05DEPTNUMBEROCCURS10TIMESINDEXEDBYI1.10EMPDETAILOCCURS50TIMESINDEXEDBYI2.15
EMPNUMBERPIC9(04).15EMPSALARYPIC9(05).77EMPNUMBERINPIC9(04)VALUE2052.PERFORM100SEARCHEMPSAL
VARYINGI1FROM1BY1UNTILI1>10ORWSFOUND100SEARCHEMPSAL.SETI2TO1.SEARCHEMPDETAILATENDDISPLAY
NOTFOUND==>LowestOccursWHENEMPNUMBERIN=EMPNUMBER(I1,I2)DISPLAYSALARYIS:EMPSALARY(I1,I2)SETWS
FOUNDTOTRUE==>SearchendsENDSEARCH.NESTEDPROGRAMS,GLOBAL,EXTERNALOneprogrammaycontainotherprogram(s).
Thecontainedprogram(s)maythemselvescontainyetotherprogram(s).AllthecontainedandcontainingprogramsshouldendwithENDPROGRAM
statement.PGMBisnestedaprogramintheexamplebelow:Example:IDENTIFICATIONDIVISION.PROGRAMID.PGMAIDENTIFICATION
DIVISION.PROGRAMID.PGMBENDPROGRAMPGMB.ENDPROGRAMPGMA.Ifyouwantaccessanyworkingstoragevariableof
PGMAinPGMB,thendeclarethemwiththeclauseISGLOBALinPGMA.IfyouwanttoaccessanyworkingstoragevariableofPGMBinPGMA,
declarethemwiththeclauseISEXTERNALinPGMB.NestedProgramsaresupportedonlyinCOBOL85.IfthereisaprogramPGMCinside
PGMB,itcannotbecalledfromPGMAunlessitsprogramidisqualifiedwithkeywordCOMMON.
18. 18.MainframeRefresherPart1COBOLPage:18SORTandMERGETheprogrammingSORTiscalledasinternalsortwhereasthesortinJCL
iscalledexternalsort.Ifyouwanttomanipulatethedatabeforefeedingtosort,preferinternalsort.Inallothercases,externalsortisthegoodchoice.
Internalsort,inturninvokestheSORTproductofyourinstallation.(DFSORT).IntherunJCL,allocateatleastthreesortworkfiles.(SORTWKnn=>
nncanbe0099).FASTSRTcompileroptionmakestheDFSORTtodoallfileIOoperationthanyourCOBOLprogram.Itwouldsignificantly
improvetheperformance.TheresultoftheSORTcanbecheckedinSORTRETURNregister.Ifthesortissuccessful,thevaluewillbe0else
16.Syntax:SORTSORTFILEONASCENDING/DESCENDINGKEYsdkey1sdkey2USINGfile1file2/INPUTPROCEDUREISsection1
GIVINGfile3/OUTPUTPROCEDUREissection2ENDSORTFile1,File2aretobesortedinputfilesandFile3issortedoutputfileandallofthem
aredefinedinFD.SORTFILEisDiskSORTWorkfilethatisdefinedatSD.Itshouldnotbeexplicitlyopenedorclosed.INPUTPROCEDUREand
USINGaremutuallyexclusive.IfUSINGisused,thenfile1andfilesshouldnotbeopenedorREADexplicitly.IfINPUTPROCEDUREisusedthen
File1andfile2needtobeOPENedandREADtherecordsonebyoneuntilendofthefileandpasstherequiredrecordstosortworkfileusingthe
commandRELEASE.Syntax:RELEASEsortworkrecordfrominputfilerecord.OUTPUTProcedureandGIVINGaremutuallyexclusive.If
GIVINGisused,thenfile3shouldnotbeopenedorWRITEexplicitly.IfOUTPUTprocedureisused,thenFile3shouldbeOPENedandtherequired
recordsfromsortworkfileshouldbeRETURNedtoit.OnceATENDisreachedforsortworkfile,closetheoutputfile.Syntax:RETURNsortwork
filenameATENDimperativestatement.INPUTPROCEDUREVsOUTPUTPROCEDURE:Sometimesitwouldbemoreefficienttoprocessdata
beforeitissorted,whereasothertimesitismoreefficienttoprocessafteritissorted.Ifweintendtoeliminatemorerecords,thenitwouldbebetter
preprocessthembeforefeedingtoSORT.Ifwewanttoeliminatealltherecordshavingspacesinthekeyfieldthenitwouldbeefficientifweeliminate
themaftersorting.Becausetherecordswithblankkeycomesfirstaftersorting.MERGEItissameassort.USINGismandatory.Thereshouldbe
minimumtwofilesinUSING.MERGESortworkfileONASCENDINGKEYdataname1dataname2USINGfile1file2GIVINGfile3/OUTPUT
PROCEDUREissection1ENDMERGEProgramsortregisters(anditsequivalentDFSORTparameter/meaning)SORTFILESIZE(FILSZ),SORT
CORESIZE(RESINV),SORTMSG(MSGDDN)SORTMODESIZE(SMS=nnnnn)SORTRETURN(returncodeofsort)andSORTCONTROL
(NamesthefileofcontrolcarddefaultisIGZSRTCD)
19. 19.MainframeRefresherPart1COBOLPage:19STRINGMANIPULATIONAstringreferstoasequenceofcharacters.Stringmanipulation
operationsincludefindingaparticularcharacter/substringinastring,replacingparticularcharacter/substringinastring,concatenatingstringsand
segmentingstrings.AllthesefunctionsarehandledbythreeverbsINSPECT,STRINGandUNSTRINGinCOBOL.EXAMINEistheobsoleteversion
ofINSPECTsupportedinCOBOL74.INSPECTFORCOUNTINGItisusedtotallytheoccurrenceofasinglecharacterorgroupsofcharactersin
adatafield.INSPECTidentifier1TALLYINGidentifier2FORALL|LEADINGliteral1|identifier3[BEFORE|AFTERINITIALidentifier4|literal2]
Optional.INSPECTidentifier1TALLYINGidentifier2FORCHARACTERS[BEFORE|AFTERINITIALidentifier4|literal2]Optional.Main
Stringisidentifier1andcountisstoredinidentifier2.Literal1orIdentifier3isacharacterorgroupofcharactersyouarelookinginthemain
string.INSPECTfurtherqualifiesthesearchwithBEFOREandAFTERoftheinitialoccurrenceofidentifier4orliteral2.Example:WSNAME
MUTHUSARAVANASURYACHANDRADEVIINSPECTWSNAMETALLYINGWSCOUNTALLSBEFOREINITIALSARAVANA
AFTERINITIALCHANDRAENDINSPECTResult:WSCOUNTcontains1INSPECTFORREPLACINGItisusedtoreplacetheoccurrenceof
asinglecharacterorgroupsofcharactersinadatafield.INSPECTidentifier1REPLACINGALL|LEADINGliteral1|identifier2BYidentifier
3|literal2[BEFORE|AFTERINITIALidentifier4|literal2]Optional.INSPECTidentifier1REPLCINGCHARACTERSBYidentifier2
BEFORE|AFTERINITIALidentifier3|literal1INSPECTFORCOUNTINGANDREPLACINGItisacombinationoftheabovetwo
methods.INSPECTidentifier1TALLYING<tallyingpart>REPLACING<replacingpart>
20. 20.MainframeRefresherPart1COBOLPage:20STRINGSTRINGcommandisusedtoconcatenateoneormorestrings.Syntax:STRINGidentifier1
/literal1,identifier2/literal2DELIMITEDBY(identifier3/literal3/SIZE)INTOidentifier4ENDSTRING.01VAR1PICX(10)VALUE
MUTHU01VAR2PICX(10)VALUESARA01VAR2PICX(20).TogetdisplayMUTHU,SARASTRINGVAR1DELIMITEDBY,
DELIMITEDBYSIZEVAR2DELIMITEDBYINTOVAR3ENDSTRING.Thereceivingfieldmustbeanelementarydataitemwithnoediting
symbolsandJUSTRIGHTclause.WithSTRINGstatement,specificcharactersofastringcanbereplacedwhereasMOVEreplacesthefullstring.01
AGEOUTPICX(12)VALUE12YEARSOLD.STRING18DELIMITEDBYSIZEINTOAGEOUT.=>18YEARSOLD.Reference
ModificationequivalentofSUBSTRReferencemodificationisusedtoretrieveoroverwriteasubstringofastring.:isknownasreference
modificationoperator.Syntax:String(StartingPosition:Length)MOVE18TOAGEOUT(1:2)doesthesameaswhatwedidwithSTRING
command.Whenitisusedinarrayelements,thesyntaxisArrayelement(occurrence)(StartingPosition:Length)UNSTRINGUNSTRINGcommandis
usedtosplitonestringtomanystrings.Syntax:UNSTRINGidentifier1[DELIMITEDBY(ALL/)identifier2/literal1[,OR(ALL/)(identifier3/literal
2),..]]INTOidentifier4[,DELIMITERINidentifier5,COUNTINidentifier6][,identifier7[,DELIMITERINidentifier8,COUNTINidentifier9]
01WSDATAPICX(12)VALUE10/200/300/1.UNSTRINGWSDATADELIMITEDBY/INTOWSFLD1DELIMITERINWSD1COUNT
INWSC1WSFLD2DELIMITERINWSD2COUNTINWSC2WSFLD3DELIMITERINWSD3COUNTINWSC3END
UNSTRING.Result:WSFLD1=10WSFLD2=200WSFLD3=300WSC1=2WSC2=3WSC3=3WSD1=/WSD2=/WSD3/ON
OVERFLOWcanbecodedwithSTRINGandUNSTRING.IfthereisSTRINGtruncationthentheimperativestatementsfollowedONOVERFLOW
willbeexecuted.
21. 21.MainframeRefresherPart1COBOLPage:21COPYStatementACOPYstatementisusedtobringaseriesofprewrittenCOBOLentriesthathave
beenstoredinlibrary,intoaprogram.1.Commonroutineslikeerrorroutine,datevalidationroutinearecodedinalibraryandbringintotheprogramby
COPY.2.Masterfilesareusedinmultipleprograms.Theirlayoutcanbeplacedinonecopybookandbeplacedwhereverthefilesareused.Itpromotes
programstandardizationsincealltheprogramssharethesamelayoutandthesamedatanames.Thisreducescodinganddebuggingtime.Changein
layoutneedschangeincopybookonly.Itisenoughifwejustrecompiletheprogramformakingthenewcopyeffective.Syntax:COPYcopybookname
[(OF/IN)libraryname][REPLACINGstringtobereplacedBYreplacingstring]CopybooksarestoredasmembersinPDSlibraryandduring
compilationtime,theyareincludedintotheprogram.Bydefault,thecopybooklibraryisSYSLIBanditcanbechangedusingINorOFofCOPY
statement.Copybookscanbeusedinthefollowingparagraphs.SOURCECOMPUTER,OBJECTCOMPUTER,SPECIALNAMES,FILE
CONTROL,IOCONTROL,FDSECTION,PARAGRAPHSINPROCEDUREDIVISION.Ifthesamecopybookisusedmorethanonceinthe
program,thentherewillbeduplicatedatadeclarationerrorduringcompilation,asallthefieldsaredeclaredtwice.Inthiscase,onecopybookcanbe

http://www.slideshare.net/vishwas17/mainframerefresherpart1 45/53
1/23/2016 Mainframerefresherpart1
usedwithREPLACINGverbtoreplacehighlevelqualifieroftheallthevariableswithanotherqualifier.Example:COPYCUSTOMERREPLACING
CUST1BYCUST2.Delimiter==shouldbeusedforreplacingpseudotexts.Thereplacingoptiondoesnotaltertheprewrittenentriesinthe
librarythechangesaremadetotheuserssourceprogramonly.CALLstatement(SubPrograms)Whenaspecificfunctionalityneedtobeperformedin
morethanoneprogram,itisbesttowritethemseparatelyandcallthemintoeachprogram.SubProgramscanbewritteninanyprogramminglanguage.
Theyaretypicallywritteninalanguagebestsuitedtothespecifictaskrequiredandthusprovidegreaterflexibility.MainProgramChanges:CALL
statementisusedforexecutingthesubprogramfromthemainprogram.AsampleofCALLstatementisgivenbelow:CALLPGM2USINGBY
REFERENCEWSVAR1,BYCONTENTWSVAR2.PGM2iscalledhere.WSVAR1andWSVAR2areworkingstorageitems.WSVAR1is
passedbyreference.WSVAR2ispassedbyContent.BYREFERENCEisdefaultinCOBOLandneednotbecoded.BYCONTENTLENGTHphrase
permitsthelengthofdataitemtobepassedtoacalledprogram.
22. 22.MainframeRefresherPart1COBOLPage:22SubProgramChanges:WSVAR1andWSVAR2areworkingstorageitemsofmainprogram.Aswe
havealreadymentioned,thelinkagesectionisusedforaccessingexternalelements.Astheseworkingstorageitemsareownedbymainprogram,to
accesstheminthesubprogram,weneedtodefinetheminthelinkagesection.LINKAGESECTION.01LINKAGESECTION.05LKVAR1PIC
9(04).05LKVAR2PIC9(04).Inadditiontodefinetheminlinkagesection,theproceduredivisionshouldbecodedwiththesedataitemsforaddress
ability.PROCEDUREDIVISIONUSINGLKVAR1,LKVAR2Thereisaoneonecorrespondencebetweenpassedelementsandreceivedelements
(Callusing,linkageandproceduredivisionusing)BYPOSITION.Thisimpliesthatthenameoftheidentifiersinthecalledandcallingprogramneed
notbethesame(WSVAR1&LKVAR1)butthenumberofelementsandpictureclauseshouldbesame.Thelaststatementofyoursubprogramshould
beEXITPROGRAM.Thisreturnsthecontrolbacktomainprogram.GOBACKcanalsobecodedinsteadofEXITPROGRAMbutnotSTOPRUN.
EXITPROGRAMshouldbetheonlystatementinaparagraphinCOBOL74whereasitcanbecodedalongwithotherstatementsinaparagraphin
COBOL85.PROGRAMID.<Programname>ISINITIALPROGRAM.IfISINITIALPROGRAMiscodedalongwithprogramidofsubprogram,
thentheprogramwillbeininitialstageeverytimeitiscalled(COBOL85feature).AlternativelyCANCELissuedafterCALL,willsetthesubprogram
toinitialstate.Ifthesubprogramismodifiedthenitneedstoberecompiled.Theneedformainprogramrecompilationisdecidedbythecompiler
optionusedforthemainprogram.IftheDYNAMcompilerisused,thenthereisnoneedtorecompilethemainprogram.Themodifiedsubroutinewill
beineffectduringtherun.NODYNAMisdefaultthatexpectsthemainprogramrecompilation.DifferencebetweenPassbyreferenceandPassby
contentSl#PasslByReferencePassByContent1CALLsub1USINGBYCALLsub1USINGBYCONTENTWSVAR1REFERENCEWS
VAR1(BYCONTENTkeywordisneeded)2ItisdefaultinCOBOL.BYBYCONTENTkeywordismandatorytoREFERENCEisnotneeded.pass
anelementbyvalue.3AddressofWSVAR1ispassedValueofWSVAR1ispassed4ThesubprogrammodificationsThesubprogrammodifications
ontheonthepassedelementsarepassedelementsarelocaltothatvisibleinthemainprogram.subprogramandnotvisibleinthemainprogram.
23. 23.MainframeRefresherPart1COBOLPage:23DifferencebetweenStaticCallandDynamicCallSl#STATICCallDYNAMICCall1Identifiedby
Callliteral.IdentifiedbyCallvariableandtheEx:CALLPGM1.variableshouldbepopulatedatruntime.01WSPGMPICX(08).MovePGM1to
WSPGMCALLWSPGM2DefaultCompileroptionisIfyouwantconverttheliteralcallsintoNODYNAMandsoalltheliteralDYNAMIC,the
programshouldbecallsareconsideredasstaticcalls.compiledwithDYNAMoption.Bydefault,callvariablesandanyunresolvedcallsare
consideredasdynamic.3.IfthesubprogramundergoesIfthesubprogramundergoeschange,change,subprogramandmainrecompilationof
subprogramisenough.programneedtoberecompiled.4SubmodulesarelinkeditedwithSubmodulesarepickedupduringrunmainmodule.time
fromtheloadlibrary.5SizeofloadmodulewillbelargeSizeofloadmodulewillbeless.6FastSlowcomparedtoStaticcall.7Lessflexible.More
flexible.8SubprogramwillnotbeininitialProgramwillbeininitialstateeverytimestagethenexttimeitiscalleditiscalled.unlessyouexplicitly
useINITIALoryoudoaCANCELaftereachcall.INTRINSICFUNCTIONS:LENGTHReturnsthelengthofthePICclause.Usedforfindinglength
ofgroupitemthatspannedacrossmultiplelevels.MAXReturnsthecontentoftheargumentthatcontainsthemaximumvalueMINReturnsthecontent
oftheargumentthatcontainstheminimumvalueNUMVALReturnsthenumericvaluerepresentedbyanalphanumericcharacterstringspecifiedinthe
argument.NUMVALCSameasNUMVALbutcurrencyanddecimalpointsareignoredduringconversion.CURRENTReturns21Charsalphanumeric
valueYYYYMMDDHHMMSSnnnnnnDATEINTEGEROFDATEReturnsINTEGERequivalentofGregoriandatepassed.INTEGEROFDAY
ReturnsINTEGERequivalentofJuliandatepassed.DATEOFINTEGERReturnsGregoriandatefortheintegerpassed.DAYOFINTEGERReturns
Juliandatefortheintegerpassed.Note:FUNCTIONINTEGEROFDATE(01011601)returns1.FILEHANDLINGAdatafileiscollectionof
relevantrecordsandarecordiscollectionofrelevantfields.ThefilehandlinginCOBOLprograminvolvesfivesteps.
24. 24.MainframeRefresherPart1COBOLPage:24Stepsinfilehanding1.Allocation:ThefilesusedintheprogramshouldbedeclaredinFILE
CONTROLparagraphofenvironmentdivision.ThemappingwithJCLDDNAMEisdonehere.Thefileisallocatedtoyourprogrambythisstatement.
2.Definition.ThelayoutofthefileanditsattributesaredefinedintheFILESECTIONofDATADIVISION.3.Open:Datasetisconnected/readiedto
yourprogramusingOPENstatement.ThemodeofOPENdecidestheoperationallowedandtheinitialpointerinthedataset.Forexample,EXTEND
modeallowsonlywriteaccessandthepointeriskeptontheendoffiletoappend.4.Process:Processthefileasperrequirement,usingtheIO
statementsprovidedbyCOBOL.(READ,WRITE,REWRITEandDELETE)5.Close:Aftertheprocessing,closethefiletodisconnectitfrom
theprogram.AllocationoffileSELECTStatement(ENVIRONMENT>INPUTOUTPUT>FILECONTROL)SELECT[OPTIONAL]FILENAME
ASSIGNtoDDNAME=>ALLFilesORGANIZATIONISSEQUENTIAL/INDEXED/RELATIVE=>ALLFilesACCESSIS
SEQUNETIAL/RANDOM/DYNAMIC=>ALLFilesRECORDKEYISFILEKEY1=>KSDSRELATIVEKEYISWSRRN=>RRDSALTERNARE
RECORDKEYISFILEKEY2WITHDUPLICATES=>KSDSwithALTERNARERECORDKEYISFILEKEY3WITHOUTDUPLICATES
=>AIXFILESTATUSISWSFILESTAT1=>ALLFiles[,WSFILESTAT2]=>VSAMFilesSELECTStatementOPTIONALClauseThiscanbe
codedonlyforinputfiles.IfOPTIONALisnotcoded,thentheinputfileisexpectedtopresentinJCL.Ifnot,anexecutionerrorwilloccur.If
OPTIONALiscoded,thenifthefileisnotmappedinJCL,itisconsideredasemptyfileandthefirstreadresultsendoffile.Thefilecanalsobe
dynamicallyallocatedinsteadofstaticallocationinJCL.SELECTStatementASSIGNTOFILENAMEisthelogicalnameusedinsidetheprogram
andDDNAMEisthelogicalnameintheJCL,mappedwithphysicaldataset.DDNAMEcanbeprefixedwithStoindicateQSAMfile,ASto
indicateESDSfileandwithnoprefixtoindicateKSDS/RRDSfile.JCLStepexecutingtheprogramshouldhaveadatasetwithDDNAMEas
label//DDNAMEDDDSN=BPMAIN.EMPLOYEE.DATA,DISP=SHRSELECTStatementORGANIZATIONItcanbeSEQUENTIAL(PSorVSAM
ESDS),INDEXED(VSAMKSDS),RELATIVE(VSAMRRDS).DefaultisSequential.
25. 25.MainframeRefresherPart1COBOLPage:25SELECTStatementACCESSMODESEQUENTIAL.Itisdefaultaccessmodeanditisusedto
accesstherecordsONLYinsequentialorder.Toread100threcord,first99recordsneedtobereadandskipped.RANDOM.Recordscanberandomly
accessedintheprogramusingtheprimary/alternatekeyofindexedfileorganizationorrelativerecordnumberofrelativeorganization.100threcordcan
directlybereadaftergettingtheaddressoftherecordfromtheINDEXpartforINDEXEDfiles.100threcordcandirectlybereadforRELATIVEfiles
evenwithoutanyindex.DYNAMIC.Itismixedaccessmodewherethefilecanbeaccessedinrandomaswellassequentialmodeinthe
program.Example:Readingthedetailsofalltheemployeesbetween10002000.Firstrandomlyaccess1000themployeerecord,thenreadsequentially
till2000themployeerecord.STARTandREADNEXTcommandsareusedforthispurposeintheproceduredivision.SELECTStatementRECORD
KEYISItisprimarykeyofVSAMKSDSfile.Itshouldbeuniqueandpartofindexedrecordstructure.SELECTStatementALTERNATERECORD
KEYISThisphraseisusedforKSDSfilesdefinedwithAIX.AddtheclauseWITHDUPLICATESiftheAIXisdefinedwithduplicates.Referringto
VSAMbasics,everyalternateindexrecordhasanassociatedPATHandthepathshouldbeallocatedintheJCLthatinvokesthisprogram.The
DDNAMEofthepathshouldbeDDNAMEofthebaseclustersuffixedwith1forthefirstalternaterecordclause,suffixedwithnfornthALTERNATE
RECORDKEYclauseinSELECTclause.SELECTStatementFILESTATUSISWSFILESTAT1,WSFILESTAT2WSFILESTAT1shouldbe
definedasPICX(02)inworkingstoragesection.Aftereveryfileoperation,thefilestatusshouldbecheckedforallowablevalues.WSFILESTAT2
canbecodedforVSAMfilestogettheVSAMreturncode(2bytes),VSAMfunctioncode(1byte)andVSAMfeedbackcode(3bytes).Thisisa6

http://www.slideshare.net/vishwas17/mainframerefresherpart1 46/53
1/23/2016 Mainframerefresherpart1
bytefieldinworkingstorage.RESERVEClause.RESERVEclause[RESERVEintegerAREA]canbecodedintheSELECTstatement.Thenumberof
bufferstobeallocatedforthefileiscodedhere.Bydefaulttwobufferswillbeallocatediftheclauseisnotcoded.Sincesimilaroptionisavailablein
JCL,thisisnotcodedinprogram.RESERVE1AREAallocatesonebuffer,forthefileintheSELECTstatement.DefiningthefileinFILESECTION
FD
26. 26.MainframeRefresherPart1COBOLPage:26FDFILENAMERECORDINGMODEISV/VB/F/FBRECORDCONTAINSMCHARACTERS
(TONCHARACTERS)BLOCKCONTAINSXCHARACTERS/RECORDS(TOYCHARACTERS/RECORDS)LABELRECORDSARE
OMITTED/STANDARDDATARECORDISFILERECORD.01FILERECORDPICX(nnn).FDRECORDCONTAINSItspecifiesthelengthofthe
recordintermsofbytes.(ItwillbeRECORDcontainsmtonCHARACTERSforvariableformatfiles)FDBLOCKCONTAINSItspecifiesthe
physicalrecordsize.ItcanbementionedasnumberoflogicalrecordsORnumberofcharacters,thatismultipleoflogicalrecordlength.Itissuggested
tocodeBLOCKCONTAINS0RECORDSsothatsystemwilldecidetheoptimumsizeforthefilebasedonthedeviceusedforstoringthefile.
BLOCKCONTAINSclauseistreatedascommentsforVSAMfiles.AdvantageofBlocking:1.IOtimeisreducedasnnumbersofrecordsarereadinto
mainmemorybufferduringanIO.2.Interrecordgapisremovedandthegapexistonlybetweenblocks.SomemorywastageduetoIRGisavoided.FD
RECORDINGMODEISItcanbeF(FIXED)V(VARIABLE)FB(FIXEDBLOCK)VB(VARIABLEBLOCKED)Variablerecordfileidentification:If
thereisnorecordingmode/recordcontainsclause,itisstillpossibletoidentifyvariablelengthrecords.IfthereisanOCCURSdependingonclauseor
therearemultiple01levelsandevery01levelisofdifferentsize,thenthefilewouldbeofvariablelength.Multiple01levelinFilesectionisan
exampleforimplicitredefinition.FDLABELRECORDSClauseAsageneralrule,LABELRECORDSareSTANDARDiscodedforDiskand
Tapefiles,LABELRECORDSAREOMITTEDiscodedforprinterfiles.InCOBOL74,thisclauseisamandatoryclausewhereasCOBOL85madethis
asoptional.FDDATARECORDISClauseItisusedtonamethedatarecord(s)ofthefile.Morethanonerecordcanbecodedhere.OPEN
STATEMENTSyntax:OPENOPENMODEFILENAMEOPENMODEcanbeINPUTOUTPUTIOEXTENDINPUTFilecanbeusedONLYFOR
READpurpose.OUTPUTFilecanbeusedONLYFORWRITEpurpose.IOFilecanbeusedFORREAD,WRITEandREWRITE
purpose.EXTENDFilecanbeusedFORappendingrecordsusingWRITE.CLOSEstatement.TheusedfilesareclosedusingCLOSEstatement.If
youdontclosethefiles,thecompletionoftheprogramclosesallthefilesusedintheprogram.
27. 27.MainframeRefresherPart1COBOLPage:27Syntax:CLOSEFILENAMEOPENandCLOSEforTAPEfilesAdvancedIfmorethanonefileis
storedinareeloftape,itiscalledasmultifilevolume.Whenonefileisstoredinmorethanonereeloftape,itiscalledasmultivolumelabel.Onereel
isknownasonevolume.Whentheendofonevolumeisreached,automaticallythenextvolumeopens.Sothereisnospecialcontrolisneededformulti
volumefiles.OPENINPUTfile1[WITHNOREWIND|REVERSED]OPENOUTPUTfile2[WITHNOREWIND]CLOSEfile3[{REEL|UNIT}
[WITHNOREWIND|FORREMOVAL]CLOSEfile3[WITHNOREWIND|LOCK]UNITandREELaresynonyms.AfteropeningaTAPEfile,the
fileispositionedatitsbeginning.WhenopeningthefileiftheclauseREVERSEDiscoded,thenthefilecanbereadintheREVERESEdirection.
(Providedhardwaresupportsthisfeature)Whenyouclosethefile,thetapeisnormallyrewound.TheNOREWINDclausespecifiesthattheTAPE
shouldbeleftinitscurrentposition.CLOSEstatementwithREELoptionclosesthecurrentreelalone.SothenextREADwillgetthefirstrecordof
nextREEL.Thiswillbeusefulwhenyouwantskipalltherecordsinthefirstreelafternnumberofrecordsprocessing.SinceTAPEissequential
device,ifyoucreatemultiplefilesinthesameTAPE,thenbeforeopeningthesecondfile,firstfileshouldbeclosed.Atanypointoftime,youcanhave
onlyonefileisactiveintheprogram.Inadditiontothis,youhavetocodeMULTIPLEFILEclauseintheIOcontrolparagraphofenvironment
division.MULTIPLEFILETAPECONTAINSOUTFILE1POSITION1OUTFILE3POSITION3.ThefilesOUTFILE1andOUTFILE3usedin
theprogramarepartofasameTAPEandtheyexistinfirstandthirdpositioninthetape.Alternatively,thisinformationcanbepassedfromJCLusing
LABELparameter.READstatementREADstatementisusedtoreadtherecordfromthefile.Syntax:READFILENAME[INTOwsrecord][KEYIS
FILEKEY1]
28. 28.MainframeRefresherPart1COBOLPage:28[ATEND/INVALIDKEYimperativestatement1][NOTATEND/NOTINVALIDKEYimperative
statement2]ENDREADIfINTOclauseiscoded,thenthefileisdirectlyreadintoworkingstoragesectionrecord.Itispreferredasitavoidsanother
moveoffilesectionrecordtoworkingstoragerecordfollowedbysimpleREAD.READINTOisnotpreferredforvariablesizerecordswherethe
lengthoftherecordbeingreadisnotknown.KEYISclauseisusedwhileaccessingarecordrandomlyusingprimary/alternaterecordkey.ATENDand
NOTATENDareusedduringsequentialREADofthefile.INVALIDKEYandNOTINVALIDKEYareusedduringrandomreadofthefile.Before
accessingthefilerandomly,thekeyfieldshouldhaveavaluebeforeREAD.WRITEStatementWritestatementisusedtowriteanewrecordinthefile.
IfthefileisopenedinEXTENDmode,therecordwillbeappended.IfthefileisopenedinOUTPUTmode,therecordwillbeaddedatthecurrent
position.Syntax:WRITEFILERECORD[FROMwsrecord][INVALIDKEYimperativestatement1]ENDWRITEFROMclauseavoidstheexplicit
moveofworkingstoragerecordtofilesectionrecordbeforeWRITE.REWRITEStatementREWRITEisusedtoupdateanalreadyreadrecord.To
updatearecordinafile,thefileshouldbeopenedinIOmode.Syntax:REWRITEFILERECORD[FROMwsrecord][INVALIDKEYimperative
statement1]ENDREWRITESTARTStatementSTARTisusedwithdynamicaccessmodeofindexedfiles.Itestablishesthecurrentlocationinthe
clusterforREADNEXTstatement.STARTitselfdoesnotretrieveanyrecord.Syntax:STARTFILENAMEKEYisEQUALTO/NOTLESS
THAN/GREATERTHANkeyname[INVALIDKEYimperativestatement1]ENDSTART.DELETEStatementDELETEisusedtodeletethemost
recentlyreadrecordinthefile.Todeletearecord,thefileshouldbeopenedinIOmode.Syntax:DELETEFILENAMERECORD[INVALIDKEY
imperativestatement1]ENDDELETEFileErrorHandlingTherearechancesforfailureofanyfileIOprocessing.ThefailureofanIOoperationcan
beacceptedorcannotbetolerated.Theseverityoffailurehastobedefinedintheprogramdesignstage.
29. 29.MainframeRefresherPart1COBOLPage:29Letusassumethatwedonthaveanyerrorhandlinginourprogram.Inthiscase,forexample,ifyou
donthaveaspecificrecordinthefile,therandomreadofthatrecordwouldimmediatelyterminatetheprogramwitherrorrecordnotfound.Error
HandlingClausesProvidedbyCOBOL.Thesuddenterminationcanbeavoidedbyhandlingthiserror,withINVALIDKEYclauseofREAD.Basedon
theimportanceoftherecordandbusinessrule,wecancontinueourprogramwithnextrecordorterminatetheprogramproperly.ATENDisanother
errorhandlingclauseprovidedbyCOBOL.Butthereisnowaytohandleallsucherrorsinthisway.Assignfilestatusandtaketheresponsibility.The
secondmethodis,assigningfilestatustothefileintheSELECTclauseandchecksthefilestatusaftereachandeveryIOandensuresthatthevalue
ofstatuscodeisoneoftheallowablevalues.Ifitisnotanallowablereturncode,thenabnormallyendtheprogramwitherrorstatementsthatwouldbe
easiertodebug.ButwehavetodothischeckingaftereachandeveryIOoperation.ThisisMOSTPREFERREDERRORHANDLINGMETHODin
structuredprogramming.DeclarativesUSEstatementCOBOLprovidesanoptiontogroupallthepossibleerrorsofspecificoperation(s)inaplaceand
thatwillbeautomaticallyinvokedduringtherespectiveoperation(s)ofanyfile.Thisavoidsredundantcode.ThisisdoneinDECLARATIVEsectionof
theproceduredivision.DECLARATIVEshouldbethefirstsectionintheproceduredivisionifcoded.PROCEDURE
DIVISION.DECLARATIVES.USEPROCEDURESECTION.USEAFTEREXCEPTIONPROCEDUREONINPUTERRORPROCEDURE.Check
thefilestatuscodeforvalidity.ENDDECLARATIVES.WheneverthereisanerrorintheprocessingofANYFILEopenedinINPUTmode,thenthe
controlcomestoERRORPROCEDURE.Thevalidityoferrorshouldbecheckedinthisparagraphandalloworrestricttheprocessdown,basedon
severityoferrorcode.ThecompletesyntaxofUSEstatementsis:USEAFTERSTANDARDERROR|EXCEPTIONPROCEDUREON
INPUT|OUTPUT|IO|EXTEND|file1IfINPUTiscoded,thefollowingprocedurewillbeexecutedforeveryoperationinvolvedinanyfilethatis
openedinINPUTmode.OUTPUT,IOandEXTENDhavethesamemeaningbutthemodeisdifferent.Iffilename(file1)iscodedintheUSE
statement,thenalltheinputoutputoperationofthatspecificfilewillbechecked.ERRORandEXCEPTIONaresynonyms.TheProcedurewrittenina
DECLARATIVEsectionshouldnotrefertoanynondeclarativeprocedurewrittenaftertheendprocedureandviceversa.IOCONTROLSAME
AREAANDSAMERECORDAREARESERVEclauseofSELECTstatementspecifiesthenumberofbufferstobeallocatedforafile.SAMEAREA
allowsmorethanonefiletousethesamebufferarea.Thiswillbeveryusefulwhentheprogrammustworkwithalimitedmemory
30. 30.MainframeRefresherPart1COBOLPage:30space.ButtheproblemisonlyonefileshouldbeopenatatimeifSAMEAREAiscoded.Syntax:

http://www.slideshare.net/vishwas17/mainframerefresherpart1 47/53
1/23/2016 Mainframerefresherpart1
SAMEAREAFORfile1file2file3.IfSAMERECORDAREAiscoded,thenthebufferisnotsharedbutonlytherecordareaisshared.Somore
thanonefilecanbeinopenstate.Weshouldbecarefulwhilefillingintherecordareaoftheoutputfile.Thismaydestroytherecordreadmostrecently.
Syntax:SAMERECORDAREAFORfile1file2file3.SAMESORTAREAallowsmorethanonesort/mergeworkfilestousethesamearea.The
sortworkfilesareautomaticallyallocatedwhenfileisopenedanddeallocatedwhenfileisclosed.Asthesortfileisautomaticallyopenedand
closedduringaSORTandtwosortfilescannotbeopenedatatime,thisclausemaynotbeuseful.Syntax:SAMESORT|SORTMERGEAREAforfile
1file2.File1orfile2shouldbeaSDfile.IOCONTROLRERUNClauseRERUNONrescueFOREVERYintegerRECORDSonfile1Thiswill
causecheckpointtobetakenforeveryinterger1recordsprocessingoffile1.IftheprogramABENDEDbeforethecompleteprocessingofthefile1,
thentheprogramwillrestartfrominteger+1STrecordinsteadoffirstrecord.Therescuefiledetailsshouldbementionedoutsidetheprogramandit
variesfrominstallationtoinstallation.ENTRYstatementENTRYstatementestablishesanalternateENTRYpointinaCOBOLcalledsubprogram.
WhenaCALLstatementnamingthealternateentrypointisexecutedinacallingprogram,controlistransferredtothenextexecutablestatement
followingtheentrystatement.ExceptwhenaCALLstatementreferstoanentryname,theENTRYstatementsareignoredatruntime.MatchingLogicIf
youhavebeengiventwofilesofsimilartype,saymasterandtransactionfileandyouarerequestedtoupdatethemasterfilewithtransactionfile
informationforexistingrecordsandprepareareportofnewtransactionsanddeletedtransactions,thenyoushouldgoforwhatiscalledMatchinglogic.
Thisisalsoknownascosequentialprocessing.Sortboththefilesonkeyandcomparethekeys.Ifthekeysarematchingthenupdatethefile.Ifyoufind
anyrecordthatisfoundintransactionbutnotinmasterfile,thenthatisnewadditionandthereverseisdeletion.Ifthemasterkeyisgreaterthan
transactionkey,thenthatcorrespondstothefirstcaseandreverseisthesecondcase.ThiscanbeeasilydoneinJCLusingICETOOL.ReferJCL
section.FILESTATUSCODESItisatwobyteworkingstorageitem.Thefirstbytedenotesthegeneralcategorywhereassecondbytedenotesthe
particulartypeoferrormessageunderthatcategory.
31. 31.MainframeRefresherPart1COBOLPage:310SuccessfulOPEN/READ/WRITEOperation0Successfulcompletion2Duplicatekeywasdetected
whichisallowedasperdefinitionofAIX.4LengthofrecordjustREADdidntconformtothefixedlengthattributesforthefile.5Referenced
OptionalfileisnotpresentduringOPEN.IfopenmodeisIOorEXTEND,thenfilewillbecreated.7OpenorClosestatementisexecutedwitha
phrasethatimpliesatapefile(exNOREWIND)whereasthefileisnotinTAPE.1WhenATENDconditionfails0SequentialREADisattemptedon
1.aftertheendoffileisreached2.optionalfilethatisnotpresent.4SequentialREADwasattemptedforarelativefileandRRNislargerthanthe
maximumthatcanbestoredintherelativekeydataitem.0WhenINDEXKeyfails1Sequenceerrorexistsforsequentiallyaccessedindexfile.2
Attemptwasmadetowritearecordthatwouldcreateaduplicatekey.3Recordnotfound.(forkeyedrandomaccess)4SpacenotfoundforWRITE3
PermanentOpenerror5Openinganonoptionalfilethatwasnotpresent.7Openmodeisnotpermitted.8Openissuedforafilethatwasclosed
previouslywithlock9FileattributemismatchOpenfailed.4Logicerrorinopening/closing/deleting1OPENaopenedfile.2CLOSEattemptedfornot
openedfile.3IOstatementbeforethecurrentREWRITE/DELETEisnotsuccessful.4REWRITEattemptwithinvalidlength7READfilewhichisnot
openedinINPUTorIOmode8WRITEfilewhichisnotopenedinIOOUPUTorEXTENDmode9DELETEorREWRITEfilewhichisnotopened
inIOmode.9Implementationdefined1VSAMpassworderror2Logicerror3VSAMresourceunavailable6NoDDstatementspecifiedforVSAM
file.7FileintegrityverifiedforVSAMfile.COBOLCOMPILATIONSYSPRINTPARM(Compilerlisting)(Compiler
32. 32.MainframeRefresherPart1COBOLPage:32Options)SYSINIGYCRCTLSYSLIN(ObjectModule)(Source)(COBOLCOMPILER)SYSLIB
PARM(CopybookLibrary)(LinkeditOptions)IEWL(LinkEditor)SYSLMOD(LoadModule)SYSPRINTSYSLIB(Linkeditmessages)(Subroutine
Library)COMPILATIONJCL://SMSXL86BJOB,COMPILATIONJCL,MSGCLASS=Q,MSGLEVEL=(1,1),CLASS=C//COMPILE1EXEC
PGM=IGYCRCTL,PARM=XREF,APO,ADV,MAP,LIST),REGION=0M//STEPLIBDDDSN=SYS1.COB2LIB,DISP=SHR//SYSINDD
DSN=SMSXL86.TEST.COBOL(SAMPGM01),DISP=SHR//SYSLIBDDDSN=SMSXL86.COPYLIB,DISP=SHR//SYSPRINTDD
SYSOUT=*//SYSLINDDDSN=&&LOADSET,DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200),//DISP=(NEW,PASS),UNIT=SYSDA,SPACE=
(CYL,(5,10),RLSE),//SYSUT1DDUNIT=&SYSDA,SPACE=(CYL,(1,10))=>CodeSYSUT2toUT7//LINKEDT1EXECPGM=IEWL,COND=
(4,LT)//SYSLINDDDSN=&&LOADSET,DISP=(OLD,DELETE)//SYSLMODDDDSN=&&GOSET(SAMPGM01),DISP=
(NEW,PASS),UNIT=SYSDA//SPACE=(CYL,1,1,1))//SYSLIBDDDSN=SMSXL86.LOADLIB,DISP=SHR//SYSUT1DDUNIT=SYSDA,SPACE=
(CYL,(1,10))//SYSPRINTDDSYSOUT=*//***EXECUTETHEPROGRAM***//EXECUTE1EXECPGM=*.LINKEDT1.SYSLMOD,COND=
(4,LT),REGION=0M//STEPLIBDDDSN=SMSXL86.LOADLIB,DISP=SHR//DDDSN=SYS1.SCEERUN,DISP=SHR//SYSOUTDD
SYSOUT=*//SYSPRINTDDSYSOUT=*CompilerOptionsThedefaultoptionsthatweresetupwhenyourcompilerwasinstalledareineffectforyour
programunlessyouoverridethemwithotheroptions.Tocheckthedefaultcompileroptionsofyourinstallation,doacompileandcheckin
thecompilationlisting.
33. 33.MainframeRefresherPart1COBOLPage:33Waysofoverridingthedefaultoptions1.CompileroptionscanbepassedtoCOBOLCompiler
Program(IGYCRCTL)throughthePARMinJCL.2.PROCESSorCBLstatementwithcompileroptions,canbeplacedbeforetheidentification
division.3.Iftheorganizationusesanythirdpartyproductoritsownutilitythentheseoptionscanbecodedinthepredefinedlineoftheutility
panel.PrecedenceofCompilerOptions1.(Highestprecedence).Installationdefaults,fixedbytheinstallation.2.OptionscodedonPROCESS/CBL
statement3.OptionscodedonJCLPARMparameters4.(LowestPrecedence).Installationdefaults,butnotfixed.Thecompletelistofcompileroption
isinthetable:AspectCompilerOptionSourceLanguageAPOST,CMPR2,CURRENCY,DBCS,LIB,NUMBER,QUOTE,SEQUENCE,WORDDate
ProcessingDATEPROC,INTDATE,YEARWINDOWMapsandListingLANGUAGE,LINECOUNT,LIST,MAP,OFFSET,SOURCE,SPACE,
TERMINAL,VBREF,XREFObjectDeckCOMPILE,DECK,NAME,OBJECT,PGMNAMEgenerationObjectCodeADV,AWO,DLL,
EXPORTALL,FASTSRT,OPTIMIZE,NUMPROC,ControlOUTDD,TRUNC,ZWBDebuggingDUMP,FLAG,FLAGMIG,FLAGSTD,SSRANGE,
TYPECHKOtherADATA,ANALYZE,EXIT,IDLGENADV:Itismeaningfulifyourprogramhasanyprinterfileswith
WRITE..ADVANCINGkeyword.ThecompileraddsonebyteprefixtotheoriginalLRECLofprinterfilesforprintingcontrolpurpose.Ifyouare
manuallypopulatingprintingcontrolcharacterintheprogram,thenyoucancompileyourprogramwithNOADV.DYNAM:UseDYNAMtocause
separatelycompiledprogramsinvokedthroughtheCALLliteralstatementtobeloadeddynamicallyatruntime.DYNAMcausesdynamicloads(for
CALL)anddeletes(forCANCEL)ofseparatelycompiledprogramsatobjecttime.AnyCALLidentifierstatementsthatcannotberesolvedinyour
programarealsotreatedasdynamiccalls.WhenyouspecifyDYNAM,RESIDENTisalsoputintoeffect.LIST/OFFSET:LISTandOFFSETare
mutuallyexclusive.Ifyouuseboth,LISTwillbeignored.LISTisusedtoproducelistingalistingoftheassemblerlanguageexpansionofyourcode.
OFFSETisusedtoproduceacondensedProcedureDivisionlisting.WithOFFSET,theprocedureportionofthelistingwillcontainline
numbers,statementreferences,andthelocationofthefirstinstructiongeneratedforeach
34. 34.MainframeRefresherPart1COBOLPage:34statement.TheseoptionsareusefulforsolvingsystemABENDS.ReferJCLsessionformore
details.MAP:UseMAPtoproducealistingoftheitemsyoudefinedintheDataDivision.SSRANGE:IftheprogramiscompiledwithSSRANGE
option,thenanyattempttoreferanareaoutsidetheregionofthetablewillabnormallyterminatewithprotectionexception,usuallyS0C4.Italsoavoids
anymeaninglessoperationonreferencemodificationlikenegativenumberinthestartingpositionofreferencemodificationexpression.Iftheprogramis
compiledwithNOSSRANGE,thentheprogrammayproceedfurtherwithjunkorirrelevantdata.SousuallytheprogramsarecompiledwithSSRANGE
duringdevelopmentandtesting.RENT:AprogramcompiledasRENTisgeneratedasareentrantobjectmodule.CICSprogramsshouldbecompiled
withRENToptiontosharethesamecopyoftheprogrambymultipletransactions(Multithreading)RESIDENT:UsetheRESIDENToptiontorequest
theCOBOLLibraryManagementFeature.(TheCOBOLLibraryManagementFeaturecausesmostCOBOLlibraryroutinestobelocateddynamicallyat
runtime,insteadofbeinglinkeditedwiththeCOBOLprogram.).CICSProgramsshouldbecompiledwithRESIENToption.XREF:UseXREFtogeta
sortedcrossreferencelisting.EBCDICdatanamesandprocedurenameswillbelistedinalphanumericorder.Italsoincludeslisting,whereallthedata
namesthatarereferencedwithinyourprogramandthelinenumberwheretheyaredefined.Thisisusefulforidentifyingthefieldsthataredefined
butnotusedanywhereafterthedevelopmentofnewprogram.TSOCommandsfromCOBOLprogramCBL

http://www.slideshare.net/vishwas17/mainframerefresherpart1 48/53
1/23/2016 Mainframerefresherpart1
APOST,NODECK,OBJECT,BUF(10000),DYNAM=>Compileroptionoverride
*******************************************************************FUNCTION=Thissampleprogramdemonstrateshowtoinvoke*
*TSOcommandsfromaCOBOLprogramusing**standardTSOservicesasdocumentedinthe*
35. 35.MainframeRefresherPart1COBOLPage:35*TSO/EProgrammingServicesmanual.*
******************************************************************IdentificationDivision.ProgramID.SMSTSOEV.DataDivision.
WorkingStorageSection.01Filler.05wsdummyPics9(8)Comp.05wsreturncodePics9(8)Comp.05wsreasoncodePics9(8)Comp.05wsinfo
codePics9(8)Comp.05wscppladdressPics9(8)Comp.05wsflagsPicX(4)ValueX00010001.05wsbufferPicX(256).05wslengthPics9(8)
CompValue256.ProcedureDivision.***CallIKJTSOEVtocreatetheTSO/Eenvironment**
*CALLIKJTSOEVUsingwsdummy,wsreturncode,wsreasoncode,wsinfocode,wscppl
address.IFwsreturncode>zeroDISPLAYIKJTSOEVFailed,Returncode=wsreturncodeReasoncode=wsreasoncodeInfocode=wsinfocode
MOVEwsreturncodetoReturncodeSTOPRUN.***BuildtheTSO/Ecommandinwsbuffer
***MOVEALLOCATEDD(SYSPUNCH)SYSOUTHOLDtowsbuffer.*
**CalltheTSO/EServiceRoutinetoexecutetheTSO/Ecommand**
*CALLIKJEFTSRUsingwsflags,wsbuffer,wslengthwsreturncode,wsreasoncode,wsdummy.IFwsreturncode>zeroDISPLAY
IKJEFTSRFailed,Returncode=wsreturncodeReasoncode=wsreasoncodeMOVEwsreturncodetoReturncodeSTOPRUN.*
**CheckthattheALLOCATEcommandworked***
DISPLAYALLOCATEWorked!UponSyspunch.STOPRUN.InterviewQuestions(IQ):*Saysimportanceandpossibilityofthequestioninan
interview.1.DifferencebetweenNextSentenceandContinue***
36. 36.MainframeRefresherPart1COBOLPage:362.Comp,Comp1,Comp2andComp3differenceandhowmanybytesoccupiedbyeach.Should
knowhowtoreadCOMP3data.*****3.IdentifyingandmakingStaticandDynamiccall*****4.BinaryandSequentialsearchandwhenyouprefer
what?*****5.WhatarethevariouswaysofpassingdatafromJCLtoProgramandhowtoreceivetheminProgram?*****6.Differencebetween
COBOL74(OS/VSCOBOL)andCOBOL85(VSCOBOL2)****7.SubscriptandIndexdifferenceandwhenyoupreferwhat?****8.Reference
modification.****9.CompilerandLinkeditoptionSSRANGEMAPLISTOFFSETRENTRESIDENTDYNAMandAMODE/RMODE***10.How
tomakeacallbycontentinCOBOL?***11.Howdoyousetreturncodefromtheprogram?***12.Casestructure,Substring,Dowhile,DoUntil,BLL
equivalentinCOBOL***13.Differencebetweensectionandparagraph*****14.Canoccursbecodedin01level?*****15.Aremultiple01levels
supportedinfilesection?**16.Variouswaysofoverridingdefaultcompileroptions**17.Sortalgorithms**18.Howtogettheactuallengthof
alphanumericitem?**19.WhatisUTSmeanswithrespecttoSELECTstatement?*20.CanIrewriteasequentialfileinTAPE?*21.COMP3itemsare
alwaysbetterthanCOMPintermsofmemory.Yes/No**22.WhichVSAMtypeisfastest?Relativekeyispartoffilesection?**23.Howtocreatea
reportinCOBOLprogram?***24.HowtosubmitaJCLfromCOBOLprogram?****25.WhatisSYNCClause?**26.WhatisinlinePERFORMand
whenwillyouuseit?****27.WhatisINSPECTstatement?***28.TouseSEARCHALL,thetableshouldbeinsortedorder.Iamloadingthe
tablefromoneofthePDSmembers.ThePDSmemberdataisnotinsortedorder.HowwillIloadthetableinSORTEDorder?Youshouldnotsortin
JCL.**29.WhatisthepurposeofUSEstatement?*30.WhatareSAMEAREAandSAMERECORDAREA?*31.Isdynamicallocationpossiblein
COBOL?Ifyes,How?*32.WhatisthedifferencebetweenONSIZEERRORandONOVERFLOW?*33.Howtoswaptwovariableswithoutthird
variable?*34.Whatislimitoflinkagesection?*Answersforselectedquestions:
37. 37.MainframeRefresherPart1COBOLPage:37Whatisthelimitofworkingstorageandlinkagesectionlimit?(IQ34)WorkingstorageandLinkage
sectionlimitofCOBOL85is128MB(COBOL741MB)77,0149levelitemlimitinCOBOL85is16MB(COBOL741MB)Howtoswapthevaluesof
twovariableswithoutanintermediatevariable?(IQ33)LetthevariablesbeAandBWay1:COMPUTEA=A+BWay2:COMPUTEA=A*B
COMPUTEB=ABCOMPUTEB=A/BCOMPUTEA=ABCOMPUTEA=A/BIhaveretrievedavaluefromDB2VARCHARcolumn.(Ex:WS
VAR=muthu$sara$$is1nspaces.)HowtogetthelengthoftheWSVARinCOBOLprogram?Ishouldnotcountrighthandspaces.(IQ20)
LENGTHfunctioncountsspacealsoasacharacter.Sowecannotusethatfunctionforourpurpose.INSPECTisalsonotusefulasthestringmay
contain1nspacesinbetweenandthatneedstobecounted.SothelogicwouldbeReadfromrightuntilyoureadfirstnoonspacecharacter.
PERFORMVARYINGWSSUBNAMEFROMLENGTHOFWSVARBY1UNTILENDFOUNDORWSSUBNAME=0IFWSNAME
CHK(WSSUBNAME:1)NOTEQUALTOSPACEMOVEYTOWSENDOFFIELDDISPLAYLENGTHWSSUBNAMEENDIFEND
PERFORMHowtopassuserreturncodeanduserABENDfromtheCOBOLprogramtotheJCL?RETURNCODEisaspecialregisteranditscontent
ismovedtoregister15whenthecontrolisgivenbacktoOS.Somovethereturncodetothisregisterintheprogram.Ex:MOVE1000toRETURN
CODE.Thissetsreturncodeas1000forthestepthatexecutesthisprogram.ForABEND,youshouldcallyourinstallationspecificassemblerroutineor
ILBOABN0withtheABENDcodeyouwant.CALLILBOABN0USINGWSABCODE.WSABENDCODEisthevariablethathasABEND
CODE.Itisahalfwordbinary.WhatshouldbetheLRECLofprinterfiles?Use133characterrecordsinyourprogramandsettheprintcontrol
characteryourself.InthiscaseyourJCLwouldhaveRECFM=FB,LRECL=133Use132characterrecordsintheprogramandhaveWRITE
....ADVANCINGputintheprintcontrol.YouneedthecompileroptionADVforthisandtheJCLwouldhaveRECFM=FBA,LRECL=133.........What
arethesortalgorithms?(IQ17and28)
38. 38.MainframeRefresherPart1COBOLPage:38BubbleSort:Consecutiveelementsarecomparedandkeysoftwoelementsarenotinproperorder,
theyareswapped.Inthefirstpass,thekeywithlargestvaluewillbemovedtothelastpositionandn1passesneededtosortthewholetable.Inbetween,
ifanypassresultsnointerchangeitimpliesthatthetableisinsortedorder.Array:1209508FirstPass:(Maximum4comparisonsfor5elements)1,20
>nochange,20&9>20isgreatsoswap(192050),20&50>nochange,50&8>50isgreat,soswap.(1920850)SecondPass:(1920850)
(Maximum3comparisonfor5elements)1&9>nochange,9&20>nochange,20&8>20isgreatsoswap(1982050)ThirdPass:(1982050)
(Maximum2comparisonsfor5elements)1&9>nochange,9&8>change(1892050)FourthPass:(1892050)(Maximum1comparisonfor
5elements)1&9>nochangeNote:Youcancomeoutofsortwhenyoufindnochangeinallthecomparisonsofapass.ShuttleSort:Inthefirstpass
onlyfirsttwoelementsarecomparedandsortedandinthesecondpass,thirdelementiscomparedwithtwoandoneanditisplacedintherightposition.
Intheithpass,itassumesthatIelementsareinalreadysortedorder,proceedstosortthefirst(I+1)elementsbycomparingI+1thelementwithI,and
IwithI1andsoonuntiltopofthetableisreachedornoexchangeinacomparison.Array:1209508FirstPass:Twoelements(120)Maximum1
comparison1,20>nochangeSecondPass:Threeelements(1209)Maximum2comparisons9&20>change(1920)9&1>nochangeThird
Pass:Fourelements(192050)Maximum3comparisons50&20>nochangeandstop(noneedforanyothercomparison)FourthPass:Five
elements(1920508)Maximum4comparisons8&50>change(1920850),8&20>Change(1982050)8&9>Change(1892050),8
&1>nochangeandstop.Note:YoucancomeoutofpassifyoufindonenochangeShuttlesortisbetterthanbubblesortforsortingarrayswith
morethan10elements.COMP3itemsarealwaysbetterthanCOMPwithrespecttomemoryusage(IQ21)?No.COMPitemsoccupylessspacethan
COMP3itemsatboundaries.PICS9(04)COMPoccupies2byteswhereasPICS9(04)COMP3occupies3bytes.PICS9(09)COMPoccupies4bytes
whereasPICS9(09)COMP3occupies5bytes.PICS9(18)COMPoccupies8byteswhereasPICS9(18)COMP3occupies10bytes.IhaveaKSDS
Studentsfilewith4byteskey.Firsttwobytescontainclassnumberandnexttwobytescontainstudentnumber.Iwanttoreadallthestudentsin
class02.Howwillyoudothat?
39. 39.MainframeRefresherPart1COBOLPage:39Allocatethefilewithdynamicaccessmode.Move02tofirsttwobytesofthekeyandlowvalues
tonexttwobytesofthekey.Youcandothesemovesbyreferencemodificationoperatorordegroupingthefourbytefieldintotwotwobytefieldsin
thefilesection.IssuetheSTARTcommandwithKEYISGREATERTHANclause.Startreadingthefileinloopuntilfirsttwobytesisnotequalto2.

Recommended

http://www.slideshare.net/vishwas17/mainframerefresherpart1 49/53
1/23/2016 Mainframerefresherpart1

LeadershipFundamentals

ManagingTeams

CoachingandDevelopingEmployees

MainframeRefresher
NirmalPati

JCLUTILITIESINMAINFRAMENOTE
NirmalPati

Mainframeinterview
ShivankooSharma

100COOLMAINFRAMETIPS
NirmalPati

Top9mainframetestinginterviewquestionsanswers
jonhmart036

MainframeArchitecture&ProductOverview

http://www.slideshare.net/vishwas17/mainframerefresherpart1 50/53
1/23/2016 Mainframerefresherpart1
abhi1112

Mainframeconcepts
IBMIndiaSmarterComputing

ENGLISH
English
Franais
Espaol
Portugus(Brasil)
Deutsch

English
Espanol
Portugues
Franais
Deutsche

About
Dev&API
Blog
Terms
Privacy
Copyright
Support

LinkedInCorporation2016

ShareClipboard

Email

Enteremailaddresses
Addamessage
From
Send
Emailsentsuccessfully..

Facebook
Twitter
LinkedIn
Google+

Link

Publicclipboardsfeaturingthisslide

http://www.slideshare.net/vishwas17/mainframerefresherpart1 51/53
1/23/2016 Mainframerefresherpart1

Nopublicclipboardsfoundforthisslide

SavethemostimportantslideswithClipping
Clippingisahandywaytocollectandorganizethemostimportantslidesfromapresentation.You
cankeepyourgreatfindsinclipboardsorganizedaroundtopics.

Startclipping
Nothanks.Continuetodownload.

Selectanotherclipboard

Lookslikeyou'veclippedthisslidetoalready.

Searchforaclipboard

Createaclipboard

Youjustclippedyourfirstslide!

Clippingisahandywaytocollectimportantslidesyouwanttogobacktolater.Nowcustomizethenameofaclipboardtostoreyourclips.

Name* BestofSlides
Description AddabriefdescriptionsoothersknowwhatyourClipboardisabout.
Visibility
Otherscanseemyclipboard
Cancel Save
Savethisdocument

http://www.slideshare.net/vishwas17/mainframerefresherpart1 52/53
1/23/2016 Mainframerefresherpart1

http://www.slideshare.net/vishwas17/mainframerefresherpart1 53/53

Anda mungkin juga menyukai