JustEnoughJCL.docx
《JustEnoughJCL.docx》由会员分享,可在线阅读,更多相关《JustEnoughJCL.docx(19页珍藏版)》请在冰豆网上搜索。
JustEnoughJCL
JustEnoughJCL
tobedangerous
ByGabeGargiulo
Aug1998
ThepurposeofthisbookletistogetyoustartedwithJCLwhenthereisnootherway-youdon’nothavetimetogotoaclass,don’notwanttobuyacompletebookonitandtrytofindthethingsyouneedtoknow.
Thisisnowherenearbeingcomplete.(Anditsnotfinishedyet)Itjustgetsyougoing.Forthecompletestory,contactmeaboutcoursesin.JCL(andCOBOL,SQL,REXX,TSO/ISPF).
Fromcommercialuseorresaleofthisdocumentisaviolationofcopyrightlaws.
----------------------------------------------TableofContents----------------------------------------------
JCLExample2
SampleJCLDDStatements6
JustExamples10
JCLExample
ThisisanexampleofaJCLjob.
Thesmallnumbersarenotesthatwillbeexplainedlater.
ThissetofJCLwillexecutetheprogramSAMPLE1,whichisshownbelow.
TheJCLtellsthesystemwhatfilesaretobeusedbytheprogram.
Thesystemwillverifythatthefilesareavailablebeforeallowingtheprogramtorun.
TherearethreemajorpartstothissetofJCL.
JOBinformation,thefirsttwolines
programexecutioninformation,line4
informationaboutthedatafiles,line5totheend.
Inalltheexamples,TSOUSR1isanimaginaryTSOuserid,alogonid,anaccount.
Replaceitwithyourownuserid.
AnythingshowninboldprintisrequiredbyJCLsyntax:
it抯akeyword.
Anythinginregularprintisauser-chosenname:
youcouldhavechosenadifferentname.
2345
11//TSOUSR1AJOB(12345),扟OEDOKES’,
678
2//MSGCLASS=X,CLASS=A,NOTIFY=TSOUSR1
9
3//*SAMPLEJOB
101112
4//STEP1EXECPGM=SAMPLE1
1314
5//STEPLIBDDDSN=TSOUSR1.LOAD,DISP=SHR
151617
6//INFILEDDDSN=TSOUSR1.DATA(MEMBER),DISP=SHR
1819
7//OUTFILEDDSYSOUT=*
20
8//SYSOUTDDSYSOUT=*
1ThetwoslashesindicatethatalineisJCL
theyarefoundincolumns1and2
2Atypicaljobusedfortestingprogramsisnamedafterthe
useridofthepersonwhoissubmittingit.
Aletterornumberisaddedtotheendoftheuserid.
3ThewordJOBinthispositionindicatesthatthislineisthe
JOBstatementwhichdefinesthejobbeingsubmitted.
4Youputaccountinginformationinthisposition,
intheparentheses.Thisisdifferentforeverycompany.
5Youputyournameinsidetheapostrophes.
Thisappearsonthejobprintandidentifieswhosubmittedit.
6Messageclassspecifiesaprintclassforthejob.
Aprintclassreferstoaspecificprinter,atypeofprinter,
oraprinterinaspecificlocation.
Findoutwhatyouaresupposedtousehere
andsubstituteitform.
7Classtellsthesystemhowimportantyourjobis.
Findoutthepropertestingjobclasstousehere,
andsubstituteitforc.
8Notifyasksthesystemtosendamessagetothe
TSOuseridspecifiedwhenthejobends,
tellingifthejobendedwithnoapparentproblems,
orhadseriousproblems.
9Thiswholelineisacomment.Itdoesnothing.
Thesignofacommentis//*incolumns1-3.
10ThislinetellsthesystemtoexecutetheprogramnamedSAMPLE1.
STEP1isadescriptivenamethatyouchoose.
Thesystemusesitinmessagesaboutyourjob;
youuseitwhencreatingoverridesforprocedureJCL.(notcoveredhere)
11EXECPGM=saysthatthisisaprogramthatthesystemistoexecute.
12Thisisthenameoftheprogram.
13STEPLIBtellsthesystemthattheexecutableprogramisfoundonthis
library.Findoutifyourcompanyrequiresthis.
14DSNsaysthatthisisthenameofthedataset.Dataset
isIBM抯termforafile,orforalibrary(afilecontaining
smallerfilesknownasmembers)
15INFILEisthenameusedintheprogramtorefertothefile.
(seenote3intheprogram)
Itsonlypurposeistoenablethesystemtofindthe
correctJCLstatementwhichfurtherdescribesthefile.
16ThisDSN(DataSetName)referstoamemberinalibrary.
Thenameinparenthesesisthemembernameyouwishtouseinthelibraryspecified
17DISP=SHRmeansthatthedatasetspecifiedalreadyexists,
andthatthesystemistogosearchforit,andthatyoudon’notmindif
otherjobsareusingitatthesametimeasyou.
18OUTFILEisthenameusedintheprogramtorefertothefile.
19SYSOUTheremeanssystemoutput,agenerictermwhichreally
meansprinterclass.SeethenoteabouttheJOBMSGCLASS.
20SYSOUTherereferstothefilethatisautomatically
createdbytheCOBOLcompilerwhenyouusetheCOBOL
verbDISPLAY.Seenote8intheprogram.
Createdby.Youmaycopythisdocumentprovidedthisnoticeisattached.
ThisistheCOBOLprogramthatmightbeusedwiththeaboveJCL.
Thesmallnumbersarenotesthatwillbeexplainedlater.
ThisisnotabookonCOBOL.ForbetterexplanationsofCOBOLseethe
bookonCOBOL.
IDENTIFICATIONDIVISION.
PROGRAM-ID.'SAMPLE1'1
ENVIRONMENTDIVISION.
INPUT-OUTPUTSECTION.
FILE-CONTROL.
2
SELECTIN-FILEASSIGNINFILE.3
4
SELECTOUT-FILEASSIGNOUTFILE.5
DATADIVISION.
FILESECTION.
FDIN-FILE6
RECORDCONTAINS80CHARACTERS
RECORDINGMODEF.
01IN-FILE-RECORDPICX(80).
FDOUT-FILE7
RECORDCONTAINS96CHARACTERS
RECORDINGMODEF.
01OUT-FILE-RECORDPICX(96).
WORKING-STORAGESECTION.
77EOF-FLAGPICX(3)VALUESPACE.
PROCEDUREDIVISION.
DISPLAY'IAMTHESAMPLE1PROGRAMSTARTING'8
OPENINPUTIN-FILE9
OPENOUTPUTOUT-FILE10
READIN-FILE
ATEND
DISPLAY'EMPTYFILE'
MOVE'EOF'TOEOF-FLAG
END-READ
MOVEIN-FILE-RECORDTOOUT-FILE-RECORD
WRITEOUT-FILE-RECORD
MOVE'HELLOTHERE'TOOUT-FILE-RECORD
WRITEOUT-FILE-RECORD
CLOSEIN-FILEOUT-FILE
DISPLAY'IAMTHESAMPLE1PROGRAMENDING'
GOBACK.
1Thisistheprogramname.Withmanycompileproceduresthisname
isthenamethatisusedintheJCL
2ThenameIN-FILEisauser-chosennameforoneofthefiles
usedbythisprogram.Thisnameisusedeverywhereelsein
theprogramtotalkaboutthefile.
3ThenameINFILEistheJCLnameforthefile,officiallycalled
theDDNAME.Itisfoundonlyonceintheprogram.Itsonlypurpose
istolinktheprogram抯filedefinitiontotheJCL抯filedefinition
knownastheDDstatement.
ThesystemwilluseinformationfromboththeprogramandtheJCL
tofullydefinethefile.Informationfoundintheprogram
willoverrideinformationfoundintheJCL.
Bydefault,thissaysthatthefileisnotaVSAMfile,
butthatitisanordinarysequentialfileoramemberofaPDS/Library.
4OUT-FILE.SeeIN-FILE.
5OUTFILE.SeeINFILE.
6ThisistheFDorfiledescriptionforIN-FILE.Itcontainsthefollowing
information
Recordlengthobtainedfromthepicturesontherecord
Recordformatwhetherthefile
isF-Fixedformat,allrecordsarethesamelength
orV-Variableformat,recordsmaybeofdifferentlengths.
Itdoesnotsayanythingaboutblocking.
Thesystemhandlesblocking.
7OUT-FILE.SeeIN-FILE.
8TheCOBOLDISPLAYverbcreatesafilewithaJCLDDNAMEofSYSOUT.
Thereisnoneedtofurtherdefinethisfileintheprogram.
9OpeningIN-FILEforINPUT,reading,meansthatthefilemustbepresent.
TheJCLDDstatementforINFILEmustreferenceafilethatexists.
10OpeningOUT-FILEforOUTPUT,writing,meansthatthefileisnot
normallypresent,thattheJCLDDstatementforOUTFILE
willspecifyafilethatistobecreated.
IftheJCLDDspecifiesafilethatexists,itwillbeclobbered.
SampleJCLDDStatements
You抣lfindhereexamplesofJCLDDstatementscoveringmostofthepossibilities.Anystatementnotshownisrareindeed.UsethestatementsforexistingdatawithfileswhichareopenedforINPUTintheprogram.UsethestatementsforcreatingdatawithfilesthatareopenedforOUTPUT.Yourcompany抯requirementsmaybedifferentfromthegenericstatementsshown.
Iwillshowyouthosethatarepractical.I抳eeliminatedtheonesthatareunrealistic.
Thisisonepossiblehierarchicalbreakdownofthedifferenttypesoffiles.
Disk
permanent,catalogued
sequential(generic)nongenerationdataset
generationdataset
aPDSmember:
actslikesequential
VSAm
temporary
sequential(generic)
Tape
permanent,catalogued
sequential(generic)nongenerationdataset
generationdataset
Somedefinitions.
PermanentNotdeleteduntilyourequestit,orforgenerationdatasets,whenadataset
exceedsthelimitandisdeletedbythesystem.
TemporaryAutomaticallydeletedbythesystembeforethejobends.
CataloguedEverythingexcepttemporaryiscatalogued.Itsnameisplacedinthe
systemcatalog,likeadirectory,tomakeiteasytofinditlater.
SequentialNotVSAM.Recordsaccessedsequentially,frombeginningofthefileonward.
Norandomaccess.Noreadingbackwards.
GenerationTypeofsequentialwherethesystemassignanewnameeachtime
youcreateanewfile.
PDSmemberAsubsetofaPDS(PartitionedDataSet)orlibrary.AfilewithinaPDSorlibrary.
PDSAfilecontainingsmallerfilesknownasmembers.
VSAMAfiletypethatisbeyondthescopeofthisbook.
SampleDDStatementsforExistingdata
In-streamdata
//ddnameDD*
datagoeshere
/*
Example:
//INFILEDD*
Maria
Christine
/*
Permanentdisk,sequentialnon-gdg,non-pdsmember.PreviouslyCatalogued.
//ddnameDDDSN=dataset-name,DISP=SHR
Example:
//INFILEDDDSN=MY.DATASET.DATA,DISP=SHR
Tape.PreviouslyCatalogued.
//ddnameDDDSN=dataset-name,DISP=OLD
Example:
//INFILEDDDSN=MY.DATASET.DATA,DISP=OLD
Permanentdisk,sequentialgdg.PreviouslyCatalogued.
//ddnameDDDSN=dataset-nam