Top Banner
.© Nihilent 2004 JCL (Job Control Languag e)
93

Advanced JCL

Apr 08, 2015

Download

Documents

Arul Kumar
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Advanced JCL

.© Nihilent 2004

JCL (Job Control Language)

Page 2: Advanced JCL

.© Nihilent 2004

Contents.

1. DFSORT.

2. ICETOOL.

3. Access Method Services(AMS) for VSAM.

Page 3: Advanced JCL

.© Nihilent 2004

DFSORT

• What is DFSORT :- DFSORT is IBM’s high performance Sort, Merge, Copy and Reporting Product

• With DFSORT we can Sort, Merge and Copy Datasets.

DFSORT is a Powerful Product which can be used for

Simple tasks such as Sorting the records of a dataset in

Alphabetic order also for Complex task’s such as running a

Billing System

Page 4: Advanced JCL

.© Nihilent 2004

Invoking DFSORT :-• DFSORT can be invoked with the help of the JCL. Various

Steps required to Invoke DFSORT from JCL are as follows

– //JOBNAME JOB :- Signal the initiation of the job, JOB statement contains all normal parameters which are in normal JCL’s such as Accounting Information, Programmers name, Class, Msgclass etc

– //STEPNAME EXEC :- Signals the initiation of the Step, Tells Operating System which program is to be Executed. For DFSORT, Program to be Executed is SORT. EXEC Statement should look as

//STEPNAME EXEC PGM=SORT

Page 5: Advanced JCL

.© Nihilent 2004

– //SYSOUT DD :- Defines the Output dataset for messages

//SYSOUT DD SYSOUT=*

– //SORTIN DD :- Defines the input data set which is to be sorted

– //SORTWORK01 DD :- Defines the work storage for the Sort, for most of the Sort application we Require only one Work file

– //SORTOUT DD :- Defines the Output dataset. The Input file be Sorted and Sorted Output will be Written in the Output dataset Specified

Page 6: Advanced JCL

.© Nihilent 2004

– //SYSIN DD * :- This is the Important part of the JCL where Exact SORT CARDS Will be Written. SORT CARDS are control statements which specify various Parameters Such as on which fields Sorting is to be done, what is the Length of these fields etc, we will Discuss about various SORT CARDS in coming slides.

Page 7: Advanced JCL

.© Nihilent 2004

Complete JCL :-

//SORTJOB1 JOB ‘account-info’,prgmrs-name, //STEP1 EXEC PGM=SORT

//SYSOUT DD SYSOUT=*

//SORTIN DD DSN=‘INPUT.FILE’,DISP=SHR

//SORTWK01 DD DSN=‘WORK.FILE’,DISP=

//SORTOUT DD DSN=OUTPUT.FILE’DISP=OLD //SYSIN DD *

SORT FIELDS = (…………..)

