Showing posts with label jcl. Show all posts
Showing posts with label jcl. Show all posts

Monday, December 28, 2009

What are the advantages of job control language?

The Following are the Advantages of Job Control Language.
Identifies the job.
Usually provides information to enable the computer services department to bill the appropriate user department.
Defines how the job as a whole is to be run, e.g. its priority relative to other jobs in the queue.

What are all the JCL statements used in JCL? & What are the JCL statements you have coded so far?

//JOB marks the beginning of a job, contains job information //EXEC marks the beginning of a job step, identifies program, cataloged procedure to be executed //DD (data definition), identifies a data set and its attributes //OUTPUT (specifies processing options for system output(sysout) data sets) //(null) (end of job) /* (end of data placed in input stream) //PROC (procedure) //PEND (procedure end) //*

Could I use TIME = 34 HOURS in JCL?

I don't think you can specify time parameter in that manner. The syntax is,
Time = X
or
Time = (X,Y)
where x = no of minutes, y is no of seconds

e.g: TIME=5
TIME=(2,30)

The purpose of this parameter is to limit the time the job may run, in case an error is made that causes the job to perform extra processing needlessly.

I guess it will give a syntax error if you code TIME = 34 HOURS

Thursday, May 14, 2009

JCL Tutorial 5 - EXEC statement

EXEC statement

EXEC statement is used to execute a program/procedure

A maximum of 255 EXEC statement can code in an single job

Syntax  - //stepname EXEC PGM=program-name,keyword parameters

            Positional parameter  -  Program-name


Keyword parameters for EXEC
  
            PARM  ACCT ADDRSPC DPRTY PERFORM RD

PARM

          PARAM parameter is used to pass information to program

          Syntax  ->  PARM=value
                 
                      Value is a string can be 1 to 100 characters long.

PARM-INDICATOR will contain "RAMESH"

         PARM-LENGTH contains length of string.             



Remaining parameters , We wont use much     

ACCT    - accounting information for that step

ADDRSPC - used to indicate to the system that the job step is use either 
          virtual or real storage
 
DPRTY   - used to assign priority to the job step

PERFORM - specifies the rate at which system resources used by job step

RD      - restart definition is used to specify automatic restart of a job 
          if it abends

          
         PASSING PARAMETER USING PARM PARAMETER
 
Q. If there is a situation, where we need to code more than 255 steps in a JOB? 
A. We need to split jcl into two jcls , at the end of the first jcl check the condition
code and initiate the second jcl.

Mainframes JCL Using JOBLIB / STEPLIB

JOBLIB / STEPLIB

JOBLIB

      It is a DD (Data definition) statement, and it specifies where 
      the program (which is specified in EXEC statement) exists. 
      It is applicable to all job steps in that job. It cannot be used 
      in cataloged procedures.

      Syntax  ->  //JOBLIB  DD  DSN=dataset

      EXAMPLE JCL ->
                         
                  //MYJOB   JOB   (E343),'STUDENZONE'  
                  //JOBLIB  DD    DSN=SE.TEST.LOADLIB,DISP=SHR    <---  Attention
                  //STEP1   EXEC  PGM=COBPROG

                        
                 Immediately following the JOB statement is the JOBLIB DD 
                 statement. This is used to specify the location of the 
                 program that is to be executed.
STEPLIB

         It is also like JOBLIB. It is used to tell in which dataset 
   program resides, It will be coded in JOB STEP. It is only 
   for that step instead of entire JOB. It can be placed any 
   where in the job step. STEPLIB can be coded in cataloged 
   procedures.

         Syntax  ->      //STEPLIB  DD  DSN=dataset

         Example JCL ->  //MYJOB   JOB   (U456),'STUDENZONE
'
                         //STEP1   EXEC  PGM=COBPROG                                                 
                         //STEPLIB DD    DSN=TEST.MYPROD.LIB,DISP=SHR
                         //STEP2   EXEC  PGM=COBPROG2
                         //STEPLIB DD    DSN=TEST.MYPROD.LIB1,DISP=SHR

                         In above example, STEP1 is executing COBPROG which 
                         is member of TEST.MYPROD.LIB 

                         STEP2 is executing COBPROG2 which is 
                         member of TEST.MYPROD.LIB1
 
If both the JOBLIB and STEPLIB statements are coded, then the STEPLIB specification
                         will override JOBLIB specification. 

Thursday, April 16, 2009

The JOB Statement - Tutorial 04


