INTRODUCTION TO JOB CONTROL LANGUAGE

来源:百度文库 编辑:神马文学网 时间:2024/05/01 20:53:59
University of Toledo -- Computer ServicesINTRODUCTION TO JOB CONTROL LANGUAGE (JCL)A. Documentation Sources include:1. IBM Manuals available at the Computer Services consultingdesks, including:a. IBM‘s OS/VS1 JCL Servicesb. IBM‘s OS/VS1 JCL Referencec. IBM‘s OS/VS Message Library: VS1 System Codesd. IBM‘s OS/VS Message Library: VS1 System Messages2. The HELP System within CMS:a. help datasets - how to create disk files to use inbatchb. help intro jclerror - debugging JCL error messagesc. help xedit jclget - build skeleton JCL filesd. help jobcard - how to construct a valid "JOB" statemente. help jobclass - defines JOB classes and their run order3. The following PHOENIX on-line courses (contact a full-timeconsultant for registration):a. JCLUSE - Basic JCL for end users and entry level dataprocessors.b. PGMJCL - JCL for programmers.c. VSJCL - Coding OS/VS JCL (written by IBM).d. See Help COURSES for a complete list of all availablecourses and their descriptions.B. What is JCL?1. JCL is used to define a task or job for the computer,including: where your program and data are located and howthey are stored; what compilers, packages, or programs youplan to use (i.e., FORTRAN, SPSSX); where to send theoutput or how to display it; what types and amounts ofresources you‘ll use, including time, disk, tape, and linesof print.2. JCL was invented by IBM and has been around a long time.While there may be minor variations among installations(like UT‘s JOB statement), basically the types and uses ofthe statements are the same.C. General Format+-------------------------------------------------------------+| || //name operation parameter1,parameter2,...... || |+-------------------------------------------------------------+1. All JCL must be entered in upper case.2. All JCL statements have // in columns 1 and 2.3. Positions 3-71 contain JCL information.4. There are three fields to each JCL statement (name,operation, parameters). Fields are separated from oneanother by blanks.5. The name field identifies the statement so that otherstatements can refer to it. Valid characters include:letters, numbers, and the special characters @, #, and $.The name must start with a letter or special character andalways starts in column 3 (right after the //).6. Operation refers to the type of JCL statement. Thefollowing statements are discussed in this outline:a. JOB - defines the beginning of a job; providesaccounting information and resource needs (i.e., time,tape drives)b. EXEC - specifies the procedure, compiler, package, orprogramc. DD - specifies the names and locations of input,output, and temporary files7. Individual parameters are separated by commas; do NOT placeblanks between parameters. If you do, everything after thespace is treated as a comment.8. If your JCL statement is too long for one line or you wantto place parameters on separate lines, break the statementafter a complete parameter (including the comma) at orbefore column 71. Enter // in columns 1 and 2 of the nextline, followed by 1 to 13 blanks, and then continue thestatement.9. Three special JCL statements:a. A /* in columns 1 and 2 indicates end-of-data; this iscalled a delimiter statement.b. A //* in columns 1 thru 3 indicates a comment card;this allows you to document your JCL files.c. A // in columns 1 and 2 indicates end-of-job; this iscalled a null statement. This statement should alwaysbe the last line of your JCL files. Otherwise, yourjob may be concatenated to the previous job -- andneither will run.D. The JOB Statement1. Defines the beginning of the JOB.2. Provides accounting information and an estimate of the timeit will take to run your JOB.3. May describe how many (and what) messages to print (andwhere to print them), and the number of tape drives youwill need to use.4. The basic format of the UT JOB card is://JOBThe following optional parameters may be added:TIME=minutes is an estimate of the CPU time (in minutes)needed for your JOB; the default (if no time is specified)is 10 secondsROUTE=aaaaaaaaaa is where you want the output sent;can be the name of a printer (i.e., XSTRAN, XENGR), yourreader (the default), or VAX/VMS account).REGION=xxxx is the amount of memory you need for yourjob; default is 4 meg.See Help JOBCARD for complete details.5. JOB card examples://JOB//JOB TIME=5//JOB ROUTE=XSTRAN,TIME=1//JOB ROUTE=UOFT02.STX9999,TIME=10E. The EXEC statement1. Indicates the compiler, program, package, or catalogedprocedure which should be called. There can be severalEXEC statements in a JOB stream. Each EXEC statement marksthe beginning of a new JOB step.2. Formats://stepname EXEC procedure-name//stepname EXEC procedure-name,parameters//stepname EXEC PGM=program-name//stepname EXEC PGM=program-name,parameters3. The stepname is optional; it allows you to refer toprevious steps in the JOB (for error checking, passing ofdata sets, etc.). It is a name you assign to the JOB step.4. Procedure-name is the name of a cataloged procedure. Torun a JOB, you usually need to supply several JCLstatements that not only name the program or package, butalso the input, output, and temporary files needed. Mostof the time, these files are exactly the same for everyonerunning the same program. A cataloged procedureautomatically generates these "typical" JCL statements andinserts them into your JOB stream. All languages and mostpackages here at UT have cataloged procedures available.5. PGM=program-name is the name of a program stored in asystem or private program library (for example, theACADEMIC LIBRARY). The library name may need to bespecified in either a JOBLIB or STEPLIB statement.6. PARM=‘x‘ are the values or codes used by the program duringprocessing (this varies with each program); these aresometimes called options.7. TIME=(minutes,seconds) is the maximum amount of time forthe job step; the default is the time from the second JOBcard minus the time used in previous steps (if any), up to30 minutes.8. Examples://SPSS EXEC SPSSX//STEP1 EXEC FORTVCLG,PARM=‘NOSOURCE,NOSRCFLG‘//STEP1 EXEC PGM=IEBGENERF. The DD statement1. The DD statement (Data Definition) describes input andoutput files and data sets. Only the most commonly usedparameters are discussed below.2. Format://ddname DD parameters3. The DDNAME is required. This name will be referred to in acomplete or abbreviated form by the program or package youare running.4. Instream input can be indicated in two ways:a. An * indicates that the program or data immediatelyfollows this statement.b. DATA,DLM=xx indicates that the data follows and thatthe data contains // or /* in columns 1 and 2. Theseusually mean end-of-job and end-of-input. When you usethis form of DD statement, the system looks for thecharacters xx in columns 1 and 2 to indicate end-of-jobor end-of-data. xx can be any set of alphabeticcharacters which do not occur in columns 1 and 2 ofyour data.c.Examples: //SYSIN DD *//INPUT DD DATA,DLM=XX5. Printed and Punched Outputa. SYSOUT=x where x can be:A line printerB card punch* user‘s virtual readerN TN (upper/lower case) print trainP Zeta Plotter (12 inch paper)S Zeta Plotter (36 inch paper)b. COPIES=nnn where nnn is the number of output copies youwant printed. The default is 1. Please note: if youwant more than 3 copies of output printed, specialarrangements must be made through Production Control;otherwise, your output will be purged from the system.Also, all output specifying multiple copies MUST beprinted on the IOROOM printer.c. OUTLIM=nnnnnn where nnnnnn is the number of lines ofoutput you need to have printed. The default is 4000lines. Please note: if you need more than 10,000lines printed, special arrangements must be madethrough Production Control; otherwise, your output willbe purged from the system. Also, all output with morethan 5000 lines MUST be printed on the IOROOM printer.d. Examples://PRINTER DD SYSOUT=*,COPIES=2,OUTLIM=6000//MIXCASE DD SYSOUT=N//GO.FT09F001 DD SYSOUT=P6. Disk and Tape Data Setsa. DSN=name where the DSN (Data Set Name) is composed of aseries of words connected by periods. Each word is 1-8alphanumeric characters; the word must start with aletter. The maximum number of characters in the entirename, including the periods, is 44. For example:ATS.A123456.MYNAME.DATAFILEType Help DATASET for UT‘s naming convention; data setswhich do not conform to this convention will be deletedfrom the system. All permanent tape and disk data setsmust be registered with Lance Stoll. If they are notregistered, they will be purged from the system atmidnight of the day they were created.b. UNIT=type indicates the type of device. The followingare the most common:Disk a disk data set; this unit designation is usedwhen your data set must be put on a particular disk.Used in conjuction with VOL=SER=volume-name (seebelow).SYSDA a system disk data set; used with temporary datasets.TAPE tells the system a reel tape will be used.TAPE80 tells the system a cartridge tape will be used.Eventually all tape files will be on cartridge tape.c. The DISPosition specifies what to do with the data set:DISP=statusDISP=(status,disp)DISP=(status,disp,cond)where status indicates the status of the data set atthe beginning of the step, disp indicates what to dowith the data set at the end of the step, and condindicates what to do with the data set if the stepabends (or fails). The value that each may take isindicated in the table below:status:______NEW new data setOLD existing data set; will be read or replacedMOD existing data set; records to be added to endSHR existing disk data set; share with other usersdisp:____PASS pass it to the next job stepKEEP keep it when the step is doneCATLG catalog the data setUNCATLG uncatalog the data setDELETE delete it when the step is donecond:____KEEP keep it when the step is doneCATLG catalog the data setUNCATLG uncatalog the data setDELETE delete it when the step is doned. VOL=SER=name specifies the volume/serial of the disk ortape that the data set is stored on; this is notrequired for cataloged data sets.e. LABEL=(n,type) where n specifies the sequence of thefile on tape (i.e., 2 for the second file); type can beeither SL (for IBM Standard Label) or NL (for NoLabel). All tapes created at UT must be SL tapes.f. SPACE=(unit,(primary,secondary)) specifies how muchspace will be required for a new disk data set.unit is either BLKSIZE, TRK (track), or CYL (cylinder);primary is the number of units initially allocated;secondary is the allocation if the primary is filled.A track holds about 235 80-character records; acylinder, about 7150 records.g. DCB=(characteristics) specifies some of the physicalcharacteristics of the data set:RECFM=xx indicates the general format of the records;xx can have one of the following values: F (fixed-length records - all records are the same length), FB(fixed-length records stored in blocks), V (variable-length records - record length varies), VB (variable-length records stored in blocks).LRECL=nn indicates the logical record length (how longeach line is), in bytes or characters.BLKSIZE=nn indicates the block size, in bytes;blocksize must be a multiple of the LRECL - i.e., ntimes LRECL - for fixed-length records or a multiple ofthe LRECL + 4 - i.e., (n times LRECL) + 4 - forvariable-length records.h. Examples://SYSIN DD *//SYSPRINT DD SYSOUT=*//OUTPUT DD DSN=ATS.A123456.NAME.DESC,// DISP=(NEW,CATLG,DELETE),// UNIT=SYSDA,SPACE=(3000,(10,1)),// DCB=(LRECL=75,BLKSIZE=3000,RECFM=FB)7. DD Statements and Your Programa. In the program or system you‘re using, at some pointyou mention the name or number of a file. That name ornumber is the same as, or is an abbreviation for, theddname on the DD statement. For example, when thesystem goes to open a file called RESULT in a COBOLprogram, it associates that file with the DD statementthrough the SELECT statement and its ASSIGN clause:SELECT OUTPUT-FILE ASSIGN TO RESULTb. Sometimes the link between the file name in the programand the DD statement isn‘t quite so clear. Forexample, in a FORTRAN program you refer to a unitnumber:WRITE (6,*) I,JThe unit number in the example above is 6 and makes up_just part of the DDNAME FT06F001:_//FT06F001 DD SYSOUT=*In some systems, the relationship is even less explicitand it may take a little detective work to figure outwhat DDNAME a file name is referring to.8. Records and Blocksa. Data is stored on disk and tape as a series of records.For example, perhaps you are generating a data file.For each subject, you have 100 characters ofinformation (an ID, name, address, etc.). You wouldcreate a file or data set and each record in it wouldbe 100 characters long. In terms of JCL, you would saythat: the records were fixed-length, and the recordlength was 100 (LRECL=100).+--------+--------+--------+--------+--------+|record |record |record |record |record |+--------+--------+--------+--------+--------+b. Computers can process data a lot faster than they canread or write it. If a program reads or writes onerecord at a time, it slows down processing. In orderto make the reading and writing more efficient, youusually work with groups or blocks of records. Forexample, you could group the 100-character records intoblocks of 40 records each. Each block would be 4000characters (100 times 40) long. In your JCL, you wouldsay that the blocksize is 4000 (BLKSIZE=4000) andindicate that blocks are used in the record format(RECFM=FB). Putting it all together, the DCB paramaterwould be:DCB=(RECFM=FB,LRECL=100,BLKSIZE=4000)9. Changing DD Statements in Cataloged Proceduresa. You may want to change one or more DD statements in acataloged procedure that supplies all the JCL for theprogram you are running. For example, you get 4000lines of output printed automatically but know that youwill need more than that. So, after the EXECstatement, add the DD statement to be changed:// EXEC COBUCLG//GO.SYSOUT DD SYSOUT=*,OUTLIM=6000b. There are three secrets to successful alteration ofcataloged procedures:You must know the name of the DD statement, includingthe stepname.If you change more than one statement, the newstatements must be in exactly the same sequence as theyappear in the cataloged procedure.These changes must occur before you specify additionalDD statements that are not in the cataloged procedure.c. You can find out this information by looking at the JCLsection of a previous run. If the MSGLEVEL on thesecond JOB card was specified as 11, then the JCL fromthe cataloged procedure will be listed (they‘ll have XXrather than // in columns 1 and 2). You may alsocontact an Academic Computing consultant for thisinformation.d. Examples of the basic JCL needed to run the majorlanguages and packages can be found in the Help system.Type Help JCLHELP to find the name of the Help file fora particular language or package.e. The JCLGET XEDIT command builds JCL for commonly usedbatch programs - including valid JOB cards. Type HelpXEDIT JCLGET for details about usage and for a list ofall currently available instant JCL.G. Common Error MessagesCode Possible Problems or Causes____ ___________________________IEF210I DDNAME - UNIT FIELD SPECIFIES INCORRECT DEVICE NAMELook at the field following the UNIT=, and make surethat it is SYSDA, DISK, or TAPE.IEF212I DDNAME - DATA SET NOT FOUNDYou did not spell the DSN correctly.The data set may have been deleted.You did not include VOL=SER and UNIT= on the DDstatement.IEF612I PROCEDURE NOT FOUNDYou were trying to EXEC a program and forgot the PGM=.You may have misspelled the PROC name.IEF621I EXPECTED CONTINUATION NOT RECEIVEDA DD statement has been deleted.The DD statement had a comma after the last operand.The JCL statement has gone beyond column 71.A blank appears in the middle of a statement, probablyafter a comma.//SYSIN DD * GENERATED STATEMENTSome JCL statements are incorrect or out of order.JOB HAS NO STEPSThe JOB you are running has no EXEC statements.H. SYSTEM ABENDs1. What is an ABEND? ABEND stands for ABnormal END; it meansthat the system, while running your JOB, detected a problemthat it could not compensate for and stopped.2. Common ABEND Codes:Code Possible Problems or Causes____ ___________________________S222 The operator cancelled your job for some reason.You‘ll have to talk to the operator to find outwhy.S322 JOB exceeded CPU specified on the JOB card (orwent over 30 minutes during a EXEC step).S522 Cancelled by the operating system because there wasno activity for 5 minutes. Usual causes: A tapewas requested and the operator did not catch themount message or your JOB was submitted to a no-tape class and requested a tape mount.S722 Your JOB generated more than 4000 lines of outputand the system stopped printing when it reached4000 lines.S80A More main storage was requested than is available.ORS804 Your program and/or data set is too large.S806 The requested program can‘t be found. Commoncauses: a misspelled name on the EXEC statementor a missing JOBLIB or STEPLIB statement.SB37 No more space for the data set. Increase theprimary allocation in the SPACE parameter or adda secondary allocation.