What is JCL?
- JCL stands for Job Control Language.
- It provides the resources that are required by program.
- It acts as a communicator between operating system and program.
- It is used to utilize the CPU idle time that is reflected in the cost of utilization.
- It makes jobs of work that are run without manual interaction.
- It works according to priority level for jobs as batch.
- JCL is not procedural language.
- Without jcl your program will not run on mainframe.
How does JCL act on code(if you take a COBOL program)?- There are certain set of divisions that interact with JCL.
Act as introductory part to JCL(program name, author,date etc no interacting code).
Now the story begins - JCL interacts with OS acc to need as it send request for Files under file operation.
After files are accessed, it works with them according to operations to READ or to PRINT files (with the help of OS).
It contains various actions taken on files, for eg. to close files that are being used.
What is //?- It is an important symbol used in JCL statements.
- JCL statement must begin with this symbol.
- It is a predefined rule that must follow to execute the JCL statements otherwise it will through error.
- The JCL execution system first checks for that symbol at beginning of statements to be considered as JCL statement.
- Use without space between symbol and jobname.
- Every statement in jcl should start with //.to work properly.
- Use of it avoid any runtime exceptions.
Give the syntax of job specifying JCL statement.Syntax:
//JOB NAME JOB (A189), ‘Author Name’,CLASS= ,PRTY= ,Example:
Here job name is for the name of job.
JOB defines all statement relate to job name.
A189 is taken as reference number for user information.
Author Name specify name of writer.
CLASS and PRTY these are class and priorty assigned to job by JCL.
Here CAREERRIDE is the job and PRASHANT RAJORIA is the author.
(A189) is a referenced used for user information.
PRTY is the priority level among different jobs leads to order of execution.
Suppose I have a program in cobol Name”CAREERRIDE” and want to execute the program by JCL. specify the process?
- The program to be executed by JCL should have a job name.
- And used the command EXEC to execute the program in JCL.
- Program name is specified after the step name.
- Specify program name in the PGM to be executed by JCL.
- PGM is the reserved keyword for values program name.
//Step name command to execute PGM=program name,- Example
//STEP01 EXEC PGM=CAREERRIDE,
- EXEC is the execution command to run the program in the step01
What are hierarchy levels in JCL?
- Level describes the JCL statements.
- According to each action performed by each statement.
- Each statement of JCL consist of following keywords:
COMMENTS IF ANY
//STEP007 EXEC PGM=JAMES BOND
Here stepoo7 is the name,
pgm is the keyword parameter,
exec is the command,
assign is the operation,
jamesbond is the operand.
What is Job Control Language?- A language for job description to MVS, OS/390 and VSE Operating Systems that run on IBM S/390 servers.
- A set of statements that required for running a particular program is referred as a job step.
- Without user interaction, job runs in background.
- The OS manages the user requests to initiate the units of work.
- Input data sets, such as files are the specific JCL statements to access. Once the resources are allocated for the job, the output data set is to be created or updated.
- A set of JCL statements are stored as data set and will be started interactively.
- A menu-like interface is provided by MVS and OS/390, known as ISPF to initiate and manage jobs.
Differentiate between addressing mode and run mode.Addressing mode or Access Mode:
- AMODE(24) indicates 24-bit addressing in the memory below the line.
- AMODE(31) indicates 31-bit addressing in the memory above and below the line.
- AMODE=ANY indicates either 24-bit or 31-bit addressing techniques.
Run Mode or Residency Mode:
- RMODE(24) indicates the program need to be loaded into the memory below the line.
- RMODE(31) indicates the program need to be loaded into the memory either below or above the line.
- RMODE=ANY indicates the program to load either in 24 bit or 31 bit memory.
What is DISP=(NEW,PASS,DELETE)?- DISP NEW indicates a new data set is defined.
- DSIP NEW will allocate new memory space.
- DISP PASS – the data set need to be passed to the next step, once the current step is successful.
- DISP DELETE is to remove the available data set once the step abends.
- So that only non-abended data sets are available.
What does a disposition of (NEW,CATLG,KEEP) for a DSN mean?- DISP NEW will allocate new memory space for disposition.
- DISP CATLG will catalog the available data set once the step is successful.
- DISP KEEP will retain the dataset. Catalog will not be kept when the step abends.
- The above 3 operations always ensures that the data set is properly handled.
- The operations are reliable to handle the data sets.
What are STEPLIB and JOBLIB? What for they are used?- A library needs to be searched before the system library, for locating programs to execute by steps.
- STEPLIB and JOBLIB are utilized for specifying the required library.
- Not all steps are applied for both STEPLIB and JOBLIB.
- STEPLIB is used only for a particular step.
- JOBLIB is used for all the jobs.
What is the difference between the Positional and Keyword parameters? Give examples.- Positional Parameters are placed in a specific position.
- It needs to be positioned within the operand field.
- Example: Employee name in the Job card is a positional parameter at the Job level.
- Keyword Parameters are not placed in a specific position or order. Example: MSGLEVEL=(X,Y)
What is the purpose of DISP Parameter?
- DISP parameter is used for specifying the disposition of the data set.
- The current status of the data set is specified at
1. The beginning of the step.
2. The successful execution of the step.
3. Abnormal execution of the step.
- DISP is assigned for two dispositions along with the status.
- The notation of DISP is:
DISP = (Status, Normal Disposition, Abnormal Disposition)
How to pass data to a program that is coded in an EXEC statement?Following are the methods to pass data to the program:
- Using PARAM in Job Control Language. Linkage Section should contain the code of the receiving variable in COBOL.
- The PROCEDURE DIVISION USING statement is used by using PARAM.
- By passing as instream in Job Control Language.
- ACCEPT statement in COBOL is used.
- By passing in a flat file.
- File descriptor need to be coded in COBOL.
What are the parameters that are used in creating a GDG?- Following are the parameters that are used in GDG creation.
Name: This is the name of the GDG that is to be created.
Limit(n): The max. number of generations that exists at a given point time.
Empty: Deletes all older generations once reaches the generations limit.
NoEmpty: Removes the oldest generations once reaches the generations limit.
Scratch: Removes the generations completely after deletion of the data set.
NoScratch: Uncatalogs dataset, when the dataset is removed.
State the uses of SYSPRING, SYSIN, SORT FIELDS, SUM FIELDS and DUMMY.SYSPRINT:
- All system output is produced under DD card.
- The highest number of processed records is appeared under SYSPRINT.SYSIN:
- System Introduction. To sort a file on certain key, use the following command under SYSIN:
SORT FIELDS = (beginning column, length, data type, A/D).SUM FIELDS:
- To specify the fields whose aggregate need to be summarized.DUMMY:
- Used to simulate a program by avoiding output file creation.
How to alter the parameters for the existing GDG?
- ALTER command is used to alter the parameters of existing GDG.
- New value can be provided for parameters using ALTER command.
- Values can be given in one shot or individually.
- ALTER gdgname LIMIT(05) alters the limit to 5.
- ALTER gdgname LIMIT(05) SCRATCH NOEMPTY - This option alters the scratch and no empty options.
Brief description of inline procedure of JCL.
- In-stream PROC is defined in JCL stream itself.
- It does not reside in PROCLIB.
- For inline perform the code would be:
PERFORM UNTIL SWITCH=’Y’
……….. BODY OF THE CODE…….
- The body of the code from is appeared in-line.
- The code does not appear in a separate paragraph.
What is the significance of ADDRSPC parameter in EXEC statement?- Storage for individual step is requested by the REGION parameter.
- Being paged step is prevented by the ADDRSPC.
- For being paged, the default option is ADDRSPC=VIRT is used.
- Once ADDRSPC is set to REAL(ADDRSPC=REAL), the step would be locked into real storage, when executed.
- REAL is a good option when time dependent programs are used.
- REAL option allows modification of channel programs dynamically during the I/O operations.
- Its effect is adverse on the performance of the system.
How DUMMY is used in JCL?
- When ignoring the FILE I/O operations need to be executed, DUMMY is used.
- DUMMY is mostly used while performing unit testing.
- The DD statement will be coded as:
//INFILE DD DUMMY
- The operations of INFILE are nullified at runtime in COBOL.
- DUMMY is used for testing. It lasts upto the execution of the job.
What is use of RESTART and how to use it?
- Step, procedure step or checkpoint is indicated by using RESTART, to restart the job.
- Syntax is:
- When the step is to restart is a procedure, procedure name need to be mentioned.
- Syntax is:
- Stepname is the name of the PROCSTEP, the starting point of execution.
What is model dataset label (Model DSCB)?- A pattern for data set label that is created for data set.
- A Model dataset label is a part of GDG group.
- Existing data set is needed by the system for serving as a model.
- Model dataset essentially be cataloged.
- The model DSCB name is supposed to be placed on DCB parameter.
- This DCB parameter is associated with DD statement which creates generation data group.
How GDG are concatenated?- Each data set name is specified for concatenating Generation Data Groups.
- Generation numbers for all generations is also done.
- All generations are retrieved by omitting the generation numbers.
- All generations are referred by DD statements.
- All generations should be on the same volume to obtain the result.
What are S0C1, S0C4, S0C5, S0C7 and SOCB?SOC1: An operation Exception Error that may occur because of missing DD name.
SOC4: An Exception Error that may occur because of missing Select statement, missing parameters on called sub program.
SOC5: This exception may occur when an unopened dataset is closed, bad subscript.
SOC7: This exception may occur when a numeric operation is performed on non-numeric data, working storage is not initialized.
SOCB: This operation error may occur when a ‘division by zero’ occurs.
How to submit JCL through a COBOL program?Define following code in JCL:
1. //JOBA JOB 1111,JOB1
2. //STEP01 EXEC PGM=PROG1
3. //ddname DD SYSOUT=(*,INTRDR)
Define the following code in COBOL program.1. SELECT JCL-FILE ASSIGN TO DDName.
2. Open this file and write the JCL statements into this file.
3. For example: MOVE '//TESTJOB JOB 1111,VISVESH' TO JCL-REC.
4. MOVE '//STEP01 EXEC PGM=IEFBR14' TO JCL-REC.
5. Close this file.
6. Submit TESTJOB.
What are the difference between JCL and JES?JCL:
- JCL is a language.
- JOBs written in JCL for Mainframe.
- JOB is executed, space and other desired resource is allocated by the keywords of JCL.
- JES is a subsystem of MVS.
- JES handle the JOBs submitted by the users.
- JES takes the control of JCL and generates JOB id.
- JES validates JCL for errors.
How JCL work to handle various input output file operations?- JCL defined two set of parameters to handle various i/o operations.
- Due to demand of different type of work done by JCL statements.
1. POSITIONAL parameter:
- It is related directly to the position.
- It gives the file positions in the operations.
- It should precede the keyword parameter.
2. KEYWORD parameter:
- It is used to assign to variable information.
- It should followed the (=)sign then variable info.
HOW does JCL specify the job to the operating system?- JCL defines the job to OperatingSystem by so called JCL groups.
- Groups are defined acc to the work they produce.
- Most work is to only identify the job.
- Divides according to JCL statement that brings to OS.
1: Identify the job.
2: Execute the program named by user.
3: Various DD’s that define the files being utilized.
4: Previous work should be closed opration, exit operation.
Suppose I have five jobs to do. But I want to hold one?
- Its simple to do so there is predefined set of rules for that.
- According to JCL’s predefined set for jobs there is a keyword.
- You can hold a job for later execution.
- Specify TYPRUN on the job statement .
- TYPRUN is used to hold job with its variable name to HOLD.
For the job you want to hold
//CAREERIDE JOB (P007),’PRASHANT RAJORIA’ TYPRUN=HOLD,
I have a job called CAREERRIDE and some steps in it as STEP1,STEP2. but I want to execute STEP2 before STEP1 ? How do I do that?
- It is the method to assign priority in job steps with help of keyword parameter in JCL.
- The keyword DPRTY is used it is called dispatching priority with values ranging from(0 to 15). Higher value has higher priority.
It is calculated as DPRTY=(value1)*16+(value2)
//CAREERRIDE JOB (A132),’PRASHANT RAJORIA’,
- Now calculating step2 has 101 and step1 has 86 so step2 execute first.
I want my job (CAREERRIDE) to be executed in 1 minute and 2 seconds. How do I do that?
- Execution time is the CPU time given by OPERATING SYSTEM.
- Done with the help of predefined keyword parameter called TIME
- It has values as minutes and seconds.
//CAREERRIDE JOB (P124),’PRASHANT RAJORIA’ TIME=(1,2),
- It takes 1 minute and 2 seconds of cpu time.
Can I share my data with other jobs? How?
- Yes, data can be shared with other jobs.
- When the data is defined for a job then define a predefined keyword.
- Keyword called DISP means disposition of data. as shareable.
- It has values that assign it as shareable.
- SHR is used as value to data as shareable.
- DISP=SHR should Insert after the data field of a job.
Can I send output of job to my remote device careerride123?
- Yes output of any job can be send to remote devices
- It is a facility provided by JCL.
- The keyword for that is DEST.
- DEST stands for the destination to be used.
- It should be defined after the output statement in DD.
DEST=name of remote device
Is their any limit for Data Sets?- Yes, the data sets limit is defined in JCL.
- There is a limit to data concatenation.
- Concatenation means to define data sets one after one again and again data as you need.
- But under the limit as:
1. Maximum 255 sequential data sets can be concatenated.
2. Maximum 16 partioned data sets can be concatenated.
3. After that limit it may show it as more than one file or error.
How would you understand Error(execution phase)?- If program abnormally terminates, syntax mismatches, requirement does not fulfill - all these lead to develop description about what happened here and the description report is called the error.
- The execution errors generated in execution phase is due to mistakes only in the execution steps mainly due to parameters, not defining jobs and wrong keyword used etc.
- Jcl has predefined codes for errors generated in each phase. According to the mistakes there are mainly eight error codes predefined for the execution phase.
- If the specified job has no steps then it shows error and in the code it will show (IEF6071).
- If you forget to right EXEC command then it shows error code (IEF6051).
- If the // is not present it, stops reading the lines and show error code(IEF6211).
- If you forget to terminate the statement then it will show error code (IEF6051)
- In jcl termination is done with the help of comma(,) as the last character.
- Coding invalid step name will generate error and show error code(IEF6471).
- Coding an invalid/ wrong module name will generate error and the code is (CSV0031).
- Misplaced statements will generate error and the code is(IEF6361).
- If the nesserary apostrophes are not taken then shows error and the is (IEF6261).
- Misplaced data definig statements will show error and the code is (IEF6061).
Is ACCT parameter mandatory?
No,ACCT parameter is not mandatory it is optional depending upon requirement for the following purposes:
- ACCT is used to provide accounting information for the jobs steps used in the program.
- ACCT keyword is used in the EXEC statement or job steps statement for a particular job. If it is used then the accounting information is given by the installer to the ACCT.
- Accounting information means the billing information for the job for which the ACCT is being used.
- The account-information is provided by the installer eg. The name provided by the installer in the installing steps.
//CAREERIDE JOB (P007),’PRASHANT RAJORIA,
’ //STEP01 EXEC PGM=DISPLAY ACCOUNT INFORMATION,ACCT=(P007)
P007 is refrenced value used for user information in the job statement.
Is automatic restart possible in JCL? If yes, how?
- Yes, automatic restart is possible in JCL with the help of predefined keyword parameter.
- Restart is needed when job is abnormally terminated because of any reason.
- With the help of RD(restart definition) keyword the job starts automatically by the check point.
- Check point is the points that defines the execution of job at various points.
- It starts to find the last successful execution so called check point and starts from the last successful checkpoint.
RD has four different types of syntax.
RD=R R for restart.
RD=NR NR for no automatic restart.
RD=NC NC for no check point.
RD=RNC RNC restart with no check point.
//CAREERRIDE JOB (P007),’PRASHANT RAJORIA’ RD=R/NR/NC/RNC, (USE ANY ONE)
Is condition checking possible in JCL ? If yes, how?
Yes, it is possible to check conditions in JCL. Conditions can be checked at both job level or step level.
- Job level condition applies to all steps in the job and overrides condition if stated in the step level.
- Condition checking is similar as (if else conditions ) in many programming languages(as c, c++, java etc).
- Condition checking is done with help of a keyword parameter COND with return code and operand(predefined in jcl).
- Return codes specify according to the type of completion of job and operand specify according to the condition want to apply.
- There are four return codes and six operands used as follows:
1. Return codes 0 for successful execution of job step.
2. 4 for warning message for job step.
3. 8 for serious error in job step.
4. 16 for steps halted.
- Operands used GT bypass current step if comparision code is greator than return code.
GE greator than or equal to Example:
LT less than
LE less than or equal to
EQ equal to
NE not equal to
//CAREERRIDE JOB (P007),’PRASHANT RAJORIA’ COND=(4,LT),
//STEP001 EXEC PGM=HELLO1
//STEP002 EXEC PGM=HELLO2
//STEP003 EXEC PGM=HELLO3
- All steps executed if return code is less than 4 for every step.
Is their any set of rules for DD? Explain.- Yes, DD should follow predefined rules otherwise it will not be executed or will show error message.
- DD is called the data defining sets and it is most sensitive part of JCL statements.
- It should follow the EXEC statement for that job for which DD is needed.
- Always assign a valid name to DD, otherwise it will terminate abnormally.
- For each data set you should define a data defining statement.
- Positional parameters are used by DD and should use the operand field otherwise error.
- Keyword parameters are used by DD and shoud use the operand field otherwise error.
- If both are coded keyword parameter must follow positional parameters.
Is it possible to define DD statements as you want?
- No, DD statement cannot be defined as anything in JCL because certain DD names are reserved for only system use.
- If these are used by DD statements then it would not work and show exceptions, errors.
- It will give description in error as (you have used the system defined DD names).
- The following are the DD names you should avoid to use in DD statements:
//JOBLIB(used for library)
//JOBCAT(used for catalog)
//SYSABEND(used for abort)
//SYSCHK(used for check point)
//SYSOUT(used for output)
//STEPCAT(used for step catalog)
//STEPLIB(used for step library)
//SYSDBOUT(used for db output)
//SYSOUD(used for sys oud)
//STEPLIB(used for step library)
//SYSIN(used for system input)
Is it possible to left uncode DISP? If yes, how?
- Yes, it is possible but it needs certain changes made as it sets to default automatically.
- DISP is the disposition property set on data sets.
- It is a keyword parameter used in DD statements.
- If you left uncode DISP the following changes happen-
- It consist of mainly two fields (status, type of disposition). If left uncoded the status field sets to NEW(default) automatically.
- Normal disposition sets to DELETE if status sets to new.
- Abnormal disposition sets to same value as the normal disposition sets.
- Normal disposition sets to KEEP if status field is set to old.
DISP=(status,type of disposition)
If sets to default then DISP=(NEW,DELETE,DELETE)
Are there any set of rules for the names of the steps used in a job? What are they?
- Yes, there is predefined set of rules for naming steps in a job.
- It should be unique and meaningful as it is used by system to reference the job.
- There is no syntax for the parameter but have naming rules as follows:
1. Step name should be coded after // symbol no space in between.
2. Step name must follow after the job statement has declared.
3. A job may have many steps but all have different names.
4. The step name must be followed by at least one blank space.
5. The step names can only contain (A-Z,0-9,#,@,$) these preset alpha numerals and special symbols.
6. First character must be alphabet or special symbol.
//PRASHANT007 PGM= CONER