Q. What is the purpose of JOB Statement?
A. The JOB statement is used to identify the JOB to the MVS operating system.

- It tells the MVS OS about the start of a new job.
- It informs the MVS OS, the accounting information, so that the user can be billed for the computing time.
- It provides the name of the programmer to the MVS OS.
- It specifies the JOB's class(category) to the MVS OS, thus giving indication whether the Job requires more CPU time or less CPU time.
- More precisely, it also tells the MVS OS, what is the priority of the Job. So that the scheduler of the MVS OS - JES(Job Entry Subsystem) will enter the JOB in the system, before other jobs with lower priority.
- It tells the MVS OS, what is the output to be printed - whether to print JCL corresponding to the JOB statement only, or all the JCL statements. In addition, does it need to print allocation/termination messages.
- Moreover, it will announce to the MVS OS, which output device to print these output messages on.
- Sometimes, by writing a JCL parameter, you can instruct the MVS OS, to hold the job for later execution. You can also ask the MVS OS, to look for syntax errors in your JCL, before actually running the JOB.
//jobname   JOB    accounting-info,programmer-name,
//                 class,priority,
//                 message-class,message-level,
//                 hold|scan
Q. What is a valid jobname?
A job has to be given a name, by which the MVS OS will refer to it. The jobname can be 1-8 characters in length. The first character must alphabetic or national character. Subsequent letters can be alphabets, digits or national characters.

Valid jobnames
//MYJOB
//JOB@123
//$$JOB01

Invalid jobnames
//1JOB
//JOB A
//PROGRAMMINGJOB
Q. What is the accounting-information parameter?
Accounting information in an IBM-Mainframe system is used to bill/charge any job that is run on a Mainframe computer. You must tell the MVS OS, the account number to which to bill the CPU time utilized.

//JOB1  JOB  A123

Here A123 is the account number to  which the CPU time utilized on the Mainframe will be billed.

//JOB1 JOB (,QUASAR)

Here QUASAR is the additional accounting information. The leading comma indicates the absence of the positional parameter Account no.

//JOB1 JOB  (A123,'QUASAR S')
Q. What is the programmer-name parameter?
The programmer name parameter is used to identify the programmer is written the COBOL Program in the JOB being executed.

//JOB1  JOB  A123,QUASAR

In the case that, the programmer name contains special characters, we must enclose it in single quotes.

//JOB1  JOB  A123,'QUASAR S'

//JOB1  JOB  A123,'MC''DONALDS'
Q. What are keyword parameters?
Keyword parameters are those, which can appear in any order. They are identified by writing the keyword. The following keyword parameters are important for the JOB statement.
- CLASS, PRTY, MSGCLASS, MSGLEVEL, TYPRUN, TIME, NOTIFY
Q. What is the CLASS parameter?
The CLASS parameter is used to categorize the job. For example, a CLASS=K might mean that all the jobs which use a lot of CPU time. Another CLASS=X might mean jobs with a lower priority.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A

Here, the job is categorized as Class=A. When installing the MVS OS, various defaults are established. Different letters and numbers are assigned to classes that tell the MVS the nature of the Job.
Q. What is the PRTY parameter?
The PRTY parameter is used to assign priority to Jobs. A job with priority 6 will always be run before a job with priority 3.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=6
//JOB2  JOB  B123,'REENA S',
//           CLASS=A,PRTY=9

Here, JOB2 will be run before JOB1.
Q. What is the MSGCLASS Parameter?
Messages can be of two types -
1. Messages related to the System and JCL
2. Output of the program or procedure being executed.

As the job runs, the MVS OS generates several system messages about the events that take place along the way. This includes messages related to the system, and those that have to do with JCL that is being executed. To add to this, the program or procedure being executed, takes some input -> performs processing on input data -> generates some output(Report).

The MSGCLASS parameter tells the MVS OS, which class of output devices should these output messages be stored. The output-devices are categorized into different classes while generating the system.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=6,
//           MSGCLASS=A

Here, all the output messages will be routed to the output device of class A; usually the system default printer/job spool.
Q.What is the MSGLEVEL Parameter?
As we discussed above, messages are broadly of 2 types. Let us discuss further at length, what are the messages that the system produces as a job runs.

- Log messages indicating JOB Name, Username, Password, are routed to the output device.
- Next, the JCL statements that make up the Job.
- Also, output of the program being executed.
- Messages related to the successful execution/termination(ABEND Code) will be output.
- At the start of the job and end of job, allocation/termination messages are produced.

