|
|
|
- We are a cosmopolitan community of 400 members, from around the globe. - Working on writing and publishing articles on CICS. - Special article on "How do I learn Mainframe Programming" |
Tuesday, April 7, 2009
JOB Statement
Labels:
accounting-info,
Allocation,
CLASS,
JCL,
JES,
JOB,
jobname,
keyword,
message-class,
message-level,
MSGCLASS,
MSGLEVEL,
MVS,
NOTIFY,
position,
programmer-name,
PRTY,
Termination,
TIME,
TYPRUN
Monday, April 6, 2009
JCL Pseudo-code - How to write output to Disk/Tape
| 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. |
| //JOB1 | JOB | (A123),'QUASAR S', |
| // | CLASS=A,PRTY=6 | |
| //STEP1 | EXEC | PGM=PROGRAM1 |
| //INPUT1 | DD | DSN=INFILE,DISP=SHR |
| //DISK1 | DD | DSN=DISK.OUTPUT, |
| // | DISP=(NEW,CATLG,DELETE), | |
| // | UNIT=DISK, | |
| // | SPACE=(TRK,(1,1),RLSE), | |
| // | DCB=(RECFM=FB,LRECL=40,BLKSIZE=400) | |
| //TAPE1 | DD | DSN=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) |
Sunday, April 5, 2009
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.
//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.
IBM's Anti-trust Suit
Is IBM trying to kill competition?
Its been a long-standing debate, if Internation Business Machines(IBM) has survived, simply because of the lack of competition. High cost of Mainframe computers, geeky unfriendly and old to work with, are deterrent factors for the bigblue.
In the 90's IBM failed to ride the new wave of the home desktop PC, and Microsoft took the competitive advantage. The battle between Microsoft and IBM still wages on.
A mushroom company Platform Solutions, developed software that mimicked IBM Mainframes on standard servers, Big Blue tried to fight back, but in vain. Finally, they simply tried to acquire the company for $150 million in July this year. After that, Platform Solutions is nowhere to be seen, vanished in thin air.
IBM still faces stiff competition from Biggies like Microsoft and Google. T3 Technologies, a reseller of Platform's products, has filed a complaint against them to the regulators in European Commission.
IBM is now negotiating to buy Sun Microsystems for $7 billion. We can only keep our fingers crossed. IBM has always charged astronomical prices for its so-called 'innovative' products. Its surprising, that amount of Mainframe processing power sold every year is declining.
Its been a long-standing debate, if Internation Business Machines(IBM) has survived, simply because of the lack of competition. High cost of Mainframe computers, geeky unfriendly and old to work with, are deterrent factors for the bigblue.
In the 90's IBM failed to ride the new wave of the home desktop PC, and Microsoft took the competitive advantage. The battle between Microsoft and IBM still wages on.
A mushroom company Platform Solutions, developed software that mimicked IBM Mainframes on standard servers, Big Blue tried to fight back, but in vain. Finally, they simply tried to acquire the company for $150 million in July this year. After that, Platform Solutions is nowhere to be seen, vanished in thin air.
IBM still faces stiff competition from Biggies like Microsoft and Google. T3 Technologies, a reseller of Platform's products, has filed a complaint against them to the regulators in European Commission.
IBM is now negotiating to buy Sun Microsystems for $7 billion. We can only keep our fingers crossed. IBM has always charged astronomical prices for its so-called 'innovative' products. Its surprising, that amount of Mainframe processing power sold every year is declining.
Wednesday, April 1, 2009
COBOL Tutorials
| Tutorial | Links |
| Introduction to COBOL Programming | |
| DATA DIVISION | |
| Tutorial 04 – DATA DIVISION(Part – II) - WORKING-STORAGE SECTION - Simple COBOL Program to declare and use WORKING-STORAGE Areas | PDF Word |
| Tutorial 05 – DATA DIVISION(Part – III) - How the MOVE Verb works - Rules to be applied while MOVEing - MOVEing to an Alphanumeric Data-Item - Simple Program that shows an alpha-numeric MOVE - MOVEing to a Numeric Data-item - Simple Program to show a Numeric MOVE - Editing Symbols - Rules of how EDITING symbols work - Simple Program to show working of various EDITING Symbols | PDF Word |
| Tutorial 06 – DATA DIVISION(Part – IV) - REDEFINES Clause - Sample Program to understand REDEFINES Clause - RENAMES Clause - Sample Program to understand RENAMES Clause | PDF Word |
| Tutorial 07 – Arithmetic Operators and Expressions in COBOL - How the ADD Verb works - More about SUBTRACT Verb - MULTIPLY Verb to multiply two things - DIVIDE Verb to Divide and find remainders - COMPUTE Verb for writing complex arithmetic expressions | PDF Word |
| Tutorial 08 – USAGE Clause - What is USAGE Clause - USAGE is DISPLAY - USAGE IS COMP/BINARY - USAGE IS COMP-1/COMP-2 - USAGE IS COMP-3 | PDF Word |
| Tutorial 09 – Decision Making in COBOL - Basic IF Statement - IF ELSE Construct - Nested Conditionals - Types of Conditions – Class, Relational, Sign - Complex Conditions – Boolean AND, OR, NOT - 88-level Special conditionals | PDF Word |
| Tutorial 10 – Program Flow Control - Basic PERFORM Statement - PERFORM multi-paragraph Procedure - PERFORM a SECTION - PERFORM loops | PDF Word |
| Tutorial 11 – EVALUATE Statement – I - EVALUATE and WHEN Clause - Multiple Subjects and corresponding objects | PDF Word |
| Tutorial 12 – EVALUATE Statement – II - Agreement of the subjects with the objects - Values that subject and object can take - Concrete example of EVALUATE Clause | PDF Word |
| Tutorial 13 – Table Handling - Creating a table in COBOL - Storing data and retrieving the contents of table - Working with two-dimensional tables | PDF Word |
IBM Utility Software
| Tutorial Name | Links |
| IEBGENER for Sequential Files | PDF, Word |
| IEBCOPY for Partitioned Datasets | PDF, Word |
| IEBCOMPR and SuperCE to compare Datasets | PDF, Word |
| Search Utility to search through Libraries | |
| IEFBR14 for Side-effects | |
| IEBPTPCH – Print and Punch Utility | |
| IEHPROGM |
JCL Tutorials
| Tutorial Web Page and Outline | Download Links |
| Tutorial 01 – JOB Statement Fundamentals || JOB Statement – Purpose || Accounting-information parameter || Programmer-name parameter || Keyword Parameters || CLASS Parameter || PRTY Parameter || Message Class MSGCLASS || MSGLEVEL Parameter || | PDF, Word |
| Tutorial 02 – EXEC Statement Part I || EXEC Statement || Job-Step || Program || Input Dataset || Output Dataset || Program Load || ACCT Parameter || PARM Parameter || JOBLIB, STEPLIB Parameter || Default System defined Library – SYS1.PROCLIB || User defined private library || | PDF, Word |
| Tutorial 03 – EXEC Statement Part II || DPRTY Parameter || PERFORM Parameter || Restarting and Checkpointing – RD Parameter || ||Common Parameters of JOB and EXEC Statement || REGION Parameter || COND Parameter || | PDF, Word |
| Tutorial 04 – DD Statement Part I || DD Statement : Purpose || DSN Parameter || Qualifier levels in a DATASET Name || DISP Disposition Parameter || Status of Dataset || Normal Disposition || Abnormal Disposition || Meaning of NEW,OLD,SHR,MOD,KEEP,DELETE,CATLG,UNCATLG,PASS || | PDF, Word |
| Tutorial 05 – DD Statement Part II || UNIT Parameter – referring to device by its make/model || AFF Subparameter || VOL Parameter – referring to a particular volume of device || SER – Serial Number || REF – Referback to previous VOL Statement || PRIVATE subparameter || RETAIN subparameter || SEQ subparameter || LABEL parameter for Tape Datasets || SPACE Parameter – for storage space allocation || Max. space allocated to a PS || || RLSE,CONTIG,MXIG,ROUND Subparameters || Organisation of records in Dataset || DCB Parameter – Data Control Block || RECFM – Record Format || LRECL – Logical Record Length || BLKSIZE – Block Size || DSORG – Dataset Organisation || Sample JCL Showing how to use DCB Parameter || | PDF, Word |
| Tutorial 06 – DD Statement Part III(Instream and Cataloged Procedures) || What is a JCL PROC ? || Cataloged PROCEDURE || Default SYSTEM LIBRARY || || Private Library || Analogy with respect to conventional Programming Languages || Instream PROCEDURE || Calling a PROC – Example || | PDF, Word |
| Tutorial 07 - More on COND Statement(Lots of Examples) || COND Statement – Basic Example || EVEN Parameter || ONLY Parameter || COND Coded on many job-steps || | PDF, Word |
| Tutorial 08 - Cataloged and Instream PROCs(Overriding Parameters) || Modifying contents of a JCL PROC || Modifying a parameter on EXEC Statement || Adding a parameter to EXEC Statement || Deleting(Nullifying) parameter on EXEC Statement || Adding or modifying DD Statements || Example – MODIFYING DD Statament || | PDF, Word |
| Tutorial 09 - JOB Log (How to understand it and Interprete it) || JOB Log means... || What is JES2 JOB Log || Start and End CPU Times || User assigned to the JOB || Number of Input Cards read || COND Code || Allocation and Termination Messages || | PDF, Word |
Compuware File–aid How to
COND Statement – How does it work?
| Q. How does the COND statement work? |
| The COND statement is used to bypass Job-step. Example 1 Consider the statement //STEP02 EXEC PGM=IEFBR14,COND=(4,GT,STEP01) r In this example, if condition-code of STEP1 is between 0 to 3, the COND condition is satisfied. Thus, STEP02 is bypassed. Example 2 Consider the statement, //STEP02 EXEC PGM=IEFBR14,COND=((16,GE),(90,LE,STEP1),ONLY) In the above example, the system executes this step if all of the three conditions are met, 1. Return codes of Any of the previous job-steps is 17 or greater. 2. Return code of STEP1 is 89 or less. 3. Any of the previous step abnormally terminates. Example 3 Consider the series of statements : //STEP01 EXEC PGM=IEFBR14 //STEP02 EXEC PGM=IEFBR14,COND=(0,EQ,STEP01) //STEP03 EXEC PGM=IEFBR14,COND=((8,LT,STEP01),(8,GT,STEP02)) In the above scenario, assume the system successfully executes STEP01 with Return Code=0. The system finds that 0 is equal to return code of STEP01 i.e. 0. So, STEP02 is bypassed. When the system evaluates condition on STEP03, it finds that 8 is greater than return code of STEP01(we don’t consider the other part of the condition, since STEP02 was bypassed). Since, 8 > 0, the system executes STEP03. |
| Rule : Bypassing a job-step because of a return code test, is not the same as abnormally terminating the job-step. |
| You can now try and predict in this JCL, which job-steps the system executes, and which job-steps are bypassed... Answer : System executes STEP01. Return Code = 0. (4,LT,0) false. System executes STEP02. Return Code = 0. (16,GE,return code of any preceding step) true. System bypasses STEP03. Technorati Tags: COND,Condition,COND on EXEC,COND on JOB,EQ,NE,GE,GT,LE,LT,job-step,COND Parameter,How COND parameter works,IEFBR14 |
Compile JCL's
| Compile Job | Instructions on how to customize and use |
| COBOL Compile-Link Job | 1. Change the //JOB Card. 2. Set the PROGRAM, SRCLIB, COPYLIB and LOADLIB parameters to your personal Program-name, Source-Library, Copy-Library and Load-Library. 3. Find out the COBOL Compiler-Library prefix. COBOL Compiler libraries end with *.SIGYCOMP. Set COBPRFX(Cobol prefix)=prefix of the Compiler-Library. |
| COBOL Run Job | 1. Change the //JOB Card. 2. Set the PGMNAME and LOADLIB parameters to your personal Program-name and Load-Library respectively. |
| COBOL-DB2 Pre-compile, Compile and Link Job | 1. Change the //JOB Card. 2. Set the PROGRAM, DBRMLIB, SRCLIB, COPYLIB, DCLGEN and LOADLIB parameters to your personal Program-name, DBRM Library, Source-Library, Copy-Library, Declarations Library and Load-Library respectively. 3. Find out the COBOL Compiler-Library prefix. COBOL Compile Libraries end with *.SIGYCOMP. SET COBPRFX=prefix of the COBOL Compiler-Library. 4. Find out the Linker-Library Prefix. Linker Libraries generally end with *.SCEELKED. SET LNKPRFX=prefix of the Linker-Library. 5. Find out the DB2-Library prefix. DB2 Library-names follow the convention DSN*.SDSNLOAD. The prefix maybe DSN710, DSN810 or DSN910 depending on the DB2 Version at your shop. SET DB2PRFX=prefix of DB2-Library. |
| DB2 Bind Job | 1. Change the //JOB Card. 2. Set the PROGRAM, DBRMLIB and BINDLIB Parameters to you own Personal Program-name, DBRM Library and Bind-Cards Library. 3. Ensure that your BIND-card is stored in the correct BIND-Library. //SYSTSIN File points to the BIND-Card. |
| COBOL-DB2 Run Job | 1. Change the //JOB Card. 2. Set the LOADLIB and DBRMLIB Parameters to you own Load Library. and DBRM Library. 3. Ensure that your SYSTSIN card is correct. |
| IMS DBDGEN Job | 1. Change the //JOB Card. 2. Set the LOADLIB and DBRMLIB Parameters to you own Load Library. and DBRM Library. 3. Ensure that your SYSTSIN card is correct. |
LINES parameter - Indicating maximum amount of output to be printed to SYSOUT
| Question //HERC04A JOB A123,QUASAR,NOTIFY=&SYSUID Suppose you have the above job-card, that has several job-steps with a large output. You would like to issue a message to the operator, when the job output exceeds 500,000 lines. Which parameter should you add to the job-card to achieve this? a) NOTIFY=(500,LINES) b) MESSAGE=(LINELIMIT,500K) c) WARNING=(500000,LINECOUNT) d) SIGNAL=(LINES,500K) e) LINES=(500,WARNING) |
| A. When we want to indicate the maximum amount of output to be printed to SYSOUT dataset, we can use LINES parameter on the JOB card. The syntax of the LINES parameter is : LINES=nnnn or LINES=(nnn,action-to-be-taken) The maximum amount of output can be specified in thousands of lines. So, if you want to indicate that maximum amount of output from the Job is 500k lines, nnn should be 500. You can also specify, what action must be taken – whether you want to continue the job, cancel the Job(CANCEL), DUMP, or notify the operator(WARNING). Correct answer – LINES(500,WARNING) On the same lines, you can also indicate the maximum amount of output in terms of BYTES,CARDS or PAGES. |
NOT CATLGD 2 JCL Error – How to avoid it?
Question When attempting to run the above Batch JOB/JCL, NOT CATLGD 2 JCL error occurs for the ddname OUTFILE. What is a NOT CATLGD 2 JCL Error? How to eliminate NOT CATLGD 2 JCL Error for a particular dataset? |
| The NOT CATLGD 2 JCL Error mostly occurs, when the dataset in question already exists. Here, OUTFILE is trying to create a new dataset OUTFILE.TEST.DATA. So, probably this dataset already pre-exists and is cataloged. To ensure such errors don’t occurs, we must purge/delete datasets using IEFBR14. |
OUTPUT Statement – Changing default SYSOUT output to a remote location
| Question What is the OUTPUT JCL Statement? How do change the default destination of the SYSOUT output messages to a remote location? |
| A. When we would like to do some formatting/processing, on SYSOUT output datasets, we use a JCL Statement called OUTPUT. To specify the destination of the SYSOUT output dataset, as a remote location, we must code DEST parameter on the OUTPUT JCL Statement. //OUT1 OUTPUT DEFAULT=YES,DEST=RMT In the above example, the SYSOUT dataset output will be sent to the remote location RMT. Also, this will stand as the default. Apart from this, we can specify various options, we can print multiple copies of the output dataset, using COPIES parameter. Moreover, we can write OUTPUT statement at the job-level or step-level. To refer back to previous OUTPUT statement, we can use refer-back. Refer-back *.OUT1 - *.outname *.STEP01.OUT1 - *.stepname.outname |