/*

Page 8: Advanced JCL

.© Nihilent 2004

• What are Various functions of DFSORT:-

– Sorting Data Sets:- Sorting is Rearranging the records in either Ascending or Descending order

Sort card should look as

SORT FIELDS=( Starting Position of the field, Length of the field,Datatype of the fields,

Ascending or Descending order)

Page 9: Advanced JCL

.© Nihilent 2004

For example consider a file which stores information about all books in a book store, record structure is as follows.

NAME OF FIELD: BOOK NAME AUTHOR PRICE SPACE : 16 to 30 31 to 45 46 to 53

DATA TYPE : CH CH BI

If sorting of Records is Required to be done on the Single Field(e.g BOOK NAME) SORT CARD Should be

SORT FIELDS = (16,15,CH,A)

Ascending or DescendingData Type of the

FieldLength of the FieldStarting Position

of the Field

Page 10: Advanced JCL

.© Nihilent 2004

If the Sorting is required to be done on the Multiple fields(e.g. BOOK NAME and AUTHER) SORT CARD Should Look as

SORT FIELDS=(16,15,CH,D,31,15,CH,A)

All Four Parameters

for Field Book Name

All Four Parameters

for Field Author

Page 11: Advanced JCL

.© Nihilent 2004

– Merging the Datasets :- DFSORT can be used to Merge two or more file of Sorted records to form a single dataset or file

General Purpose of the MERGING is to Add more records of same type to the Existing Dataset. For Merging of Two Datasets they should have same Record length as Well as Same Record Format and more over the Records in Both Datasets Should be Sorted prior to Merge.

If we take same Record Structure as an Example if Two data sets with above record format are to be MERGED then SORT CARD Should look as

MERGE

FIELDS=( 16,15,A,31,15,A),FORMAT=CH For the

field Book Name

For the field

Author

Page 12: Advanced JCL

.© Nihilent 2004

– Copying the Datasets :- DFSORT Can be used for Copying

If the Data set is to be copied in to another dataset the SORT CARD Should be as

SORT FIELDS = COPY orMERGE FIELDS = COPY

– Tailoring the Input Data Set, Sorting, Merging or Copying only Required Fields :- Often We need To Copy or Merge only certain Records which will Satisfy Certain Condition. Depending on the Condition the Records can be Included as Well as Omitted in the Out put data set with help of Two commands INCLUDE and OMIT

Page 13: Advanced JCL

.© Nihilent 2004

INCLUDE Statement can be used to collect the Wanted Records OMIT Statement can be used to Exclude Unwanted records.e.g 1 Sorting the Records into the output file on BOOK NAME and which includes books whose BOOK NAME is Same as AUTHOR, Sort card should look as INCLUDE COND=(16,15,CH,EQ,31,15,CH)

SORT FIELDS=(16,15,CH,D)

e.g1 Sort card Copying all the records in to out put file Except Books whose PRICE is greater than 5000. OMIT COND=(46,10,BI,GT,5000)

SORT FIELDS=COPY

Page 14: Advanced JCL

.© Nihilent 2004

e.g 3 Merging Records of Two Data sets, whose PRICE is between 3000 and 10000.

INCLUDE COND=(46,10,BI,GT,2000,OR,46,10,BI,LT,10000)

MERGRE FIELDS=(16,15,CH,A)

so depending on Different types of Output different Sort cards can be written.

Page 15: Advanced JCL

.© Nihilent 2004

– Obtaining Sum of Certain Fields:- For Example we want to know SUM of the PRICE For the book’s Who's Author is ‘MIKE’, then Sort Card should look as

INCLUDE COND=(31,4,CH,EQ,C’MIKE’)SORT FIELDS=(31,15,CH,A)

SUM FIELDS=(46,10,BI)

The result will contain a Single row which is top most row of the Sorted fields including the condition mentioned in INCLUDE Statement, and the Price Fields will contain the Sum of prices of all books whose Author is ‘MIKE’

Page 16: Advanced JCL

.© Nihilent 2004

– Eliminating the Duplicate Records :- In the Output Sorted File if we want to Eliminate the Duplicate records(The Records which are Repeated) then SORT CARD Should be

SORT FIELDS=(16,15,CH,A)SUM FIELDS=NONE

The Out put File Consists of the Records which are Sorted on BOOK NAME and With out Duplicates.

Page 17: Advanced JCL

.© Nihilent 2004

Reformatting the Records:-• We can perform Following Options using INREC,OUTREC

and OUTFIL Statements– Delete Fields– Reorder Fields– Insert separators like Spaces,Strings etc– Convert the data in to Hexadecimal representation– Convert lower case Characters to Upper case, Upper case

to Lower case. – Editing the numeric values– Convert Numeric values from One format to another– Perform Arithmetic operations on numeric fields– Insert Sequence NumbersAnd many other things

Page 18: Advanced JCL

.© Nihilent 2004

• INREC:- Reformatting of the Records will be done Before Sorting or Merging or Copying of the Records done. i.e. operation’s are Performed on the Input file.

• OUTREC :- Reformatting of the Records will be done after the Sorting or Merging or Copying of the Records is done. i.e. Operation’s will be performed on the Output file.

• OUTFIL :- After Reformatting the Records the Out Put will be written in to Multiple Output data sets Depending on the condition Specified.

Page 19: Advanced JCL

.© Nihilent 2004

– DELETING certain Fields in the Output :- in the above file if we want on Two fields(for e.g. BOOK NAME and AUTHOR) in the Output file then SORT CARD should look as

SORT FIELDS=(16,15,CH,A)OUTREC FIELDS=(16,15,31,15)

Now in the Output file we will be having only Two columns they are BOOK NAME and AUTHOR.

Starting Position and Length of Field AUTHOR

Starting Position and Length of Field BOOK NAME

Page 20: Advanced JCL

.© Nihilent 2004

– Reordering the Fields :- If we want The AUTHOR Filed first and Filed BOOK NAME Next in the Output file then the SORT CARD should be

SORT FIELDS=(16,15,CH,A)

OUTREC FIELDS=(31,15,16,15)Starting Position and Length of Field BOOK NAME Starting Position and Length of Field AUTHOR

Page 21: Advanced JCL

.© Nihilent 2004

– Inserting a new field With initial value as Zeroes:- Suppose in the Above Example We want to Include a New field to Store Number of Books available, intially its value is Zeroes and Actual values will be filled in later Stags then SORT CARD should be

SORT FIELDS=(16,15,CH,A)

OUTREC FIELDS=(31,15,16,15,4,4Z)

Now in the Output file there will be a new field added after the Field BOOK NAME in which the initial value will be ‘0000’

Page 22: Advanced JCL

.© Nihilent 2004

– Inserting BLANKS :- To make Out Output file More readable we can add Blanks between fields. To insert n Blanks write nx between the fields in OUTREC of Sort card

SORT FIELDS=(16,15,CH,A)

OUTREC FIELDS=(20X,16,15,15X,31,15)

– After Execution there will be 20 blank spaces before first fields and 15 blanks between first field and Second field

Page 23: Advanced JCL

.© Nihilent 2004

– Editing Numeric Values :- Suppose that there is a 8 digit number with the value 98765430, as we can not include this number in the report as it will be difficult to read we should be edit this number some comma’s(,), Signs and other editing characters.

– There are Around 27 Predefined Edit masks named M0 to M26, which can be used to convert non Edited data in to the Edited form.

– As it is difficult to remember all the forms we can manually Edit the Numeric data.

– Now coming to our Example if we want to prepare a report which contains only book names and there Prices in Edited format Sort card should look as

Page 24: Advanced JCL

.© Nihilent 2004

SORT FIELDS =(16,15,CH,A)

OUTREC FIELDS=(5X,16,15,5X, 46,8,BI, EDIT=(SIII,III,TT.TT),SIGNS=(,-))

T :- if there is no value or it is a zero then Zero will be printed Else if there is Some value that value will be printed.

e.g if EDIT=(TTTT) is give and value is 4 then it will be printed as 0004 in the report.

I :- If there is no value Zero will not be inserted

e.g if EDIT=(IIII) is given and if the value in input file Is 0004 then it will be printed as 4.

S:- indicated the Sign.

SIGNS=(,-) Will Print – if the input value is negative and does space when it is Positive

Page 25: Advanced JCL

.© Nihilent 2004

– Preparing small report:- For example Output that is to be produced is formatted and should look as follows

BOOK NAME AUTHOR

BOOK NAME IS XYZ AUTHOR IS ABC

BOOK NAME IS CDE AUTHOR IS XYW

BOOK NAME IS COB AUTHOR IS ROY

BOOK NAME IS CIX AUTHOR IS MIKE

Page 26: Advanced JCL

.© Nihilent 2004

– The sort card should look as

SORT FIELDS=(16,15,CH,A)

OUTREC FIELDS=( 5X,C’BOOK NAME IS’16,15, 5X,C’AUTHOR IS’,31,15)

– After Execution the output will be in formatted way

BLANKSSTRING

STARTING PSTNLENGTH

Page 27: Advanced JCL

.© Nihilent 2004

• OUTFIL :- We can Create One or More Output data sets from a single Sorted, Merged or Copied Input, and this can be done with the Help of OUTFIL Statement. Following operations can be performed using OUTFIL Statement.

– Creating multiple Identical Copies :- Suppose we want to Take Multiple backup’s of a Dataset then OUTFIL will be used along with OPTION Command. Its SORT CARD should be as

OPTION COPY

OUTFIL FNAMES=(DDNMEFL1,DDNMEFL2,…)

– JCL Required is as following.

Page 28: Advanced JCL

.© Nihilent 2004

//COPY JOB …………

//STEP1 EXEC PGM=SORT

//SYSOUT DD SYSOUT=A

//SORTIN DD DSN=IN.PUT.FILE

//BACKUP1 DD DSN=OUT.PUT.FILE1

//BACKUP2 DD DSN=OUT.PUT.FILE2

//BACKUP3 DD DSN=OUT.PUT.FILE3

//SYSIN DD *

OPTION COPY

OUTFIL FNAMES=(BACKUP1,BACKUP2 ,

BACKUP3)

/*

Page 29: Advanced JCL

.© Nihilent 2004

– Selecting the Records in to Different files with STARTREC and ENDREC Options :- Suppose there are 15 records in a file, and u want to sort those records and store first 5 records in file1,next 5 in file2 and last 5 in file3. This can be done with the help of STARTREC and ENDREC options. Sort card should be as

SORT FIELDS=(16,15,CH,A)OUTFIL FNAMES=OUT1,ENDREC=5OUTFIL FNAMES=OUT2,STARTREC=6,

ENDREC=10OUTFILE FNAMES=OUT3,STARTREC=11,

ENDREC=15

Here OUT1,OUT2 and OUT3 are the DD Names of the Output Files Declared in the JCL

Page 30: Advanced JCL

.© Nihilent 2004

– Separating the Records in to different Out Put files Depending on the Condition :- If we want to include Some records which satisfy the Condition we will use INCLUDE Statement and If we wan to Exclude records satisfying the condition we use OMIT Statement.

– For example we want the Books Whose Author is MIKE in to File1, Books whose Author is STERN in to File2 and Books Whose Author is ROY in to File3 Sort card should be as follows.

Page 31: Advanced JCL

.© Nihilent 2004

SORT FIELDS=(16,15,CH,A)

OUTFILE=OUT1,INCLUDE=(31,15,CH,EQ,C’MIKE’) OUTFILE=OUT2,INCLUDE=(31,15,CH,EQ,C’STERN’)OUTFILE=OUT3,INCLUDE=(31,15,CH,EQ,C’ROY’)OUTFILE=OUT4,SAVE

after Execution of this statement File1 whose DD name is OUT1 will contain Books whose Author in MIKE, file2 contain books whose author is STERN File3 contains Books whose Author is ROY. And File4 whose DD name is OUT4 will contain all the remaining Books whose author is other than ‘MIKE’, ‘STERN’ and ‘ROY’.

Page 32: Advanced JCL

.© Nihilent 2004

– Repeating the Records:- If we want the records to be Repeated in Output files then we can use command REPEAT=n, Which repeats each record for n times.

– BUILD Command:- Build is another command which can be Used instead of INREC or OUTREC Statements. It does all the Functions performed by the INREC And OUTREC Statements.

For example We want Each Book name in the Output to be repeated for 3 times and there Seq numbers to be printed Sort card will be

SORT FIELDS=(16,15,CH,A)

OUTFIL FNAMES=OUT1,REPEAT=3, BUILD=(16,15,X,SEQNUM,4,ZD)

Page 33: Advanced JCL

.© Nihilent 2004

Now the Output in file1 after execution of the Sort will be

MIKE 0001

MIKE 0002

MIKE 0003

ROY 0004

ROY 0005

ROY 0006

Page 34: Advanced JCL

.© Nihilent 2004

– SPLIT :- Suppose if we don’t know number of records in a particular file but we want SPLIT the records of that file in to Three files then SORT CARD should be as

OPTION COPY

OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT

Page 35: Advanced JCL

.© Nihilent 2004

Generating Reports using OUTFIL:-• OUTFIL Option in the Sort card can be used to prepare very

Complex reports, using OUTFIL option we can prepare one or all the things to the Report being Prepared

– Report Header(Header at the top of Report)

– Section Header(Header at top of each Section)

– Page Header(Header at Top of the Page)

– Page Trailer(Trailer at the bottom page)

– Section Trailer(Trailer at end of each Section)

– Report Trailer(Trailer at the End of the Program)

Page 36: Advanced JCL

.© Nihilent 2004

• For performing all the Operation Listed above We will be using OUTFILE Along with various parameters such as BUILD, OUTREC, IFTHEN, HEADERn, TRAILERn, SECTIONS, LINES, NODETAIL And REMOVECC. We discussed some of these parameters previously and now we will discuss remaining parameters with Example.

• Reports may contains many elements such as Strings, Blanks, Time, Date, Edited Numeric Items etc.

• We will Discuss about Handling Various things like Data, Headers, Trailers etc While Preparing the Reports in coming Slides.

Page 37: Advanced JCL

.© Nihilent 2004

Handling Data While Generating Reports :-• Mainly DATA part of the Report will be Handled by the

OUTFIL parameter. We can Use INCLUDE, OMIT, OUTREC, INREC Statements and various OUTFIL Parameters Like STARTREC, ENDREC, INCLUDE, OMIT etc to Control the Data that is to Printed on the Reports.

• LINES :- LINES Is a parameter which is used to Maintain Number of lines to be printed per Page.– For example We want to Print a Report of the Complete

BOOKS file with 10 Records per single paper then the Sort card should look as

SORT FIELDS=COPY OUTFILE FNAMES=RPT1,LINES=10

After Execution of this Statement the Report will be Printed with 10 Records per page.

Page 38: Advanced JCL

.© Nihilent 2004

• For Reports OUTFIL Parameter Places ANSI Control Character on the Each output line to tell the Printer How many lines to be Printed per page.1 will be in First bite of the First records of each page to be printed.

• In our Example as we Want to print 10 records Per page 1 will be inserted on 1st Record and 11th Record, so that printer can Understand that Printing of Next set of Records will start from 11th Record.

Page 39: Advanced JCL

.© Nihilent 2004

HEADER’S :-• To make Data to look as Report It should have Headers and

Trailers.

• We can Add Page Headers with help of the Parameter HEADER2 and Report Header with the Help of Parameter HEADER1.

• In HEADER Parameter we will come across many other parameters like PAGE and DATE.

• We will first Know about Using HEADER2 i.e. Page Header and Later we will Know about HEADER1 Which is Report Header.

Page 40: Advanced JCL

.© Nihilent 2004

• Suppose The Report that should be produced by the sort should look as in Following

BOOK NAME

------------------

AUTHOR

--------------

PRICE

---------

REPORT OF BOOKS PAGE 1 11-26-2005

COBOL ROY 300 ORACLE STERN 500 CICS ROBERT 800

Page 41: Advanced JCL

.© Nihilent 2004

• To generate above Report the Sort Card Should Look as

SORT FIELDS=(16,15,CH,A)

OUTFIL FNAMES=RPT1,LINES=10

HEADER2=(/,3:’REPORT OF BOOKS’,

25:’page’,PAGE,40:DATE=(MD-),2/, 3:’BOOK NAME ’,20:’AUTHOR ‘,35:’PRICE ‘,/, 3:’---------------------’20:’---------------’,35:’------------’),

OUTREC=(3:16,15,X

20:31,14,X

35:46,6,PD,EDIT=(SIII,IIT),SIGNS=(,-))

Page 42: Advanced JCL

.© Nihilent 2004

• We will discuss about each parameter used in above SORT CARD.– SORT FIELDS:- This is normal one, that is all the

Records will be Sorted on the Order of the Book names.

– OUTFIL=RPT1,LINES=10 :- The Report Prodused my the Sort card is Driven to the Dataset whose DD name is RPT1, LINES=10 means that only 10 lines will allowed to be printed per single page.

– HEADER2:- There are many new parameters here

• / :- The symbol ‘/’ means that one line should be left blank same way ‘n/’ means that n lines should be left blank.

Page 43: Advanced JCL

.© Nihilent 2004

• 3:’REPORT OF BOOKS’ :- From the Third column of second line of every page the text ‘REPORT OF BOOKS’ will be printed.

• 25:’page’,PAGE :- From 25th Column of the Same Row text ‘page’ should be printed, PAGE which is a key word of 6 bytes gives the page number in Ascending order.

• DATE=(MD-) :- DATE is a key word which will give Current date and (MD-) is an EDIT MASK Which stores the Date in MM-DD-YYYY Format.

• Next is printing the Column names, the column name ‘BOOK NAME’ Starts from column 3, column name ‘AUTHOR’ Start from column 20 and column name ‘PRICE’ starts from column 35.

Page 44: Advanced JCL

.© Nihilent 2004

• After Column names are printed these names are Underlined, which is done with help of Next three Statements.

• With help of these Parameters the Page Header can be prepared which is

REPORT OF BOOKS PAGE 1 11-26-2005

BOOK NAME

------------------

AUTHOR

--------------

PRICE

---------

Page 45: Advanced JCL

.© Nihilent 2004

– Now remaining part is to insert the Data which will be done by the Parameter OUTREC.

– All the data is printed below each Column Name as the Column number from which each Column data should be Started is specified in the OUTREC parameter.

Page 46: Advanced JCL

.© Nihilent 2004

HEADER1:-• OUTFIL’s HEADER1 parameter is similar to HEADER2

Parameter.

• HEADER2 Parameter is Used to create Page Headers where as HEADER1 Parameter is used to Create the Report Header’s, such as Cover pages etc.

• Following HEADER1 Parameter can be added to the Previous OUTFIL Parameter which will print a single Cover page at the Beginning of the Report.

HEADER1=(20:’COVER SHEET FOR THE BOOKS AVAILABLE IN LIBRARY’,5/,

20:’PRINTED ON’,DATE)

Page 47: Advanced JCL

.© Nihilent 2004

TRAILERS :-• Similar to Header’s we can add Trailers to out report.

• Trailers are also of two types they are

– TRAILER1 (Report trailer)

– TRAILER2 (Page Trailer)

• Using this Trailers we can include many options which we are required to provide at end of each page or at the end of the Report such as

– Count of number of Records,

– Maximum of the Records,

– Average of the Records,

– Minimum of the Records,

– Sum of the Records.

Page 48: Advanced JCL

.© Nihilent 2004

• Suppose in Our Previous Example along with the Report we Want Following Trailer to be Printed

OVER ALL RESULT FOR BOOK AVAILABE IN LIBRARY ON MM-DD-YYYY

TOTOL NUMBER OF BOOKS = nn

AVERAGE COST OF THE BOOK = nn

LOWEST COST OF THE BOOK = nn

HIGHEST COSE OF THE BOOK = nn

Page 49: Advanced JCL

.© Nihilent 2004

• To include above Trailer in Report following Trailer Parameter should be included to the SORT CARD after the OUTREC ParameterTRAILER1=(2/, 3:’OVER ALL RESULTS FOR THE

BOOKS AVAILABE IN LIBRARY ON ’,DATE,3/,3:’TOTAL NUMBER OF BOOKS

=‘, COUNT,2/,3:’AVERAGE COST OF THE BOOK

=‘, AVG=(46,6,PD,LENGTH=+10),2/,

3:’LOWEST COST OF THE BOOK =‘, MIN=(46,6,PD,LENGTH=+10),2/’,

3:’HIGHEST COST OF THE BOOK =‘, MAX=(46,6,PD,LENGTH=+10))

Page 50: Advanced JCL

.© Nihilent 2004

• Thus by including HEADERS,TRAILERS, OUTFIL, OUTREC, and all other parameters we can prepare a Report which a Difficult task using the programming languages such as COBOL.

• Thus DFSORT Plays a vital Role in JCL for SORTING, COPYING, MERGING and PREPARING VERY COMPLEX REPORTS..

Page 51: Advanced JCL

.© Nihilent 2004

ICETOOL• IBM’s DFSORT Utility has been greatly Enhanced with

Addition of ICETOOL.

• i.e. we can say ICETOOL as an modified Version of DFSORT.

• ICETOOL is a multiple DFSORT Utility that uses the capability of DFSORT to perform Multiple Operations on one or more datasets.

• ICETOOL’s Display Command can also be sued to Prepare the Reports.

Page 52: Advanced JCL

.© Nihilent 2004

• OUTFIL parameter of DFSORT is also used for Preparing the Reports, The basic Difference in preparing Reports using OUTFILE(DFSORT) and DISPLAY(ICETOOL)

– Using OUTFIL parameter we are required to specify where Every piece of information in the Report is to be prepared but using ICETOOL Such effort is not needed, by keeping minimum efforts we can prepare complex Reports using ICETOOL’s DISPLAY parameter.

Page 53: Advanced JCL

.© Nihilent 2004

• Twelve ICETOOL Operations listed below can be used to perform variety of the Operation, by using various Combinations of these Operations many Complex tasks can be achieved.

– COPY :- Copies the Dataset to One or more Output datasets.

– COUNT :- Prints the Message containing the Number of records in the Dataset.

– DISPLAY :- Display command can be Used to Produce the Formatted Output, Same as OUTFIL parameter.

Page 54: Advanced JCL

.© Nihilent 2004

– MODE :- Three Modes of operation are possible which must be Set or Reset before performing group of operations in a Single Statement and they are

• STOP :- While performing a group of Operations if any error has Occurs, STOP parameter Stops further process of the Execution.

• CONTINUE :- In this mode Even if Any Error is Encountered the Execution will Continue.

• SCAN :- This parameter Checks if there is any error with out Executing Statements.

Page 55: Advanced JCL

.© Nihilent 2004

– OCCURS :- Prints the Specified Numeric or Character fields for Specified number of times in the Output Dataset.

– RANGE:- Prints the Values Which are in a specific Range Specified in to the Output dataset.

– SELECT :- Selects the Records from Input dataset for inclusion in Output data set based on Certain Condition’s Specified. E.g.. Only duplicate values or only Unique values etc.

– SORT :- Sort the Input dataset and Writes in to Output dataset.

– SPLICE :- Merging of two are more data sets with only Selected Fields in the Output dataset can be done by this Option.

Page 56: Advanced JCL

.© Nihilent 2004

– STATS :- Stats is a Predefined option of ICETOOL which will enable us to print MIN, MAX, AVERAGE and TOTAL of the Specified fields Automatically.

– UNIQUE :- Prints the Message of the Count of the Unique values(Non Repeated) values in the Input data set for Specific Field.

– VERIFY :- Examines the Decimal Values in the Input data set and Prints each message for non Correct Field.

• Above mentioned are the basic Twelve Commands in ICETOOL which can Be used Combined for Performing some Complex Tasks.

Page 57: Advanced JCL

.© Nihilent 2004

Complete JCL Required for ICETOOL :-

//JOB1 JOB NOTIFY=&SYSUID//TOOL EXEC PGM=ICETOOL//TOOLMSG DD SYSOUT=*//DFMSG DD SYSOUT=*//TOOLIN DD *