MSGLEVEL(statements,messages)

=0|1|2
0 : Only the JOB statement is output
1 : All JCL statements, including any cataloged procedures or symbolic parameters,
2 : Only Input JCL

=0|1
0 : The allocation/termination messages are printed only if the job terminates abnormally.
1 : The allocation/termination messages are output irrespective of whether the job is successful or ABENDS.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=1,
//           MSGCLASS=A,MSGLEVEL=(1,1)

Monday, April 6, 2009

Basic Concepts of Job control language JCL - Tutorial 03

Q. How do we write Output to disk/tape in JCL?
A. Unlike writing output to a dataset, disk/tape are direct Access(DASD) devices. Let us study the JCL that will write the output to the disk.



//JOB1JOB(A123),'STUDENZONE S',
//CLASS=A,PRTY=6
//STEP1EXECPGM=PROGRAM1
//INPUT1DDDSN=INFILE,DISP=SHR
//DISK1DDDSN=DISK.OUTPUT,
//DISP=(NEW,CATLG,DELETE),
//UNIT=DISK,
//SPACE=(TRK,(1,1),RLSE),
//DCB=(RECFM=FB,LRECL=40,BLKSIZE=400)
//TAPE1DDDSN=TAPE.OUTPUT,
//DISP=(NEW,CATLG,DELETE),
//UNIT=TAPE,
//DCB=(RECFM=FB,LRECL=40,BLKSIZE=400)

Let us recollect that all JCL statements basically have 3 broad divisions
//NAME OPERATION OPERANDS

1) All JCL statements begin with two forward slashes //.
2) NAME gives a name to the job, step or ddname.
3) OPERANDS can be positional parameters or keyword parameters.

Let us now see what the DSN(Dataset Name) is written, if you want to write the output of your program(in the JOB) to the Disk. Here the output will be written to a dataset called DISK.OUTPUT.

DISP(Disposition of the Dataset) -
Disposition of the dataset is used to tell the MVS OS, what is the current statusof the data set, what to do with the dataset if the JOB is successful, and what action to take if the JOB is unsuccessful.
DISP(current-status,normal-disposition,abnormal-disposition)

Current-status: The current-status specifies, whether the data-set pre-exists, or it has to be created newly, whether the jobs have exclusive access to it,or multiple jobs can share it.

Normal-disposition : It tells what to do, upon normal execution of the job. The data-set can be saved or deleted.

Abnormal-disposition : It tells what to do, if the JOB terminates with errors(Abnormally Ends - ABENDS). Either the dataset can be saved or deleted.
 DISP(NEW,CATLG,DELETE)
NEW, CATLG and DELETE are positional sub-parameters. They must appear in the same order.

NEW : This tells the MVS OS, the status of the dataset at the start of the JOB. It indicates that the dataset DISK.OUTPUT has to be creatednewly.

CATLG : Upon successful execution of the JOB, the dataset must be added to the System Catalog.

DELETE : Upon unsuccessful execution of the JOB, the dataset must be deleted.

UNIT Parameter :
This is used to identify the physical device on which output data-set is to be placed. During OS(MVS) installation(a process called SYSGEN), the system programmers will have assigned a symbolic name to each physical device.

SPACE
Parameter :

To create the output dataset, we need to first tell the MVS OS. The OS is a memory guagrd. It acts as a watchdog, guarding, protecting the memory. If you want to store the output dataset in computer memory, you must first ask the MVS OS for it. Only when the OS grants your request, then you can go ahead and store data.

The OS is a miser. Even if you want a single byte of memory, you must first ask the MVS OS for it. It does not give any bytes for free.

You must tell the MVS OS, how many bytes of memory space you need to store your data. You do this by writing the SPACE parameter.
SPACE(unit-of-space,(primary,secondary),release)

SPACE(TRK,(1,1),RLSE)

TRK indicates that the space being requested is in Tracks. Since Primary = 1, the MVS OS will initially allocate(reserve) 1 track of disk space, to store the output Dataset. If the size of output dataset exceeds 1 track, (and you run out of space), the MVS OS will allocate 1 additional track of memory space. If your program finds this space also insufficient, it will ABEND.

After successful execution of the job, any space not utilized by the job must be successfully released.