< ICETOOL STATEMENTS>/*//INPUT1 DD DSN=INPUT.FILE//OUTPUT DD DSN=OUTPUT.FILE //SORTCNTL DD *

SORT COMMANDS/* VARIOUS ADDITIONAL STATEMENTS GO HERE SUCH AS OTHER

CONTROL CARDS etc……..

Page 58: Advanced JCL

.© Nihilent 2004

• TOOLMSG :- This Defines the Output dataset for the ICETOOL messages.

• DFSMSG :- This Defines the Output dataset for the DFSORT Messages.

• TOOLIN DD * and /* :- Same as SORT CARD used in DFSORT we will be using this Statement where the ICETOOL statements will be written between TOOLIN DD * and /*.

• After these basic commands the input datasets, Output datasets and Various other control Cards Follow, we will discuss about various Tasks Done Using ICETOOL in Coming slide using the Same Example used For DFSORT in Previous Slides.

Page 59: Advanced JCL

.© Nihilent 2004

Operations that can be done with ICETOOL • Creating Identical Sorted Data :- We can use

ICETOOL to Create multiple Sorted Datasets. We can Create Max of 10 output data set Using a single Sort Operator. Jcl Required to do this as follows

//JOB1 JOB NOTIFY=&SYSUID//SORT1 EXEC PGM=ICETOOL//TOOLMSG DD SYSOUT=*//DFMSG DD SYSOUT=*//TOOLIN DD *

SORT FROM(BOOKS1) TO(OUT1,OUT2) USING(SRTD)/*//BOOKS1 DD DSN=INPUT.DATA.SET1

DD DSN=INPUT.DATA.SET2 //OUT1 DD DSN=OUTPUT.DATA.SET1//OUT2 DD DSN=OUTPUT.DATA.SET2//SRTDCNTL DD *

SORT FIELDS=(16,15,CH,A) INCLUDE COND=(31,4,CH,EQ,C’MIKE’)

/*

Page 60: Advanced JCL

.© Nihilent 2004

• In the Above JCL we have following statement between TOOLIN DD * and /*

SORT FROM(BOOKS1) TO(OUT1,OUT2) USING(SRTD)

• Following is Description of the Each Parameter used.– FROM :- Specifies the DD name of input data set– TO :- Specifies the DD name of Output data sets.– USING :- this Specifies First four characters of the DD

name where SORT control statements are written. First four character’s of this DD name can be any Four Characters but last four must be CNTL. This is mandatory.

– The another control card used is Similar to the one used in above slides for DFSORT. Using this records will be sorted on BOOK NAME in Ascending order.

Page 61: Advanced JCL

.© Nihilent 2004

• Printing the Statistics of the Numeric Fields :- If we want to know about the Various attributes of the Numeric fields in the Input dataset i.e. Sum of the Records, Max, Min value, Average value etc. then Control Statement is as follows

//TOOLIN DD *STATS FROM(INPUTDD) ON(46,8,BI)

/*• Complete Statistics of the Numeric Fields(Sum, Avg, Max,

Min) will be Routed to the TOOLMSG Which is Defines in our JCL.

• Additionally if we Specify another ON i.e. If stats are Required on Two fields we can do that by placing another ON in STATS.

Page 62: Advanced JCL

.© Nihilent 2004

• Counting the Values in RANGE :- For Example We want to know the Number of Books whose price is between 300 and 800, for accomplishing this task we will use the Parameter RANGE. Various Options used for comparision in this Parameter are – EQUAL: If we want to select the records which is equal

to the Value Specified. – NOTEQUAL: If we want to select the records which are

not equal to the Value Specified– LOWER : If we want to select the records which are Less

than the Value Specified– HIGHER : If we want to select the records which are

Greater than the Value Specified– HIGHER AND LOWER: We can use the combination

to know the count of records whose specified value is in Particular RANGE

Page 63: Advanced JCL

.© Nihilent 2004

• For Example we want to Know the Count of records Whose Cost is between 300 to 500 then the Control card will be as follows

RANGE FROM(INPUTDD) ON(46,8,BI) HIGHER(300) LOWER(500)

• After Execution of the above statement the Count will Driven to the TOOLMSG mentioned in the JCL

• Suppose we want to Know the count of the records whose price is equal to 500 the Range parameter should be coded as

RANGE FROM(INPUTDD) ON(46,8,BI) EQUAL(500)After Execution of this statement the Output will be Routed to the TOOLMSG.

Page 64: Advanced JCL

.© Nihilent 2004

• Preparing SMALL Reports :- Suppose we want to prepare a Report with the help of ICETOOL we will be Using The Parameter DISPLAY.

• We will be Using the Parameter LIST along with the Display Parameter which is Used for Specifying the Output Dataset.

• We will start with a small example in which we will print all the Fields of the Input file. The Control Statement should look as

DISPLAY FROM(INPUTDD) LIST(OUTDD) ON(16,15,CH) ON(31,15,CH) ON(46,8,BI)

• After the Execution the Data Set specified in the List will Consists of all the records of input file.

Page 65: Advanced JCL

.© Nihilent 2004

• By using Several Other Parameter’s of the Display Command we can prepare many verities of Report Formats we will discuss about various parameters of the Display Command.

• TITLE COMMANDS :- Title commands are the commands which will be printed on every page I.e we can assume them as Headers of the Report. Various Title commands are

TITLE : Used to print a small title at beginning of every page of the Report.

DATE :- used to print the Current Date.

PAGE :- Used to Print the page Number.

TIME :- Used to Print current Time on each Page.

• HEADINGS :- If we want to print the Heading of the Column’s then we we will use the Command HEADER.

Page 66: Advanced JCL

.© Nihilent 2004

• SPACING BETWEEN THE COLUMNS :- If we want to insert some Spaces Between the Columns then We will be Using the Command BETWEEN(n) Which inserts n spaces between each column in the Report.

• STATISTICS:- We can Use Commands which will give the Statistics of the Numeric fields, these commands are TOTAL, AVERAGE, MAXIMUM and MINIMUM

• Lines per Page:- We can Specify the Certain Number of Lines Can be printed in the Report Using the Command LINES.

• Above mentioned are the various commands used along with the ICETOOL to prepare the Reports. We will Deal with an Example which will use Of these commands to prepare the report.

Page 67: Advanced JCL

.© Nihilent 2004

• Suppose The Report that should be produced using ICETOOL should look as in Following

BOOK NAME

------------------

AUTHOR

--------------

PRICE

---------

REPORT OF BOOKS PAGE 1 11-26-2005

COBOL ROY 300 ORACLE STERN 500 CICS ROBERT 800 Total nnnnn

Average nnnnn

Lowest nnnnn

Highest nnnnn

Page 68: Advanced JCL

.© Nihilent 2004

• The Control card Required to Produce the Report is as following.

DISPLAY FROM(INPUTDD) LIST(OUTDD)

TITLE(‘REPORT OF BOOKS’) PAGE DATE -

HEADER(‘BOOK NAME’) HEADER(‘AUTHOR’)- HEADER(‘PRICE’)-

ON(15,16,CH,) ON(31,15,CH) ON(46,8,BI) BETWEEN(5)-

TOTAL(‘Total) AVERAGE(‘Average’)- MINIMUM(‘Minimum) MAXIMUM(‘Maximum’)

This is the sort card which will print the List.

Page 69: Advanced JCL

.© Nihilent 2004

• In the Above Control card there is a operator Used (-) this known as the Continuation Character which used to represent the Continuation of the Command to the Next line.

• This is the Same Report Which we Prepared Using DFSORT we can Observe the Ease of Preparing Report Using ICETOOL, the major Difference is Using ICETOOL we are not required to Concentrate on the Spacing Which will be automatically Done By ICETOOL.

Page 70: Advanced JCL

.© Nihilent 2004

Access Method Service(AMS) for VSAM• An Access Method provides a utility program to allow the

user to manage catalogs and datasets.

• These utilities are called Access Method Services (AMS).

• VSAM provides an AMS called IDCAMS. (IDC is a prefix given by IBM.)

• There are Two types of Access method Services Commands they are

– FUNCTIONAL :- There are Commands Used to Do actual Work Such as Creating a Cluster, Listing a Catalog etc.

– MODAL :- These commands Allow the Conditional Execution of Functional Commands.

Page 71: Advanced JCL

.© Nihilent 2004

IDCAMS :- • Following are the various Commands which can be Used

With IDCAMS utility.

– DEFINE :- This command is Used to Define Cluster, Alternate Index, GDG, Path, User Catalog etc.

– DELETE :- This Command is Used to Delete Cluster’s, Path, Alternate indexes, GDG’s etc.

– REPRO :- This command is Used for many applications such as, Taking Back Up of Vsam Catalog or Vsam Dataset or Non Vsam dataset, to convert Non Vsam Data set to Vsam data set etc.

– ALTER :- This command is Used to Alter the Attributes of the Data set which are Earlier defined by command DEFINE.

Page 72: Advanced JCL

.© Nihilent 2004

– BLDINDEX :- Builds the Alternate Indexes with help of Existing Datasets.

– LISTCAT :- Lists the Catalog Entries.

– VERIFY :- While Closing the Dataset if any error has Occurred, Verify Command can be Used to rectify the Problem.

Page 73: Advanced JCL

.© Nihilent 2004

Jcl Required to Invoke AMS Commands:- • Complete Jcl Required to Invoke AMS commands is as

Follows :-

//JOB1 JOB NOTIFY=&SYSUID

//JOBCAT DD DSN=A.B.C,DISP=SHR

//STEP1 EXEC PGM=IDCAMS

//STEPCAT DD DSN=X.Y.Z,DISP=SHR

//SYSPRINT DD SYSOUT=*

//SYSIN DD*

AMS COMMANDS ARE CODED HERE

/*

//

Page 74: Advanced JCL

.© Nihilent 2004

• In the JCL Given Above JOBCAT and STEPCAT are Optional, if both are Specified the JOBCAT will be Ignored .

• Remaining all the Parameters are Mandatary.

• The AMS commands are Written in the Control card I.e. between SYSYIN DD * and /*.

• Now we will Discuss about Command’s which can be used in AMS.

Page 75: Advanced JCL

.© Nihilent 2004

• DEFINE :- – CLUSTER :- Define Cluster is The Command Used to

Define VSAM Data sets, KSDS, ESDS, RRDS and LDS Syntax of DEFINE CLUSTER is as follows

DEFINE CLUSTER

[NAME (XIND.NLT.CLUSTER)

CYLINDER (5 1)

VOLUMES (WORK01)

RECORDSIZE (120 124)

KEYS (8 0)

INDEXED/NONINDEXED/NUMBERED/LINEAR]

DATA

[NAME(XIND.NLT.CLUSTER.DATA)

INDEX

[NAME(XIND.NLT.CLUSTER.INDEX

Page 76: Advanced JCL

.© Nihilent 2004

– In the Above Syntax INDEXED is Specified for KSDS, NONINDEXED is Specified for ESDS, NUMBERED is Specified for RRDS and LINEAR is Specified for LDS.

– INDEX Component will be present only for KSDS, RRDS and ESDS does not have INDEX component they contain Only DATA component.

– Recodsize(a , b) in this parameter if a = b then it is a fixed length record else it is a variables length record.

– KEYS(length , offset) in this parameter Offset is the Starting Position of the Key and it Starts from Zero not One.

Page 77: Advanced JCL

.© Nihilent 2004

– ALTERNATE INDEX(AIX) :- Define AIX is the Command used to Create an Alternate index to the Cluster.Syntax of Defining AIX is as followsDefine AIX -

(NAME (XIND.NLT.VSAM MARKS. AIX) - VOLUMES (WORK01) - RELATE (XIND.NLT.VSAM) - UPGRADE - CYLINDERS (51) - KEYS (810) - RECORDSIZE (124 124) - FREE SPACE (20 10) - NON UNIQUE KEY ) -DATA

(NAME (XIND.NLT.VSAM.MARKS.AIX.DATA)INDEX

(NAME (XIND.NLT.VSAM.MARKS.AIX.INDEX)

Page 78: Advanced JCL

.© Nihilent 2004

– Defining an AIX is same as Defining main Cluster Except there are Few Options Included

– RELATE specifies the Main Cluster for Which this alternate Index is to be Build.

– UNIQUE/ NON UNIQUE Specifies Whether the AIX allows the Duplicates or not.

– UPGRADE Command Specifies When The Base Cluster is Modifies Corresponding AIX Also need to be Modified or not.

Page 79: Advanced JCL

.© Nihilent 2004

– PATH :- Path is a Connection Between the Base index and Alternate Index. Syntax to Define Path is as follows

DEFINE PATH( NAME(PATH.NAME) -

PATHENTRY(AIX.NAME) -UPDATE)

– In PATHENTRY the Alternate Index Name Should be Specified.

– UPDATE in the above Syntax Specifies, when the Path is Opened then Base Cluster as well as AIX need to be Opened automatically.

Page 80: Advanced JCL

.© Nihilent 2004

– GDG (Generation Data Group) :- A Generation Data Group is a collection,or group,of cataloged data sets having the same name and related to one another chronologically. Each of these datasets is called a generation data set or,simply, a generation. Syntax of Creation of GDG is as Follows

DEFINE GDG

(NAME(GDG.NAME) -

LIMIT(n) -

EMPTY/NOEMPTY -

SCRATCH/NOSCRATCH -

TO(DATE) -

FOR(DAYS) -

)

Page 81: Advanced JCL

.© Nihilent 2004

– In the above Syntax LIMIT Specifies Maximum Number of Generations a GDG can Have, Default is 255.

– EMPTY means When the Maximum Generation is Reached all the Previous Generations need to be Deleted.

– If NOEMPTY is specified when the Maximum Generation’s is reached only the Last Version need to be deleted.

– If Scratch is Specified, The data set Which Is Deleted in above Step will be Deleted Physically else if NOSCRATCH is Specified it will be Deleted Logically.

Page 82: Advanced JCL

.© Nihilent 2004

• Apart from these Basic Commands there are many other Entries which we can Define Using DEFINE statement, but these are Used very rarely. Other Entries are

• SPACE

• PAGESPACE

• USERCATALOG

• MASTER CATALOG

• NONVSAM

• ALIAS

Page 83: Advanced JCL

.© Nihilent 2004

• DELETE :- Delete is another AMS command Which is Used To Delete the Entries such as Clusters, AIX, GDG, Path, Catalog’s, Alias etc. Syntax of Delete Command is as follows

DELETE

( ENTRY NAME -

ERASE/ NOERASE -

FORCE/ NOFORCE -

PURGE/ NOPURGE )

Page 84: Advanced JCL

.© Nihilent 2004

• In the Above Mentioned Syntax ERASE / NOERASE Means whether the Data Component of Cluster or AIX which is Deleted is to be Deleted Physically or not.

• FORCE Enables u to Delete the GDG’s or other Datasets Even if they Contain Some Data, NOFORCE will not Enable you to delete the entries when

• PURGE Specifies That Entries are To be Deleted Even If the Retention Period is not Reached, NOPURGE will not Delete the Datasets if Retention Period is not Completed.

Page 85: Advanced JCL

.© Nihilent 2004

• ALTER :- ALTER is the Command Which is Used to Alter the Attributes of a Previous Defined Entry.

• Attributes that can be altered are ADDVOLUME , ATTEMPTS, AUTHORIZATION, BIND, BUFFERSPACE, CODE, CONTROLPW, CYLINDERFAULT, DESTAGEWAIT, EMPTY, ERASE , EXCEPTIONEXIT, FOR, FREEESPACE, INHIBIT, KEYS, ASTERPW, NEWNAME, NODESTAGEWAIT, NOEMPTY, OERASE, NONUNIQUEKEY, NOSCRATCH, NOUPDATE, NOUPGRADE, NOWRITECHECK, NULLIFY, AUTHORIZATION, CODE

• Above Mentioned are Various parameters Which can Be Altered.

Page 86: Advanced JCL

.© Nihilent 2004

• BLDINDEX :- Build Index is the Basic Command Used To build Alternate Index From already Define Base Cluster. Syntax is as Follows

BLDINDEX INFILE(INDDNAME) –

OUTFILE(OUTDDNME)

• In above Syntax INDDNAME is the DD name Of The Input file and OUTDDNME is the DD name of the OUTPUT file.

• For Executing the BLDINDEX two work files namely IDCUT1 and IDCUT2 are required to be Defined in the JCL.

Page 87: Advanced JCL

.© Nihilent 2004

• EXPORT :- Export Command Export’s the VSAM data Set or Its Alternate Index. Or We may say Export Command is Used for Back Up, this Back Up copy is Later Recovered Using the Import Statement.

• The Copy Which is Taken as Back Up can Not be Used Until it is Imported again.

• Along with the Data Catalog Information is also Exported.

• It can be used with the Combination of Import statement to Port it to other Systems.

• Another Disadvantage is it is Slow.

Page 88: Advanced JCL

.© Nihilent 2004

• Syntax of Export command is as Follows

EXPORT ENTRY-NAME -

OUTFILE(OUTDD) -

INHIBITSOURCE/ NOINHIBITSOURCE -

INHIBITTARGET/ NOINHIBITTARGET -

TEMPORARY/ PERMANENT • INHIBITSOURCE Specifies that the Source object in the

original System can not be Accessed for Any Operation Except Retrieval on Contrary NOINHIBITSOURCE Specifies the Source object in the Original Syatem can be Accessed for any Operations.

Page 89: Advanced JCL

.© Nihilent 2004

• INHIBITTARGET Specifies that the Target object Which is Imported can Not be Accessible for other operations Except for Retrieval. Contrary to this NO INHIBITTARGET Specifies that Target Object which is Imported can be accessed by any Operation.

• TEMPORARY Specifies that Cluster or Alternate Index which is Exported from the Source System need not to be deleted instead marked as Temporary to indicate that the Duplicate of this Exists.

• PERMANENT Specifies that Cluster or Alternate Index Which is Exported Should be Deleted from the Source System.if the Retention period is not Over we are Required to code Purge Command along with this Command.

Page 90: Advanced JCL

.© Nihilent 2004

• IMPORT :- Import command is Used to Restore the Vsam dataset or AIX which Is Exported from Source System into the Target System.Syntax of the IMPORT Command is as follows

IMPORT -

INFILE(INDD) -

OUTFILE(OUTDD) -• INFILE In the Syntax is the temporary Storage on which the

Data Set from Source System Was Exported.

• OUTFILE is the Target VSAM dataset’s DD name.

Page 91: Advanced JCL

.© Nihilent 2004

• REPRO :- Repro is the Command which is Used to Copy Vsam or non Vsam datasets, Clusters and Alternate Indexes, But it is Not Possible to Copy Complete PDS as Repro Can not Copy the Directly Information Which is Done by Using Export command.

• Repro Provides Us the Facility to Copy A Certain number of records Which can be Done by various parameters. Various other commands that can be used along with Repro are

– SKIP : To skip Particular Number of Records.

– COUNT: Copy Particular Count of records

Page 92: Advanced JCL

.© Nihilent 2004

– From Address, To Address :- if we know the Internal Address the We can use this command to select the Records

– From Number, To Number : As We know from DFSORT that each record internally given a record number starting from 1 to the first records, we can use this number to Copy particular Records. Syntax of Repro is as follows

REPRO -

INFILE(INDD) -

OUTFILE(OUTDD) -

SHIP(n) -

COUNT(n) -

Page 93: Advanced JCL

.© Nihilent 2004

• VERIFY :- Suppose While Closing the Dataset If there has an Error Occurred we Will use Verify command to rectify that Error. Syntax of Verify Command is

VERIFY FILE(DDNAME)