DCB Parameter :
DCB stands for Data Control Block. DCB will tell the MVS OS, the organisation of the dataset. A data-set may have all fixed length records, or the records may be of varying length. You must tell the MVS OS, the length of each record. This should match the record length as specified in the program. Also, a set of records form a block. MVS allocates memory in Blocks. You must specify the Block Size.

Input  -->     COBOL Program-->        Output
Dataset                              Dataset
LRECL=50    INPUT-REC PICTURE X(50)    LRECL=40
           DISK-REC  PICTURE X(40)

DCB=(RECFM=FB,LRECL=40,BLKSIZE=400)

RECFM = FB
It tells the MVS OS, that each record in the output data set, will be of fixed length. If the records are going to be of variable length, we must write RECFM=VB

LRECL=40
It tells the MVS OS, that each record is of length 40 bytes. Since, records are fixed length, all records have the same length = 40 Bytes. If RECFM=VB, then it tells the MVS OS, that the average length of the records is 40 bytes.

BLKSIZE=400
It tells the OS, that on the disk(direct access device), the size of the block will be 400 bytes. Thus, 1 block will at most store 10 records. If RECFM=FB, then BLKSIZE must be multiple of LCRECL. e.g. Block Size 4000 = 10 times x Record Length LRECL (40)

Basic Concepts of JCL - Tutorial 02

What is the Input/Output FILE Identification section?
//INPUT1 DD DSN=INFILE,DISP=SHR
//OUTPUT DD SYSOUT=A

The fields INPUT1 and OUTPUT1 must correspond to the name following the ASSIGN TO statement in the FILE-CONTROL section of the COBOL Program.

FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO INPUT1.
SELECT OUTPUT-FILE ASSIGN TO OUTPUT1.

DD Field stands for Data Definition. Its main task is to tell the MVS OS, the input files from which data is read, and output file, to which OUTPUT information is written.

//INPUT1 DD DSN=INFILE,DISP=SHR

...DSN : A file containing records in IBM Mainframes is called Dataset. Every dataset has a name ; DataSetName(DSN).
DSN = INFILE indicates that the input data will be read from the Dataset INFILE.

SYSOUT=A indicates that the output will be written to the default printer(Job Spool).

DISP=SHR says that Disposition is Shareable. This means, that the dataset INFILE is not reserved for exclusive use. Other Jobs /Users can use this dataset simultaneously.

Basic Concepts of Job Control Language JCL - Tutorial 01

Q. What is a Job?
A. Mainframe computers are used to process data. They perform tasks or operations on the data, to generate valuable information as Output. A job is a set of tasks performed on input data, to produce output results.

For example, a job might consist of Reading Input data records from a file, arranging the Input data records in order(sort them), and write the sorted records data to Output File.

Q. What is a batch of Jobs? What do you mean by Batch Processing?
A. Think of an auto-assembly line in a car factory. Each car is processed automatically by a robot. There are several cars in Queue.

Analogous to this, in a Batch System, there is a series of jobs in queue, and are run one after the other, without any human intervention.

A complete batch of jobs, takes time to run, and give the finished product(output result). A batch of jobs can be seen as a production line in the factory.

So, there are data processing tasks, that take lot of time, e.g. generating credit card statement of all the customers of a bank. The output result(statements) cannot be immediately obtained. Large corporate organisations use a batch of jobs to perform such tasks at regular intervals, say for example monthly.

Everytime, you swipe your credit card, withdraw money from the Automated Teller Machine, transfer funds to your friend’s bank account, a Mainframe computer crunches the data, and runs a batch of jobs.

In fact, if you transfer funds to your friend’s account in a nationalised bank like State Bank of India, it doesn’t get credited immediately. The reason for this is, the entries get processed in batches(bunches) in different time slots(9-11 a.m.,11-1 p.m.,...) on the RBI’s NEFT Servers.



Q. What is Job Control Language(JCL)?
A. JCL specifies to the MVS Operating System, what resources your program expects to use. JCL acts as an interface between your COBOL program (JOB) and the OS.








Any JCL can be divided into 3 logical groupings as shown in the above diagram.

JOB Identification -
JOB1 - Name of the Job
JOB - This is a job. Everything that follows relates to this JOB.
(A123) - Account to which the computer time is to be billed.
'STUDENZONE S' - Programmer's name
PRTY = 6 - Jobs within a class are assigned a priority.


Program Identification -
//STEP1 - Stepname. JOB consists of many tasks(steps).
EXEC - Beginning of the JOB Step

PGM = PROGRAM1 ; Name of the program that is to be executed