75640653 mainframe testing
TRANSCRIPT
-
8/12/2019 75640653 Mainframe Testing
1/186
Mainframe Testing
C3: Protected
-
8/12/2019 75640653 Mainframe Testing
2/186
2007, Cognizant Technology Solutions Confidential 2
About the Author
Created By: Mainframe CoE
CredentialInformation:
Version andDate:
ST/PPT/0907/1.0
-
8/12/2019 75640653 Mainframe Testing
3/186
2007, Cognizant Technology Solutions Confidential 3
Icons Used
Questions
Contacts
Reference
Demonstration
Hands onExercise
CodingStandards
Test YourUnderstanding
Tools
A WelcomeBreak
-
8/12/2019 75640653 Mainframe Testing
4/186
TSO/ISPF
C3: Protected
-
8/12/2019 75640653 Mainframe Testing
5/186
2007, Cognizant Technology Solutions Confidential 5
TSO/ISPF: Overview
TSO:
Time Sharing Option (TSO) is a subsystem that runs on the MVS
(Multiple Virtual Storage) operating system on an OS390 machine. This
subsystem allows users to interactively work with the system.
ISPF/PDF:
The Interactive System Productivity Facility (ISPF) and its Program
Development Facility (ISPF/PDF) work together with TSO/E to provide
panels (screens) with which users can interact. ISPF provides the
underlying dialog management service that displays panels and enables
a user to navigate through the panels.
-
8/12/2019 75640653 Mainframe Testing
6/186
2007, Cognizant Technology Solutions Confidential 6
ISPF: Features
The following are the salient features of the ISPF:
Provides an on-line environment to interact with MVS.
Provides Menu driven interface operation as opposed to TSO, which providesline mode only.
Provides facilities for Editing and Browsing data sets.
ISPF uses panels to display and receive information, and allows customizationof your ISPF environment.
Provides Program Function keys to avoid manual typing of commands.
Provides for easy management of datasets through the Dataset menu.
Provides extensive facilities for comparing datasets and searching for data.
Provides facilities for executing programs in batch or foreground.
Provides for debugging of advanced user written ISPF applications.
Provides advanced facilities to Create, Delete and Display VSAM datasets.
A GUI (Graphical User Interface) to allow a Client/Server Interface between anISPF Client at a workstation and a host TSO/ISPF session.
-
8/12/2019 75640653 Mainframe Testing
7/186
2007, Cognizant Technology Solutions Confidential 7
Datasets
Files in mainframes are referred as dataset. They are of two types:
PS (Physical Sequential): PS files are flat files, similar to normal text files in
windows.
PDS (Partitioned DataSet): PDS files contains members in it, each member is similar
to a PS. It is similar to a directory in windows with text files inside it.
-
8/12/2019 75640653 Mainframe Testing
8/186
-
8/12/2019 75640653 Mainframe Testing
9/186
2007, Cognizant Technology Solutions Confidential 9
Authentication screen
------------------------------- TSO/E LOGON -----------------------------------
Enter LOGON parameters below: RACF LOGON parameters:
Userid ===> USERID
Password ===> New Password ===>
Procedure ===> IKJUSER Group Ident ===>
Acct Nmbr ===> TLGACCT#
Size ===>
Perform ===>
Command ===>
Enter an 'S' before each option desired below:-Nomail -Nonotice -Reconnect -OIDcard
PF1/PF13 ==> Help PF3/PF15 ==> Logoff PA1 ==> Attention PA2 ==> ReshowYou may request specific help information by entering a '?' in any entry field
-
8/12/2019 75640653 Mainframe Testing
10/186
2007, Cognizant Technology Solutions Confidential 10
ISPF Main Menu
----------------------- ISPF/PDF PRIMARY OPTION MENU ----------------
OPTION ===>USERID -
0 ISPF PARMS - Specify terminal and user parameters DATE - 1 BROWSE - Display source data or output listings TIME - 2 EDIT - Create or change source data3 UTILITIES - Perform utility functions4 FOREGROUND - Invoke language processors in foreground5 BATCH - Submit job for language processing6 COMMAND - Enter TSO command or CLIST7 DIALOG TEST - Perform dialog testing8 DB2 - Perform DATABASE 2 Interactive Functions9 MQSeries - Websphere MQ Interactive FunctionsTS TOOLS - ToolsSD SDSF - SDSF PanelT TUTORIAL - Display information about ISPF/PDFD DEBUG TOOL - Debug Tool Utility FunctionsCC CCCA - COBAL CICS Conversion Aid
X EXIT - Terminate ISPF using log and list defaults
Enter END command to terminate ISPF.
-
8/12/2019 75640653 Mainframe Testing
11/186
2007, Cognizant Technology Solutions Confidential 11
Utility Menu
Menu Help
------------------------------------------------------------------------------Utility Selection Panel
Option ===>
1 Library Compress or print data set. Print index listing. Print,rename, delete, browse, edit or view members
2 Data Set Allocate, rename, delete, catalog, uncatalog, or displayinformation of an entire data set
3 Move/Copy Move, or copy members or data sets4 Dslist Print or display (to process) list of data set names.
Print or display VTOC information5 Reset Reset statistics for members of ISPF library6 Hardcopy Initiate hardcopy output7 Transfer Download ISPF Client/Server or Transfer data set8 Outlist Display, delete, or print held job output9 Commands Create/change an application command table11 Format Format definition for formatted data Edit/Browse
12 SuperC Compare data sets (Standard Dialog)13 SuperCE Compare data sets Extended (Extended Dialog)14 Search-For Search data sets for strings of data (Standard Dialog)15 Search-ForE Search data sets for strings of data Extended (Extended Dialog)
-
8/12/2019 75640653 Mainframe Testing
12/186
2007, Cognizant Technology Solutions Confidential 12
Utility Options
Option 2 from the utilities menu (or) 3.2 from the ISPF mainmenu helps usto allocate, delete and rename datasets, both PDS and PS.
Option 3 from the utilities menu (or) 3.3 from the ISPF mainmenu helps usto move or copy datasets.
Option 4 from the utilities menu (or) 3.4 from the ISPF mainmenu helps usto print or display datasets.
-
8/12/2019 75640653 Mainframe Testing
13/186
2007, Cognizant Technology Solutions Confidential 13
Dataset Allocation
Menu RefList Utilities Help
Data Set UtilityOption ===>
A Allocate new data set C Catalog data setR Rename entire data set U Uncatalog data setD Delete entire data set S Short data set information
blank Data set information V VSAM Utilities
ISPF Library:Project . .Group . . .Type . . . .
Other Partitioned, Sequential or VSAM Data Set:Data Set Name . . .Volume Serial . . . (If not cataloged, required for option "C")
Data Set Password . . (If password protected)
-
8/12/2019 75640653 Mainframe Testing
14/186
2007, Cognizant Technology Solutions Confidential 14
Dataset Allocation (Contd)
Menu RefList Utilities Help
Allocate New Data SetCommand ===>
More: +Data Set Name . . . :
Management class . . . (Blank for default management class)Storage class . . . . (Blank for default storage class)Volume serial . . . . (Blank for system default volume) **Device type . . . . . (Generic unit or device address) **Data class . . . . . . (Blank for default data class)Space units . . . . . (BLKS, TRKS, CYLS, KB, MB, BYTES
or RECORDS)Average record unit (M, K, or U)Primary quantity . . (In above units)Secondary quantity (In above units)Directory blocks . . (Zero for sequential data set) *
Record format . . . .Record length . . . .Block size . . . . .Data set name type : (LIBRARY, HFS, PDS, or blank) *
(YY/MM/DD, YYYY/MM/DDExpiration date . . . YY.DDD, YYYY.DDD in Julian form
-
8/12/2019 75640653 Mainframe Testing
15/186
2007, Cognizant Technology Solutions Confidential 15
Field Description
Management Class TSO tries to acquire management-related information (migration, backup,
retention criteria etc) from the Management Class for default datasetinformation and allocates the dataset.
Storage Class Used to obtain the storage-related information (volume serial) for the data set
allocation.
Data class Used to obtain the data-related information (space units, primary quantity,
secondary quantity, directory block, record format, record length, and data setname type) for the allocation of the data set.
Primary Quantity The amount of space allocated for the dataset.
Secondary Quantity Used to allocate additional space to the dataset when the space allocated in the
primary allocation is insufficient.
-
8/12/2019 75640653 Mainframe Testing
16/186
2007, Cognizant Technology Solutions Confidential 16
Field Description (Contd)
Directory blocks The value in this field determines the number of members in a PDS. A
positive value in this field denotes that the dataset is a PDS and a 0denotes that the dataset is a PS.
Record Format
The value in this field determines the format of the PDS or PS beingallocated.
Record Length The value of the length of the records stored in the dataset.
Block Size The block size, also called physical record length, of the blocks to be
stored in the data set. Use this field to specify how many bytes of datato put into each block, based on the record length.
-
8/12/2019 75640653 Mainframe Testing
17/186
2007, Cognizant Technology Solutions Confidential 17
Line Commands
After you create & display a data set list, you can enter a line command tothe left of the data set name. The most frequently used line commands are:
V View Data Set
E Edit Data Set B Browse Data Set
C Catalog Data Set D Delete Data Set
R Rename Data Set I Data Set Information
Z Compress Data Set CO Copy
MO Move X Exclude Data Set
NX Unexclude Data Set
-
8/12/2019 75640653 Mainframe Testing
18/186
2007, Cognizant Technology Solutions Confidential 18
Primary Commands
Following are the list of frequently used primary commands. For moredetails on these commands and an exhaustive list, refer to the ISPF manualon the IBM bookshelf.
SORT Sorts the list of data sets by the specified field.
SAVE Writes the data set list to the ISPF list data set or to a sequentialdataset
RESET Redisplays excluded data sets and removes line commands.
FIND Finds a string within the data set name
EXCLUDEExcludes a line containing a string within the data set name.
DSLSET Displays the data set list settings panel REFRESHRefreshes the displayed list with any changes that have occurred.
-
8/12/2019 75640653 Mainframe Testing
19/186
2007, Cognizant Technology Solutions Confidential 19
Scrolling
Valid values on the scrollfield and their properties are :
CSR Specifies that the screen will scroll depending on the cursorposition
PAGE Specifies that the screen will always scroll page by page
HALF Specifies that the screen will always scroll by half a page
DATA Similar to PAGE, but will scroll by one line
nnn Specifies that the cursor will always scroll by thespecified number of lines, irrespective of the cursorposition. (nnn represents a number)
-
8/12/2019 75640653 Mainframe Testing
20/186
2007, Cognizant Technology Solutions Confidential 20
Basic Line Commands
A single blank line is inserted with an Iin column 1. IF you want to insert multiple blank lines, type In (where n is the number of
lines required) in the first column and press ENTER.
Enter D in the first column to delete a single line.
If you know the exact number of lines to be deleted, use Dn (Where n is thenumber of lines to be deleted).
A block of lines can be deleted by placing the lines to be deleted between a pairof DD commands. Place a DD on the first line of the block and a DD on the lastline of the block and press ENTER. This deletes all the lines between the DDs
-
8/12/2019 75640653 Mainframe Testing
21/186
2007, Cognizant Technology Solutions Confidential 21
Move/Copy Commands
The copy and move commands are similar in execution but for the fact thatthe Copy command retains the original content but Move remove thecontent from its original location.
To copy a single line from one location to another, place a C in the first
column on the line to be copied and an A on the line previous to the linewhere you want the data to be placed and press ENTER. Placing a Binstead of A, copies the information before the line. A combination of CCand A/B does the same for a block of lines. Use M and MM with A/Bsimilarly to move the data.
-
8/12/2019 75640653 Mainframe Testing
22/186
2007, Cognizant Technology Solutions Confidential 22
Commands
Text handling Commands LClowercase, to change text from uppercase to lowercase .
UCuppercase, to change text from lowercase to uppercase.
Exclude/Show Commands
Use X or XX to exclude one or more lines of data from being displayed on the
screen.
X identifies a line to be excluded.
X5
identifies the first of 5 (or any number of) lines to be excluded. XXidentifies the first and last lines of a block of lines to be excluded.
(Usage is like Block copying)
-
8/12/2019 75640653 Mainframe Testing
23/186
2007, Cognizant Technology Solutions Confidential 23
SuperCE Compare
Super Compare Extended abbreviated to SuperCE is a versatile tool that
helps us to compare PS datasets, complete PDS, members of PDS or
concatenated datasets.
Option 12 in the Utilities Menu is a simple compare utility and option 13
from the Utilities Menu is the extended compare utility.
-
8/12/2019 75640653 Mainframe Testing
24/186
2007, Cognizant Technology Solutions Confidential 24
SuperCE Compare (Cont.)
Datasets can be compared in the following four ways:
File Comparison Checks source datasets and lists the difference.Simplest and fastest method
Line Comparison Checks the differences at the line level. The output
list contains reformatted lines and changed lines.Most frequently used comparison type andtypically used for the source change compares
Word Comparison Checks the differences at the word level. A wordis a string separated by one or more blanks or aline separator.
Byte Comparison Byte level comparison with the output in HEX(Like a dump).
-
8/12/2019 75640653 Mainframe Testing
25/186
2007, Cognizant Technology Solutions Confidential 25
SuperCE Compare (Cont.)
The Compare output can be listed in the following five ways
OVSUMLists the Overall Summary of the changes. In case of PDS comparisonthe list contains a summary for each member compared
Delta Frequently used Listing type. Lists the differences and the summary
of each dataset compared. Differences are flagged at the left of eachline of output.
CHNG Lists the differences with a specified number of lines before and afterthe changes. Makes the user comfortable in reading the output incase of a PDS comparison involving source changes.
Long Lists the complete new data set with the old data set deleted data
Interspersed in the output listing. Both inserted and deleted outputdata is flagged. The format is the same as the DELTA with all matchingdata shown.
Nolist Generates no listing output. Used to quickly find if any data ischanged between two datasets.
-
8/12/2019 75640653 Mainframe Testing
26/186
2007, Cognizant Technology Solutions Confidential 26
Search-For Utility
This option is used to search for a particular string in a dataset or membersof a PDS
Option 3.14 from the main menu (or) 14 from the Utilities Menu takes youto the appropriate panel.
The search string can optionally be followed by one of the followingkeywords:
WORD Lists full word occurrences of the string
PREFIX Lists only if the string is a prefix to a word.
SUFFIX Lists only if the string is a suffix to a word.
-
8/12/2019 75640653 Mainframe Testing
27/186
2007, Cognizant Technology Solutions Confidential 27
Q & A
Questions from participants
-
8/12/2019 75640653 Mainframe Testing
28/186
2007, Cognizant Technology Solutions Confidential 28
Test Your Understanding
1. What is TSO?
2. Which option is used to allocate the new dataset?
3. What is the use of Option 3.3?
4. Which command helps you to replace a particular text in a dataset?
-
8/12/2019 75640653 Mainframe Testing
29/186
JCL
C3: Protected
-
8/12/2019 75640653 Mainframe Testing
30/186
2007, Cognizant Technology Solutions Confidential 30
Job Control Language
It consists of control statements that:
introduce a computer job to the operating system
request hardware devices
direct the operating system on what is to be done in terms of running
applications and scheduling resources
-
8/12/2019 75640653 Mainframe Testing
31/186
2007, Cognizant Technology Solutions Confidential 31
Sending Information to Computer
Interactive Processing
It means that you give the computer a command and the computer responds to
your command request. It is more like a conversation.
Batch Processing
It means that you give the computer a whole group of commands, usually in the
form of some sort of program you have written, and have the computer process
this group of commands. It is more like writing a letter.
In mainframes JCL is used for batch processing.
-
8/12/2019 75640653 Mainframe Testing
32/186
2007, Cognizant Technology Solutions Confidential 32
Basic Syntax
JCL should follow the below syntax Name field- identifies the statement so that other statements or the system can
refer to it. The name field must begin immediately after the second slash. It can
range from 1 to 8 characters in length, and can contain any alphanumeric (A to
Z) or national (@ $ #) characters.
Operation field- specifies the type of statement: JOB, EXEC, DD, or an operand
command.
Operand field - contains parameters separated by commas. Parameters are
composites of prescribed words (keywords) and variables for which
information must be substituted. Comments field- optional. Comments can be extended through column 80, and
can only be coded if there is an operand field.
-
8/12/2019 75640653 Mainframe Testing
33/186
2007, Cognizant Technology Solutions Confidential 33
General Rules
Must begin with // (except for the /* statement) in columns 1 and 2
Is case-sensitive (lower-case is not permitted)
NAME field is optional
NAME field should begin in column 3 if used
If NAME field is omitted code one or more blanks OPERATION field must begin on or before column 16
OPERANDS must end before column 72
OPERANDS are separated by commas
All fields, except for the operands, must be separated by one blank
-
8/12/2019 75640653 Mainframe Testing
34/186
2007, Cognizant Technology Solutions Confidential 34
Types of JCL statements
There are three types of JCL statements. They are:
JOBIdentifies the beginning of a job
EXECIndicates what work is to be done
DD Data Definition, i.e., identifies what resources (datasets) are needed andwhere to find them
-
8/12/2019 75640653 Mainframe Testing
35/186
2007, Cognizant Technology Solutions Confidential 35
The Job Statement
The JOB statement informs the operating system of the start of a job, givesthe necessary accounting information, and supplies run parameters. Eachjob must begin with a single JOB statement .
The various fields in the job statement are:
//jobname JOB USER=userid, TIME=m,MSGCLASS=class, NOTIFY=userid
Jobname A descriptive name assigned to the job by the user
JOB Keyword that indicates the beginning of a job Userid It is 1 to 7 character user identification assigned to access
the system TIME Total minutes allowed for a job to execute MSGCLASSDescribes where the output of a job log should be directed
NOTIFY User-id of the user who receives a TSO message upon completionof the job
h
-
8/12/2019 75640653 Mainframe Testing
36/186
2007, Cognizant Technology Solutions Confidential 36
The EXEC Statement
The EXEC (execute) statement is used to identify the application programor cataloged procedure or in-stream procedure that this job is to executeand to tell the system how to process the job.
The syntax of EXEC statement is:
//stepname EXEC procedure
(Or)
//stepname EXEC PGM=program
stepname An optional 1 to 8 character word used to identify the step
EXEC Keyword that indicates you want to invoke a program orcataloged procedure
procedure Name of the cataloged procedure to be executed
program Name of the program to be executed
f ( )
-
8/12/2019 75640653 Mainframe Testing
37/186
2007, Cognizant Technology Solutions Confidential 37
Data Definition (DD) Statement
A DD (Data Definition) statement must be included after the EXECstatement for each data set used in the step.
The DD statement gives the data set name, I/O unit, perhaps a specificvolume to use, and the data set disposition.
The DD statement may also give the system various information about thedata set: its organization, record length, blocking, and so on.
The syntax for DD statement is:
//ddname DD operand1,operand2,etc.
where ddname - a 1 to 8 character name given to the DD statement
DD - DD statement identifieror keyword
operand - parameters used to define the input or output dataset
f ( ) ( )
-
8/12/2019 75640653 Mainframe Testing
38/186
2007, Cognizant Technology Solutions Confidential 38
Data Definition (DD) Statement (Cont...)
An eg. Of Data Definition is like this:
//ddname DD UNIT=unittype,
// DSN=userid.datasetname,// DISP=(beginning,normal-end,abnormal-end),// SPACE=(TRK,(primary,secondary,directory)),
// RECFM=xx,LRECL=yy,MGMTCLAS=retainx
i i i ( )
-
8/12/2019 75640653 Mainframe Testing
39/186
2007, Cognizant Technology Solutions Confidential 39
Disposition (DISP) Parameters
The DISP parameter describes the current status of the data set (old, new,or to be modified).
Directs the system on the disposition of the dataset (pass, keep, catalog,uncatalog, or delete) either at the end of the step or if the step abnormally
terminates.
DISP is always required unless the data set is created and deleted in thesame step.
B i i Di i i
-
8/12/2019 75640653 Mainframe Testing
40/186
2007, Cognizant Technology Solutions Confidential 40
Beginning Dispositions
The various beginning disposition parameters are: NEWcreates a new data set
OLDdesignates an existing data set; it can be an input data set or an output data
set to rewrite
SHRidentical to OLD except that several jobs may read from the data set at the
same time.
MODmodifies a sequential data set - positions the pointer at the end of the data
set in order to add new data to the data set.
l d b l i i i i i
-
8/12/2019 75640653 Mainframe Testing
41/186
2007, Cognizant Technology Solutions Confidential 41
Normal and Abnormal termination Dispositions
Normal disposition, the second term in the DISP parameter, indicates thedisposition of the data set when the data set is closed or when the job terminates
normally.
The abnormal dispositions, is effective only if the step abnormally terminates,
parameters are the same as normal dispositions except that PASS is not allowed.
The various parameters are:
PASSpasses the data set on to subsequent job steps, and each step can use the data set
once.
KEEPkeeps non-temporary data sets.
DELETEdeletes data sets.
CATLGcatalogs a non-temporary data set. CATLG is similar to KEEP except that the unit
and volume of the data set are recorded in the catalog along with the data set name.
UNCATLGun-catalogs a data set. UNCATLG is the same as KEEP except that the data set
name is removed from the catalog.
S
-
8/12/2019 75640653 Mainframe Testing
42/186
2007, Cognizant Technology Solutions Confidential 42
Space parameter
All new data sets on disk volumes must be allocated space. Storage on diskvolumes can be allocated in units of blocks, cylinders, tracks, kilobytes, andbytes.
The space may be requested as a primary and a secondary quantity. Theprimary quantity is allocated when the data set is opened with adisposition of NEW. The secondary quantity is allocated if the primary
quantity is exceeded. The syntax for space parameter is:
// SPACE=(TRK,(primary,secondary,directory))
where
primary Allocates this amount of space initially
secondaryAllocates this amount of space each time more is needed (up to 15times)
directory reserve this amount of blocks to keep the directory of a partitioneddataset (NOT USED for a sequential dataset).1 directory block allows 5members in a partitioned dataset
D A ib
-
8/12/2019 75640653 Mainframe Testing
43/186
2007, Cognizant Technology Solutions Confidential 43
Dataset Attributes
Data Set attributes are: RECFM=xxspecifies the record format. The format can be one or more of the
following characters:
F fixed-length
V variable-length
U
undefined-length
FB fixed and blocked
FBA fixed, blocked, with ANSI carriage control characters
VB variable and blocked
VBA variable, blocked, with ANSI carriage control characters
LRECL=yy specifies the length of records BLKSIZE=zzspecifies the blocksize, this denotes the number of records read in
a single read operation
-
8/12/2019 75640653 Mainframe Testing
44/186
2007, Cognizant Technology Solutions Confidential 44
JCL BEND CODES ABEND is the acronym of ABnormalEND. This is similar to run-time exceptions in
windows platform. JCL ABEND codes are:
S0CBAttempting to divide by 0 and not using ON SIZE ERROR S002Very large record length/ wrong record length S222The job was cancelled (by subsystem or operator) because it
violated some restriction
S522
JOB or TSO session exceeded maximum job wait time ORoperator did not mount the require tape within allowed time limit S806Load module not found S837Space problem, Allotted space is not enough for data set S913You are trying to access a dataset which you are not
authorized to use. SOC71. Moving non-numeric value to numeric field
2. Not initializing the numeric variables before first use SOC41. Index exceeds the size of table
2. Trying to use File Section variables without opening the file S0C1Operation Exception. Check for subscript errors, missing DD card, file
not opened. SE37Insufficient disk space.
Q ti
-
8/12/2019 75640653 Mainframe Testing
45/186
2007, Cognizant Technology Solutions Confidential 45
Questions
Questions from participants
T Y U d di
-
8/12/2019 75640653 Mainframe Testing
46/186
2007, Cognizant Technology Solutions Confidential 46
Test Your Understanding
1.What is JCL?
2. Which statement informs the operating system about the start of a job?
3. What is the function of DD statements?
-
8/12/2019 75640653 Mainframe Testing
47/186
VSAM
C3: Protected
VSAM
-
8/12/2019 75640653 Mainframe Testing
48/186
2007, Cognizant Technology Solutions Confidential 48
VSAM
What is VSAM?
VSAM is Virtual Storage Access Method
It is a method used to move data between Disk and Main Storage
VSAM acts as interface between Operating System and Application Program
Interface between Main Storage and Disk
It is a file-system where files are stored with either index or relative byteaddress.
Fil A M th d
-
8/12/2019 75640653 Mainframe Testing
49/186
2007, Cognizant Technology Solutions Confidential 49
File Access Methods
There are three types of file access methods:
Sequential (Reading from beginning to end)
Random (Records are read by the value in the key)
Direct (Records are read based on their physical location/address on disk)
VSAM supports all these methods
VSAM Datasets
-
8/12/2019 75640653 Mainframe Testing
50/186
2007, Cognizant Technology Solutions Confidential 50
VSAM Datasets
VSAM datasets are of 4 types:
ESDSEntry Sequenced Data Set
KSDSKey Sequenced Data Set
RRDSRelative Record Data Set
LDS Linear Data Set
Traditional access Methods
QSAM (Queried Sequential Access Method)
BSAM (Basic Sequential Access Method)
for flat files
ISAM (Index Sequential Access Method) for Index files
BDAM (Basic Direct Access Method) for direct access files
IDCAMS
-
8/12/2019 75640653 Mainframe Testing
51/186
2007, Cognizant Technology Solutions Confidential 51
IDCAMS
IDCAMS utility is used to handle VSAM data sets
Some of the functions are as follows,
DESCRIPTION KEYWORDS
Create DEFINE
Copy REPRO
Print PRINT
Delete DELETE
Lists Characteristics LISTCAT
VSAM Dataset Organization
-
8/12/2019 75640653 Mainframe Testing
52/186
2007, Cognizant Technology Solutions Confidential 52
VSAM Dataset Organization
VSAM Data Set can contain three major components
CLUSTER (Catalog entry)
INDEX
DATA (Actual data)
VSAM Data Set is referred by cluster name in JCL
INDEX
-
8/12/2019 75640653 Mainframe Testing
53/186
2007, Cognizant Technology Solutions Confidential 53
INDEX
Separate entity
VSAM builds Index when data is loaded
Index is organized as Inverted Binary Tree
VSAM compresses keys to conserve space
Can have several Levels of Indexes
ESDS
-
8/12/2019 75640653 Mainframe Testing
54/186
2007, Cognizant Technology Solutions Confidential 54
ESDS
The features of ESDS is as follows, Similar to Sequential File
Sequenced by the order in which data is entered/loaded
New Records are added at the end only (chronological order)
Supports both Fixed and Variable formats
Contains only CLUSTER & DATA components No INDEX component exists for ESDS
Only sequential access is possible through Batch COBOL Programs
RRDS
-
8/12/2019 75640653 Mainframe Testing
55/186
2007, Cognizant Technology Solutions Confidential 55
RRDS
The features of RRDS is as follows, Has only CLUSTER and DATA components
No INDEX component exists for RRDS
Records are stored as numbered, fixed length slots
Each record is given a number Relative Record Number (RRN)
Records can be deleted physically
Empty slots are filled up with new records without shifting existingrecords
No primary Index or Alternate Index
Supports Fixed and Variable formats RRN cannot be changed
KSDS
-
8/12/2019 75640653 Mainframe Testing
56/186
2007, Cognizant Technology Solutions Confidential 56
KSDS
The features of KSDS is as follows, Has all three components of VSAM (CLUSTER, INDEX and DATA)
Key sequenced
Primary key should be unique
Records can be deleted physically
Primary key cannot be changed
Allows Alternate Index
Supports all the access methods (Sequential, Random, Dynamic)
While loading the data into a KSDS, the records need to be sorted on
Primary key in ascending order
IDCAMS
-
8/12/2019 75640653 Mainframe Testing
57/186
2007, Cognizant Technology Solutions Confidential 57
IDCAMS
Always has the following JCL structure//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD*
/*
//*
Basic IDCAMS Commands
DEFINE (Cluster, Alternate Index etc.)
BUILDINDEX (Alternate Index) REPRO (Cluster)
LISTCAT (Catalog Entries)
IMPORT / EXPORT (Cluster)
VERIFY (Cluster)
DEFINE
-
8/12/2019 75640653 Mainframe Testing
58/186
2007, Cognizant Technology Solutions Confidential 58
DEFINE
DEFINE command is used to create a Cluster, Index orAlternate Index.
The below is a example of DEFINE command, to create a KSDS,
DEFINE CLUSTER -(NAME (CTS.KSDS.CLUSTER) -
CYLINDER (5 1) VOLUMES (WORK01) -
RECORDSIZE (120 124) KEYS (8 0) INDEXED) -
DATA -
NAME (CTS.KSDS.DATA)) -
INDEX (NAME (CTS.KSDS.INDEX))
In the above example - is the continuation character. INDEXED is the keyword to denote it is a KSDS.
REPRO
-
8/12/2019 75640653 Mainframe Testing
59/186
2007, Cognizant Technology Solutions Confidential 59
REPRO
REPRO Load and backup utility command Can be used against empty / loaded VSAM file with another VSAM file or sequential file Can be used against all four types of VSAM datasets The below is the syntax of repro,
REPRO INDATASET (DSN) or INFILE (DD1)
OUTDATASET (DSN) or OUTFILE (DD2)
SKIP (count)
COUNT (count)
FROMKEY
FROMADDRESS
FROMNUMBER
TOKEY
TOADDRESS
TONUMBER
REUSE/REPLACE
INFILE or INDATASET parameter is mandatory, similarly OUTFILE or OUTDATASET ismandatory
All other parameters are optional
REPRO (Contd )
-
8/12/2019 75640653 Mainframe Testing
60/186
2007, Cognizant Technology Solutions Confidential 60
REPRO (Contd.,)
SKIP specifies number of input records to skip beforebeginning to copy
COUNT specifies number of output records to copy
REUSE parameter
Can be used only if the VSAM dataset was originally defined with REUSEoption
Has the effect of logically deleting records before loading
REPLACE parameter
Replaces the records for which primary keys are matching between
input and output records
If not specified, the matching key records are untouched
If the target is ESDS the records are appended and REPLACE isinappropriate.
ALTER & DELETE
-
8/12/2019 75640653 Mainframe Testing
61/186
2007, Cognizant Technology Solutions Confidential 61
ALTER & DELETE
ALTER Used to change parameters such as FREESPACE
Has no effect on existing CI & CA splits
Syntax: ALTER entry-name
DELETE
DELETE (parameters)
Example: DELETE CTS.NLT.CLUSTER Deletes all subordinate objects such as AIX, Path
Some Common DELETE Parameters
ERASE / NO ERASE : ERASE writes binary zeroes after deletion
PURGE / NO PURGE: PURGE allows deletion even though expiration date is still due
ALTERNATE INDEX Or AIX: Deletes only Alternate index of the cluster
PATH : Requests only path name to be deleted.
FORCE / NO FORCE : FORCE deletes the dataset even if it is not empty
All the delete parameters are optional
-
8/12/2019 75640653 Mainframe Testing
62/186
Batch Execution
C3: Protected
Batch Execution: Objectives
-
8/12/2019 75640653 Mainframe Testing
63/186
2007, Cognizant Technology Solutions Confidential 63
Batch Execution: Objectives
Objective:
After completing this chapter, you will be able to:
What is Job
Steps of Job Processing
Define Job Class and Job Priority
-
8/12/2019 75640653 Mainframe Testing
64/186
Job Processing (continued)
-
8/12/2019 75640653 Mainframe Testing
65/186
2007, Cognizant Technology Solutions Confidential 65
Job Processing (continued)
When the job finishes executing, it is placed into a queue of jobs waiting to beprinted.
Priorities within this queue are determined by the amount of output for the job.
When all output for the job is completed, it is removed from the system(purged).
Any job that remains in the system for ten days or longer will be automaticallypurged by the system.
Job Class and Priority
-
8/12/2019 75640653 Mainframe Testing
66/186
2007, Cognizant Technology Solutions Confidential 66
Job Class and Priority
Job Class: The CLASS= parameter on the JOB statement alters the priority at which your OS/390
batch jobs will be run.
CLASS=A is the default job class. Class A runs at normal priority with regular rates.
Job Priority:
Jobs are assigned a priority for execution according to their job class and estimated
execution time .
The priority of some jobs increases at regular intervals while the job is awaiting
execution. This is calledpriority aging.
The output priority for these jobs is equal to the execution priority .
The priority of the job decreases as the volume of output increases.
Job Class and Priority (continued)
-
8/12/2019 75640653 Mainframe Testing
67/186
2007, Cognizant Technology Solutions Confidential 67
Job Class and Priority (continued)
LOW - will be run at the operator's discretion when they will not interfere with the running of other
jobs .
PRODUCTION - (Class P) can be defined as I/O-bound jobs. They are run in first-in/first-run order.
STANDBY- will be run at the operator's discretion on nights and weekends when they are not likely to
interfere with higher priority jobs.
VERYSLOW- jobs are run only during the weekend operating hours at the discretion of the Shift
Supervisor .
RESEARCH- class (Class R) is for CPU-intensive research computing jobs. EVENING RESEARCH -
(Class S) is for CPU-intensive research computing jobs.
RCI - jobs (classes G and H) are reserved for special Research Computing .
WEEKEND (W)- is for research applications only and is available on weekends and holidays.
CNS UTILITIES (U)- limited to certain CNS utilities such as XFER3 (funds transfer).
FAST BATCH (Q)- is limited to educational applications with a maximum of 2 seconds of CPU time.
URGENT (5)- jobs (Class 5) are for fast processing .
Job Class and Priority (continued)
-
8/12/2019 75640653 Mainframe Testing
68/186
2007, Cognizant Technology Solutions Confidential 68
Job Class and Priority (continued)
Computation of Execution Priority
The execution priority of a Class A job is based on estimated execution time. As the job awaits
execution, its priority ages every hour.
Computation of Print Priority
Priority for printing is based on the actual number of lines of output a job produces, NOT the number
of lines estimated.
The print priority of LOW, STANDBY, VERYSLOW, or URGENT jobs does not age, but stays at 1, 0, 0, or
14 respectively.
Hints for Improving Batch Job Turnaround Time
Submit your batch jobs late in the day, when the demand for resources is lower. Invest some time in desk-checking your programs before you submit them.. Use Class Q compilers or Class U utilities whenever possible. Analyze your program's needs and accurately estimate your CPU request in your JCL. If you are going to use a program repeatedly, compile and link-edit it so you do not have to wait for it
to be compiled and link-edited each time you run it.
-
8/12/2019 75640653 Mainframe Testing
69/186
2007, Cognizant Technology Solutions Confidential 69
Questions from participants
Test Your Understanding
-
8/12/2019 75640653 Mainframe Testing
70/186
2007, Cognizant Technology Solutions Confidential 70
Test Your Understanding
1. What is the batch Job?
2. What are different job class are there and how they help ?
Batch Execution : Summary
-
8/12/2019 75640653 Mainframe Testing
71/186
2007, Cognizant Technology Solutions Confidential 71
Batch Execution : Summary
In this chapter you have learnt about
Introduction to Batch Job
Job Processing
Job priorities
Different types of class
-
8/12/2019 75640653 Mainframe Testing
72/186
COBOL Basics
Common Business Oriented Language
C3: Protected
COBOL - Overview
-
8/12/2019 75640653 Mainframe Testing
73/186
2007, Cognizant Technology Solutions Confidential 73
C v v w
Introduction: COBOL is English like language and hence is easy to learn
Can be used with any database like DB2, IDMS, and VSAM
Can handle huge volumes of data
COBOL applications can be easily maintained
COBOL: Objectives
-
8/12/2019 75640653 Mainframe Testing
74/186
2007, Cognizant Technology Solutions Confidential 74
C j
Objective:
After completing this chapter, you will be able to:
Describe all Divisions and Sections
List all the Data names and Picture Clause
Define Redefine, Rename, Usage, Computational clauses
Describe the File operations
Describe Compiler directive
Divisions
-
8/12/2019 75640653 Mainframe Testing
75/186
2007, Cognizant Technology Solutions Confidential 75
There are 4 divisions which form the principal portions of a program. They are
Identification (Required)
Environment (Optional)
Data (Optional)
Procedure (Required)
Identification Division:
The Identification Division names the program and, optionally, documents the date the
program was written, the compilation date and other pertinent information.
Syntax
IDENTIFICATION DIVISION.
PROGRAM-ID. PGM-NAME.
[AUTHOR. Comment Entry][INSTALLATION. Comment Entry]
[DATE-WRITTEN. Comment Entry]
[DATE-COMPILED. Comment Entry]
Environmental Division
-
8/12/2019 75640653 Mainframe Testing
76/186
2007, Cognizant Technology Solutions Confidential 76
Environment Division :
This division contains machine dependent details such as Computer(s) used and
peripheral devices. It has got two section.
CONFIGURATION SECTION- Identifies the computer used for compiling of
programs
INPUT-OUTPUT SECTION - Identifies the files and the input-output
resource used by the program
Syntax
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
[SOURCE-COMPUTER. Comments.]
[OBJECT-COMPUTER. Comments.]
INPUT-OUTPUT SECTION.[FILE-CONTROL.]
[File control entries]
[I-O CONTROL.]
[I-O control entries]
Data Division and Procedure Division
-
8/12/2019 75640653 Mainframe Testing
77/186
2007, Cognizant Technology Solutions Confidential 77
Data Division:
The Data Division defines the nature and characteristics of all data (variables) the program is toprocess.
This includes both Input/Output data and data used for internal processing.
Data Division has the following section1. FILE SECTIONThis describes most of the data that is sent to, or coming from, the computers
peripherals.
2.WORKING-STORAGE SECTIONThis describes the general variables used in the program.
3.LINKAGE SECTIONThis establishes link between two programs.
Procedure Division: Includes statements and sentences necessary for reading input, processing it and writing the output.
Contains instructions that are executed by the computer at the RUN TIME.
All the data described in the DATA DIVISION are processed here and desired results are produced.
Its hierarchical in structure consists of Sections, Paragraphs, Sentences and Statements. Should contain at least one paragraph, sentence and statement.
Data Types in COBOL
-
8/12/2019 75640653 Mainframe Testing
78/186
2007, Cognizant Technology Solutions Confidential 78
yp
Alphabetic
Numeric
Alphanumeric
Edited numeric
Edited alphanumeric
Figurative constants:
Figurative constants Meaning
ZERO(S) or ZEROES
Represents the value 0, one or more depending on the context
SPACE(S) Represents one or more spaces
HIGH-VALUE(S) Represents the highest value
LOW-VALUE(S) Represents the lowest value
QUOTE(S) Represents single or double quotes
ALL literal Fill With Literal
Data Names and Picture Clause
-
8/12/2019 75640653 Mainframe Testing
79/186
2007, Cognizant Technology Solutions Confidential 79
DATA NAMES:
Are named memory locations (similar to variables in other programming languages).
Must be described in the DATA DIVISION before they can be used in the PROCEDUREDIVISION
Can be at most 30 characters in length, Only alphabets, digits and hyphen are allowed.
The description of a data name is done with the aid of(1) Level numberexpresses data hierarchy
(2) PICTURE clausespecifies data type and storage
(3) VALUE clauseinitializes the data names
PICTURE clause:
Is used to specify the following(1) The data type
(2) The storage requirement
Can be abbreviated as PIC.
Level Numbers & Picture Clause
-
8/12/2019 75640653 Mainframe Testing
80/186
2007, Cognizant Technology Solutions Confidential 80
Level syntax number:
Picture Clause:
LEVEL NUMBER Description Coding Rules
1 Record Description for files
and independent data items
Must begin in Area A
0249 Fields within records and
sub-items
Can begin in Area A or Area B
66 RENAMES Clause Must begin in Area A
77 Independent elementary
items
Must begin in Area A
88 Condition Names Can begin in Area A or Area B
PICTURE Symbol Meaning
9 Numeric
A Alphabetic
X Alphanumeric
REDEFINES Clause
-
8/12/2019 75640653 Mainframe Testing
81/186
2007, Cognizant Technology Solutions Confidential 81
The REDEFINES clause allows the same area to be referred by more than one data name with
different sizes and pictures.
Syntax: Level-number data-name-1 REDEFINES data-name-2
The level-number of data-name-1 and data-name-2 must be identical
When the REDEFINES clause is used to 01 level, data-name-1 and
data-name-2 must be of same size but the size can be varying for data-name-1 anddata- name-2 for other levels.
This clause must not be used for level-number 66 or 88
The redefining entry (data-name-1) and any sub-ordinate entries must not contain any VALUEclauses
OCCURS and REDEFINE clause cannot be specified at a time in the same entry.
The REDEFINES clause must not be used for records (01 level) described in the
FILE SECTION. The appearance of multiple 01 entry in the record description is implicitlyassumed to be the redefinition of the first 01 level record.
RENAMES Clause:
-
8/12/2019 75640653 Mainframe Testing
82/186
2007, Cognizant Technology Solutions Confidential 82
RENAMES allows re-grouping of elementary data items in a record so that they can belong to the
original as well as to the new group .
Syntax: 66 data-name-1 RENAMES data-name-2 THRU data-name-3
The RENAMES clause must be used only with the special level number 66
Cannot Rename 77 ,88, 66 or 01 levels.
Data-name-2 and data-name-3 can be the names of elementary items or group items. They howevercant be items of levels 01,66,77 or 88
Neither data-name-2 nor data-name-3 can have an OCCURS clause in its description entry, nor canthey be subordinate to an item that has an occurs clause in its data description entry
Data-name-3, if mentioned, must follow data-name-2, in the record and must not be one of it subfields.
USAGE Clause:
-
8/12/2019 75640653 Mainframe Testing
83/186
2007, Cognizant Technology Solutions Confidential 83
G
These are forms of internal representation of data in the memory.
1.Computational2. Display
3.Packeddecimal
The syntax of the USAGE clause is
USAGE IS {BINARY
COMP COMPUTATIONAL
COMP-1 COMPUTATIONAL-1COMP-2 COMPUTATIONAL-2
COMP-3 COMPUTATIONAL-3
COMP-4 COMPUTATIONAL-4
DISPLAY
PACKED-DECIMAL}
Binary Clause
-
8/12/2019 75640653 Mainframe Testing
84/186
2007, Cognizant Technology Solutions Confidential 84
y
Specified for binary data items.
Such items have a decimal equivalent consisting of the decimal digits 0 through 9, plus a sign.Negative numbers are represented as the two's complement of the positive number with the sameabsolute value.
The amount of storage occupied by a binary item depends on the number of decimal digits definedin its PICTURE clause
COMPUTATIONAL or COMP:-
This is the equivalent of BINARY. The COMPUTATIONAL phrase is synonymous with BINARY.
Digits in PICTURE Clause Storage Occupied
1 through 4 2 bytes (halfword)
5 through 9 4 bytes (fullword)
10 through 18 8 bytes (doubleword)
Computational Clauses
-
8/12/2019 75640653 Mainframe Testing
85/186
2007, Cognizant Technology Solutions Confidential 85
COMPUTATIONAL-1 or COMP-1 (Floating-Point): -
Specified for internal floating-point items (for single precision). COMP-1 items are 4 bytes long(1 Word). The number is actually represented in Hexadecimal
form.
The PIC clause cannot be specified for this item
COMPUTATIONAL-2 or COMP-2 (Long Floating-Point) Specified for internal floating-point items (double precision).
COMP-2 items are 8 bytes long(2 word). The advantage is that this increases the precision of the data, which means more significant digits
can be available for the item.
The PIC clause cannot be specified
COMPUTATIONAL-3 or COMP-3 (Internal Decimal) This is the equivalent of PACKED-DECIMAL.
In this form of internal representation the numeric data is represented in the decimal form, but onedigit takes half-a-byte.
The sign is stored separately as rightmost half-a-byte regardless of whether S is specified in the PICclause or not.
The hexadecimal number C or F denotes positive sign and D denotes negative sign.
The number of bytes = n+1/2 Where n is the number of places specified in PIC clause
Index Clause
-
8/12/2019 75640653 Mainframe Testing
86/186
2007, Cognizant Technology Solutions Confidential 86
Index Clause: An index data item is a 4-byte elementary item (not necessarily
connected with any table).
The USAGE IS INDEX clause can be written at any level.
An index data item cannot be a conditional variable.The DATE
FORMAT, JUSTIFIED, PICTURE, BLANK WHEN ZERO,
SYNCHRONIZED, or VALUE clauses cannot be used to describegroup or elementary items described with the USAGE IS INDEX
clause.
Procedure Division Verbs
-
8/12/2019 75640653 Mainframe Testing
87/186
2007, Cognizant Technology Solutions Confidential 87
Data movement Verb
Move copies data from the source identifier or literal to one or more destination identifiersSyntax: MOVE {identifier, literal} to {indentifier}
Arithmetic Verbs1.ADD
2.SUBTRACT
3.MULTIPLY
4.DIVIDE
5.COMPUTE
Input / Output Verbs1. ACCEPT Verb
Syntax: ACCEPT identifier [ FROM { DATE, DAY, TIME, mnemonic-name }].
2. DISPLAY Verb
Syntax: DISPLAY { identifier-1, literal-1 } .
Sequence control Verbs1. GO TO
2. IF . . . THEN . . .3. EVALUATE
4. STOP RUN
5. PERFORM
Files
-
8/12/2019 75640653 Mainframe Testing
88/186
2007, Cognizant Technology Solutions Confidential 88
FILE Types:
1.Sequential2.Indexed
3.Relative
FILE OPERATIONS:OPEN :
Syntax:open { INPUT file-name1
OUTPUT file-name2 ...I-O file-name3 ...
EXTEND file-name4 ... } ...
Opens the file for processing
EXTEND is allowed only for sequential files (not for VSE)
OUTPUT clears the file of its existing
CLOSE: CLOSE file-name1 ...
Closes the open file
Terminates the file processing
Read Clause
-
8/12/2019 75640653 Mainframe Testing
89/186
2007, Cognizant Technology Solutions Confidential 89
READ:
Format-1 - Sequential ReadSyntax: READ file-name-1 NEXT RECORD
[ INTO identifier-1 ]
[ AT END imperative-stmt-1]
[ NOT AT END imperative-stmt-2 ]
[ END-READ ]
NEXT phrase is optional for SEQUENTIAL access mode & a must for DYNAMIC
Format-2 - Random ReadSyntax: READ file-name-1 RECORD[ INTO identifier-1 ]
[ KEY IS data-name-1 ]
[ INVALID KEY imperative-stmt-3 ]
[ NOT INVALID KEY imperative-stmt-4 ]
[ END-READ ]
Indexed random read Relative random read
1.Data name specified in KEY phrase The KEY phrase must not be specified
2.The prime RECORD KEY data name
is taken if KEY phrase not specified
Statement reads the record whose relative
record number is contained in the
RELATIVE KEY data item,
Start Clause
-
8/12/2019 75640653 Mainframe Testing
90/186
2007, Cognizant Technology Solutions Confidential 90
Syntax: START file-name
[ KEY IS { EQUAL TO data-name]= , GREATER THAN , > , NOT LESS THAN, NOT < THAN }
[ INVALID KEY imperative-stmt-1 ]
[ NOT INVALID KEY imperative-stmt-2 ]
[ END-START ]
Enables the positioning of the pointer at a specific point in an indexed or relative file.
File should be opened in Input or I-O mode.
Access mode must be Sequential or Dynamic.
Invalid Key arises if the record position is empty.
When KEY phrase is not specified KEY EQUAL TO primary key is implied.
File position indicator points to the first record in the file whose key field satisfies the comparison.
Rewrite Clause
-
8/12/2019 75640653 Mainframe Testing
91/186
2007, Cognizant Technology Solutions Confidential 91
Syntax: REWRITE record-name
[ FROM id-1][ INVALID KEY imperative-stmt-1]
[ NOT INVALID KEY
imperative-stmt-2 ]
[ END-REWRITE ]
Updates an existing record in a file
File should be opened in I-O mode
After a REWRITE statement with the FROM phrase is executed, the information is still available inidentifier-1
File position indicator not affected
For Sequential files
- INVALID KEY not allowed
- Record length cant change
Delete Clause
-
8/12/2019 75640653 Mainframe Testing
92/186
2007, Cognizant Technology Solutions Confidential 92
Syntax: DELETE file-name-1 RECORD
[ INVALID KEY imperative-stmt-1][ NOT INVALID KEY imperative-stmt-2]
[ END-DELETE ]
For a file in sequential access mode, the last input/output statement must have been a successfullyexecuted READ statement. When the DELETE statement is executed, the system removes therecord retrieved by that READ statement.
File should be opened in I-O mode.
For Random or Dynamic access system removes record pointed by the RECORD key(KSDS) orRELATIVE key(RRDS)
For indexed files, the key can then be reused for record addition.
For relative files, the space is then available a new record with the same RELATIVE KEY value.
The file position indicator is not affected by execution of the DELETE statement.
Sort
-
8/12/2019 75640653 Mainframe Testing
93/186
2007, Cognizant Technology Solutions Confidential 93
Syntax: SORT file-1 { ON {ASCENDING
DESCENDING} KEY id-1... } ...[WITH DUPLICATES IN ORDER]
[COLLATING SEQUENCE IS alphabet-name-1]
{USING file-2
INPUT PROCEDURE proc-nm-1 [THRU proc-nm-2]}
{GIVING file-3
OUTPUT PROCEDURE IS proc-nm-3 [THRU proc-nm-4]}
For arranging the records in some predetermined order based on some fields.
The fields based on which the records are sequenced are called SORT KEYS and cannot bevariably located.
The sequencing can be ascending or descending order of the KEY and by default it is ascending.
The SORT work file needs to be defined in the SD entry of File Section
When USING / GIVING option is specified the input / output file(s) to sort must not be open
SORT
Sort (cont)
-
8/12/2019 75640653 Mainframe Testing
94/186
2007, Cognizant Technology Solutions Confidential 94
Input Procedure: For editing the records that need to be sorted before the sort operation
The SORT statement implicitly performs the procedure specified in the INPUT PROCEDUREbefore sort operation., Then the processed records are released to SORT operation using RELEASEstatement.
Release: Transfers records to the initial phase of sort operation, Its like WRITE statement.
If INPUT PROCEDURE is used, at-least one RELEASE statement must be executed
Output Procedure: The output procedure is performed implicitly by sort statement in order to perform editing on the
sorted records.
The output procedure gets the sorted records by means of RETURN statement that is discussedlater in this chapter.
Return: Transfers records from the final phase of a sorting or merging operation to an OUTPUT
PROCEDURE.Its like READ statement
Merge
-
8/12/2019 75640653 Mainframe Testing
95/186
2007, Cognizant Technology Solutions Confidential 95
Combines two or more identically sorted files and makes records available in sorted
order in a single file.
Syntax: MERGE file-1 { ON {ASCENDING
DESCENDING} KEY id-1... } ...
[COLLATING SEQUENCE IS alphabet-name-1]
USING file-2 [file-3 ...]
{GIVING file-4
OUTPUT PROCEDURE IS proc-nm-1 [THRU proc-nm-2]}
The Merge work file needs to be defined in the SD entry of file section.
When USING / GIVING option is specified the input / output file(s) to merge must not be open.
The key used in the MERGE statement cannot be variably located.
When the file referenced by filename-1 is merged control passes to first stmt in the OUTPUT
PROCEDURE.
Sub Program
-
8/12/2019 75640653 Mainframe Testing
96/186
2007, Cognizant Technology Solutions Confidential 96
Call:Syntax: CALL { id-1 lit-1} [ USING{ [BY REFERENCE ]
{ id-2 file-name-1 ADDRESS OF id-3} ...
BY CONTENT { [LENGTH OF] id-2 ADDRESS OF id-3 lit-1} ...} ... ]
[ON {OVERFLOW imperative stmt-1]
EXCEPTION] [ NOT ON EXCEPTION imperative stmt-2]
[END-CALL]
Transfers control from one object program to another within the run unit.
Called program starts executing from:
- Top of program- ENTRY label (not good programming practice)
Transfer control methods
- Call nested program
- Static call
- Dynamic call
Parameters to called program:
- By reference- By content
Return of control depends on the termination stmt issued by the called program
- Stop run unit
- Return to called program
Sub Program (cont)
-
8/12/2019 75640653 Mainframe Testing
97/186
2007, Cognizant Technology Solutions Confidential97
Call rules:
Address of option can be used only for Linkage variables with level 01 or 77 Called program must not execute a CALL statement that directly or indirectly calls the calling
program (Recursion not allowed)
Exit:Syntax: EXIT program.
Specifies the end of a called program and returns control to the calling program
EXIT PROGRAM stmt in a called program with INITIAL attribute is equivalent to executing aCANCEL, EXIT PROGRAM executed in a main program has no effect.
Stop:Syntax: STOP {RUN lit-1}
Halts execution of the program :
- Permanently (RUN option)
- Temporarily (Lit-1 option)
Search
-
8/12/2019 75640653 Mainframe Testing
98/186
2007, Cognizant Technology Solutions Confidential98
To search a table element that satisfies a specified condition
SEARCH VARYING
LINEAR SEARCH
SEARCH ALL
Search SEARCH ALL
Syntax:
SEARCH id-1
[ VARYING { id-2
index-name-1 } ]
[ AT END imperative-statement-1 ]
WHEN condition-1 { imper-stmt2
NEXT SENTENCE }
[ END-SEARCH ]
Syntax:
SEARCH ALL id-1
[ AT END imperative-statement-1 ]
WHEN { dataname-1= equal-clause
Condition-name-1}
NEXT SENTENCE }
[ END-SEARCH ]
This search is serial search or linear search This SEARCH all is the Binary search.
Set starting points of index. The increment of the index taken care of by
the search statement itself.
Initial setting of index ignored, but if set it must not be greater than the
maximum
The table may sorted or not For this search the table needs to be in sorted order using
ASCENDING/DESCENDING option in occurs clause
Questions
-
8/12/2019 75640653 Mainframe Testing
99/186
2007, Cognizant Technology Solutions Confidential99
Questions from participants
Test Your Understanding
-
8/12/2019 75640653 Mainframe Testing
100/186
2007, Cognizant Technology Solutions Confidential100
1. What are the different Divisions and Sections in Cobol?
2.What is the level number for rename and conditional clauses?
3.How many bytes Comp variables takes?
4. What will happen if both the input files for merge is un-sorted?
5. What will happen if STOP RUN used in the sub program?
-
8/12/2019 75640653 Mainframe Testing
101/186
Introduction to CICS
Customer Information Control System
C3: Protected
Introduction to CICS
-
8/12/2019 75640653 Mainframe Testing
102/186
2007, Cognizant Technology Solutions Confidential 102
Introduction: CICS (Customer Information Control System) is the font-end or online system
for mainframes. CICS is an IBM product, introduced in 1970s. It is a separate
sub-system in MVS operating system. It supports large number of concurrent
users accessing the online programs.
Objectives
-
8/12/2019 75640653 Mainframe Testing
103/186
2007, Cognizant Technology Solutions Confidential 103
After completing this chapter, you will be able to understand the following: Basic terminology in CICS
Hierarchy of CICS Objects
Naming Conventions
Introduction to Creating Maps
Creating Mapset
Creating Map
Creating Fields
Sample Map
Viewing a Map
Embedding CICS in COBOL
Sample CICS-COBOL Compile JCL
Basic Terminology in CICS
-
8/12/2019 75640653 Mainframe Testing
104/186
2007, Cognizant Technology Solutions Confidential 104
Terminology:
Field is basic element in CICS UI (User Interface). Each and every option available in thescreen is called as a field. Similar to Textbox, Label, etc., in windows operating system.
Map is the Representation of one screen format. It is a collection of fields. It is
synonymous to screens / windows in Windows operating system.
Mapsetis a collection of maps linked together. It is used to logically group the maps.
Transaction-IDis the unique four digit number assigned to each online program.
Symbolic Map is the copybook generated after compilation of a map.
Physical Mapis the load-module (binary file) generated after compilation of a map.
Hierarchy of CICS Objects
-
8/12/2019 75640653 Mainframe Testing
105/186
2007, Cognizant Technology Solutions Confidential 105
Mapset
Map
Field
Transaction
Calls / Uses
Contains
Contains
Naming Conventions
-
8/12/2019 75640653 Mainframe Testing
106/186
2007, Cognizant Technology Solutions Confidential 106
The below naming convention should be used while creating Maps orCICS-COBOL programs
S. No Object Name to be Used
1 Map Map Name Allocated by Mainframe Administrator
2 Mapset Mapset Name Allocated by Mainframe Administrator
3 CICS-COBOL program Program Name Allocated by Mainframe Administrator
4 Load Module Same as CICS-COBOL program name
5 Transaction ID Transaction ID allocated by Mainframe Administrator
Introduction to Creating Maps
-
8/12/2019 75640653 Mainframe Testing
107/186
2007, Cognizant Technology Solutions Confidential 107
Maps can be created using BMS (Basic Mapping Support) assembler macros. Three types of Macros are
DFHMSD - Define or End a Mapset definition. DFHMDI - Define or End a Map definition.
DFHMDF - Define a field.
MapsetMap
A Field
A Field
MapA FieldA Field
MapA FieldA Field
Col.1 Col.16 Col.72
Name Operation Operands (Parameters separated by commas) Continuation Character
Column format for coding :
While creating maps, follow the below order:
Creating Mapset
-
8/12/2019 75640653 Mainframe Testing
108/186
2007, Cognizant Technology Solutions Confidential 108
Mapset can be created using DFHMSD macro.
Syntax for creating a Mapset:
[mapset] DFHMSD [TYPE=DSECT | MAP | &SYSPARM | FINAL][, MODE=IN | OUT | INOUT][, LANG=ASM | COBOL | PL1][, STORAGE=AUTO | BASE=name][, CTRL=(PRINT, FREEKB, ALARM, FRSET)][, EXTATT=NO | MAPONLY | YES][, COLOR=DEFAULT | COLOR][, HIGHLIGHT=OFF | BLINK | REVERSE | UNDERLINE][, PS=BASE | psid][, VALIDN=([MUSTFILL][, MUSTENTER][, TRIGGER])]][, TERM=terminal type |, SUFFIX=n][, TIOAPFX=YES | NO][, MAPATTS=(attr1, attr2,)][, DSATTS=(attr1, attr2,)][, OUTLINE=BOX | ([LEFT][, RIGHT][, OVER][, UNDER])][, SOSI=NO | YES][, TRANSP=YES | NO]
[, PARTN=(name [, ACTIVATE])][, LDC=MNEMONIC][, OBFMT=YES | NO][, HTAB=tab [, tab]][, VTAB=tab [, tab]][, DATA=FIELD | BLOCK][, FLDSEP=char | X hex-char]]
Creating Mapset(Contd.)
-
8/12/2019 75640653 Mainframe Testing
109/186
2007, Cognizant Technology Solutions Confidential 109
Sample program:
Mapset1 DFHMSD TYPE=&&SYSPARM, XCTRL=(FREEKB,FRSET), XLANG=COBOL, XSTORAGE=AUTO, X
TIOAPFX=YES, XMODE=INOUT, X
TERM=3270
.
Map Definitions..
DFHMSD TYPE=FINALEND
Where,
Mapset1 Mapset name, can't be more than 8 characters, and must start in the 1stcolumn.
CTRL=(FREEKB,FRSET) Control parameters, FREEKB is used to free the keyboard whenan ABEND occurs.
LANG=COBOL Map will be used in COBOL program, so the symbolic map (copybook)will be generated in COBOL format.
STORAGE=AUTO Memory will allocated by CICS.
TYPE=FINAL End of the mapset.
Creating Map
-
8/12/2019 75640653 Mainframe Testing
110/186
2007, Cognizant Technology Solutions Confidential 110
Map can be created using DFHMDI macro. A map must be defined within a mapset definition.
Syntax for creating a Map:
mapname DFHMDI [, SIZE=(line,column)][, CTRL=(PRINT, FREEKB, ALARM, FRSET)][, EXTATT=NO | MAPONLY | YES][, COLOR=DEFAULT | COLOR][, HIGHLIGHT=OFF | BLINK | REVERSE | UNDERLINE][, PS=BASE | psid][, VALIDN=([MUSTFILL][, MUSTENTER][, TRIGGER])]][, COLUMN=number | NEXT | SAME][, LINE=number | NEXT | SAME][, FILELDS=NO][, MAPATTS=(attr1, attr2,)][, DSATTS=(attr1, attr2,)][, OUTLINE=BOX | ([LEFT][, RIGHT][, OVER][, UNDER])][, SOSI=NO | YES][, TRANSP=YES | NO][, JUSTIFY=([LEFT | RIGHT][, FIRST | LAST])][, PARTN=(name [, ACTIVATE])]
[, OBFMT=YES | NO][, DATA=FIELD | BLOCK][, FLDSEP=char | X hex-char]][, TIOAPFX=YES | NO][, HEADER=YES][, TRAILER=YES]
Creating Map(Contd.)
-
8/12/2019 75640653 Mainframe Testing
111/186
2007, Cognizant Technology Solutions Confidential 111
Sample program:
MAPNAME DFHMDI SIZE=(24,80), X
LINE=01, X
COLUMN=01, X
CTRL=(FREEKB,FRSET).
FIELD Definitions.
Where,
SIZE The rows and columns the map occupies the screen.
LINE The starting row of the map in the screen.
COLUMN The starting column of the map in the screen.
The map definition will end when compiler finds another map definition (DFHMDI entry) or a mapset end.
Creating Fields
-
8/12/2019 75640653 Mainframe Testing
112/186
2007, Cognizant Technology Solutions Confidential 112
Fields can be created using DFHMDF macro. A field must be defined within a map definition.
Syntax for creating a Field:
[field] DFHMDF [, POS=number | (line,column)][, LENGTH=number][, JUSTIFY=([LEFT | RIGHT][, FIRST | LAST])][, INITIAL= char data | Xinit=hex data][, ATTRB=([ASKIP | PROT | UNPROT[, NUM]][, BRT | NORM | DRK][, DET][, IC][, FSET])][, COLOR=DEFAULT | COLOR]
[, PS=BASE | psid][, HIGHLIGHT=OFF | BLINK | REVERSE | UNDERLINE][, VALIDN=([MUSTFILL][, MUSTENTER][, TRIGGER])]][, GRPNAME=group-name][, OCCURS=number][, PICIN= value][, PICOUT= value][, OUTLINE=BOX | ([LEFT][, RIGHT][, OVER][, UNDER])][, SOSI=NO | YES][, TRANSP=YES | NO][CASE=MIXED]
Widely there are two types of fields, as follows,
Protected fields (ATTRB=PROT) The user cannot edit the contents of the field. It is similar to a label
in windows.
Unprotected fields (ATTRB=UNPROT) The user can enter the values in the field. It is similar to a textbox
in windows.
Creating Fields(Contd.)
-
8/12/2019 75640653 Mainframe Testing
113/186
2007, Cognizant Technology Solutions Confidential 113
Sample program:
DFHMDF POS=(01,01), X
LENGTH=4, X
INITIAL=SCR1, X
ATTRB=(PROT,NORM)
Where,
POS The row number and column number where the field will be positioned.
LENGTH The total length of the field.
INITIAL The initial value that will be displayed in the field.
ATTRB Whether the field is a protected or unprotected field.
Sample Map
-
8/12/2019 75640653 Mainframe Testing
114/186
2007, Cognizant Technology Solutions Confidential 114
Complete sample Map
MAPSET1 DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL,STORAGE=AUTO, XTIOAPFX=YES
MAP1 DFHMDI SIZE=(24,80),LINE=1,COLUMN=1DFHMDF POS=(7,16),INITIAL='ENTER THE NO :',LENGTH=15, X
ATTRB=PROTNUM DFHMDF POS=(7,32),LENGTH=5,ATTRB=(UNPROT,IC)
DFHMDF POS=(7,38),LENGTH=1,ATTRB=ASKIPDFHMDF POS=(9,16),INITIAL='ENTER THE NAME:',LENGTH=15, X
ATTRB=PROTNAME DFHMDF POS=(9,32),LENGTH=5,ATTRB=UNPROT
DFHMDF POS=(22,10),INITIAL='MESSAGE :',LENGTH=10,ATTRB=PROTMSG DFHMDF POS=(22,25),LENGTH=30,ATTRB=PROTMAPSET1 DFHMSD TYPE=FINAL
END
After defining the map, compile the map using the sample map compiler.
Sample Map (Contd.)
-
8/12/2019 75640653 Mainframe Testing
115/186
2007, Cognizant Technology Solutions Confidential 115
Sample Map Compiler:
//MAPCMPLR JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)//DSECT EXEC PGM=ASMA90,// PARM='SYSPARM(DSECT),DECK,NOOBJECT,ALIGN',// REGION=6M//SYSLIB DD DSN=CICSTS23.CICS.SDFHMAC,DISP=SHR// DD DSN=CICSTS23.CICS.SDFHSAMP,DISP=SHR// DD DSN=SYS1.MACLIB,DISP=SHR//*//SYSUT1 DD UNIT=SYSDA,SPACE=(1700,(400,400))//SYSUT2 DD UNIT=SYSDA,SPACE=(1700,(400,400))
//SYSUT3 DD UNIT=SYSDA,SPACE=(1700,(400,400))//* THE BELOW IS THE SYMBOLIC MAP NAME - COPYBOOK PDS//SYSPUNCH DD DSN=CTS.CICS.COPYLIB(MAPSET1),DISP=SHR//SYSPRINT DD SYSOUT=*//SYSIN DD DSN=CTS. CICS.MAPLIB(MAPSET1),DISP=SHR//ASMMAP EXEC PGM=ASMA90,// PARM='SYSPARM(MAP),DECK,NOOBJECT,ALIGN',// REGION=4M//SYSLIB DD DSN=CICSTS23.CICS.SDFHMAC,DISP=SHR// DD DSN=CICSTS23.CICS.SDFHSAMP,DISP=SHR// DD DSN=SYS1.MACLIB,DISP=SHR
//*//SYSUT1 DD UNIT=SYSDA,SPACE=(1700,(400,400))//SYSUT2 DD UNIT=SYSDA,SPACE=(1700,(400,400))//SYSUT3 DD UNIT=SYSDA,SPACE=(1700,(400,400))//SYSPUNCH DD DSN=&&OBJMOD,// DISP=(,PASS),UNIT=SYSDA,// DCB=(RECFM=FB,LRECL=80,BLKSIZE=400),// SPACE=(400,(100,100))
Sample Map (Contd.)
-
8/12/2019 75640653 Mainframe Testing
116/186
2007, Cognizant Technology Solutions Confidential 116
Sample Map Compiler (Contd):
//SYSPRINT DD SYSOUT=*//SYSIN DD DSN=CTS. CICS.MAPLIB(MAPSET1),DISP=SHR//LNKEDT EXEC PGM=IEWL,// PARM='NORENT,LIST,XREF,LET,NCAL',// COND=((3,LT,DSECT),(3,LT,ASMMAP))//SYSUT1 DD UNIT=SYSDA,SPACE=(1024,(100,50))//SYSPRINT DD SYSOUT=*//SYSLMOD DD DSN=TIG06431.CICS.LOAD(MAPSET1),DISP=SHR
//SYSLIN DD DSN=&&OBJMOD,DISP=(OLD,PASS)
In the above JCL, change the following,
In SYSPUNCHDD statement enter the copy-library name.
In SYSINDD statement enter the map-library name.
In SYSLMODDD statement enter the load-library name.
Viewing a Map
-
8/12/2019 75640653 Mainframe Testing
117/186
2007, Cognizant Technology Solutions Confidential 117
After successful compilation, login to CICS region and enter the below command,
CEMT SET PROGRAM(Load_Module_Name) NEW
After successful completion of the above command, Hit Pause/Breakbutton in keyboardto clear the screen and enter the below command to view the map,
CECI SEND MAP(Map_Name) MAPSET(Mapset_Name)
The map will be displayed in the screen.
Where,
Load_Module_name Member name that specified in SYSLMOD DD statement of map compile JCL.CEMT Command used to extract the latest load-module from TSO region to CICS region.
Embedding CICS in COBOL
-
8/12/2019 75640653 Mainframe Testing
118/186
2007, Cognizant Technology Solutions Confidential 118
All CICS commands are embedded in COBOL code using EXEC CICS . END-EXEC.command. Before
sending the map, the Symbolic map (Copybook generated from map compilation) should be copied using thebelow statement,
Then the CICS maps can be sent through COBOL programs using SENDMAPcommand as follows,
EXEC CICS SENDMAP('Map_Name')MAPSET('Mapset_Name')ERASE
END-EXEC.
WORKING-STORAGE SECTION.COPY symbolic_map_name.
The CICS maps can be received through COBOL programs using RECEIVE MAPcommand as follows,
EXEC CICS RECEIVEMAP('Map_Name')MAPSET('Mapset_Name')INTO(SymbolicMap_InputVar)
END-EXEC.
Embedding CICS in COBOL (Contd.)
-
8/12/2019 75640653 Mainframe Testing
119/186
2007, Cognizant Technology Solutions Confidential 119
After executing a RECEIVE MAPcommand, all the values entered in the unprotectedfields are populated in
the copybook variable (that is specified in the INTOclause).
All CICS-COBOL program must not contain the ACCEPT, DISPLAY and STOP RUN statements.
CICS-COBOL programs must be terminated using the below command,
EXEC CICS RETURNEND-EXEC.
Sample CICS-COBOL Compiler
-
8/12/2019 75640653 Mainframe Testing
120/186
2007, Cognizant Technology Solutions Confidential 120
Sample CICS-COBOL compiler:
//CICSCOMP JOB MSGCLASS=O,MSGLEVEL=(1,1),CLASS=T,// REGION=5M,NOTIFY=&SYSUID//**********************************************************************// SET MEMNAME=PGMNAME
-
8/12/2019 75640653 Mainframe Testing
121/186
2007, Cognizant Technology Solutions Confidential 121
Sample CICS-COBOL
compiler (Contd):
//**********************************************************************//* COBOL COMPILER *//**********************************************************************//COBCOMP EXEC PGM=IGYCRCTL,COND=(5,LT)
//STEPLIB DD DSN=IGY.SIGYCOMP,DISP=SHR//SYSIN DD DSN=&&SYSIN00,DISP=(OLD,DELETE)//SYSLIB DD DSN=CICSTS23.CICS.SDFHCOB,DISP=SHR// DD DISP=SHR,DSN=©BOOK//SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,// SPACE=(100,(100,100),RLSE)//SYSPRINT DD SYSOUT=*//SYSUDUMP DD SYSOUT=*//SYSUT1 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA//SYSUT2 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA//SYSUT3 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA//SYSUT4 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA//SYSUT5 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA
//SYSUT6 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA//SYSUT7 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA//**********************************************************************//* LINKER FOR CICS PROGRAMS *//**********************************************************************//LKED EXEC PGM=IEWL,PARM='XREF',COND=(5,LT)//SYSLIB DD DSN=CICSTS23.CICS.SDFHEXCI,DISP=SHR// DD DSN=CICSTS23.CICS.SDFHLOAD,DISP=SHR// DD DSN=TIG06431.CICS.LOAD,DISP=SHR// DD DSN=DSN810.SDSNLOAD,DISP=SHR// DD DSN=CEE.SCEELKED,DISP=SHR// DD DSN=CEE.SCEERUN,DISP=SHR// DD DSN=ISP.SISPLOAD,DISP=SHR//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)// DD DDNAME=SYSIN//SYSLMOD DD DISP=SHR,DSN=&LOADLIB(&LOADMEM)//SYSPRINT DD SYSOUT=*//SYSUDUMP DD SYSOUT=*//SYSUT1 DD SPACE=(1024,(50,50)),UNIT=SYSDA//SYSIN DD *INCLUDE SYSLIB(DFHECI)INCLUDE SYSLIB(DSNCLI)
///*
Sample CICS-COBOL Compiler (Contd)
-
8/12/2019 75640653 Mainframe Testing
122/186
2007, Cognizant Technology Solutions Confidential 122
In the sample JCL, change the below statements,
Set the MEMNAME to your CICS-COBOL program name. Set the LOADMEM to your load module name, usually the same as program name. Set the SOURCE to your source library (PDS where COBOL code is available). Set the COPYBOOK to your symbolic map (copybook generated after map compilation). Set the LOADLIB to the load-module allocated by your mainframe administrator.
After successful compilation of CICS-COBOL compiler, enter the below commandin the CICS region,
CEMT SET PROGRAM(Load_Module_Name) NEW
After successful compilation of the above command, hit Pause/ Break key in the keyboard
to clear the screen and enter the Transaction ID allocated to you. On entering the correct
transaction-id, the CICS COBOL program will be executed.
Q & A
-
8/12/2019 75640653 Mainframe Testing
123/186
2007, Cognizant Technology Solutions Confidential 123
Questions from participants
Test Your Understanding
-
8/12/2019 75640653 Mainframe Testing
124/186
2007, Cognizant Technology Solutions Confidential 124
1. List the Hierarchy of CICS Objects?
2. How will you creating Maps using Basic Mapping Support assemblermacros?
3. How will you send & receive the maps in the CICS-COBOL program?
4. How will you receive the map in CICS region?
-
8/12/2019 75640653 Mainframe Testing
125/186
Introduction to DB2 Basics
C3: Protected
Database: Overview
-
8/12/2019 75640653 Mainframe Testing
126/186
2007, Cognizant Technology Solutions Confidential 126
Introduction:
A database, for example, can contain all the data (in form of Tables) that isassociated with one application or with a group of related applications.
You define databases by using the CREATE DATABASE statement.
In DB2 for z/OS, a database is a set of table spaces and index spaces.
Table space contains one or more tables. Index space contains exactly one index.A table and all of its indexes will be contained within a single database.
These index spaces contain indexes on the tables in the table spaces of the samedatabase
Whenever a table space is created, it is explicitly or implicitly assigned to an
existing database.
Db2: Objectives
-
8/12/2019 75640653 Mainframe Testing
127/186
2007, Cognizant Technology Solutions Confidential 127
Objective:
After completing this chapter, you will be able to:
Define database and db2
Define Tables ,view and alias
Define the benefits Keys and index
Describe table space and index space
Db2
-
8/12/2019 75640653 Mainframe Testing
128/186
2007, Cognizant Technology Solutions Confidential 128
Db2:
Db2 is relational database.
In a relational database, data is perceived to exist in one or more tables. Eachtable contains a specific number of columnsand a number of unordered rows.
DB2 database also involves other objects, such as views and indexes,
synonyms , alias.
DB2 also offers different types of keys to reduce time in search and
data retrieve .
SQL( Structured Query Language )
-
8/12/2019 75640653 Mainframe Testing
129/186
2007, Cognizant Technology Solutions Confidential 129
The language that you use to access the data in DB2tables is the Structured Query Language (SQL).
Based on functionality SQL can be classified into 3categories,
DDL - CREATE, ALTER and DROP verbs. DML - INSERT, SELECT, UPDATE and DELETE.
DCL - Grant, Revoke.
DB2 transforms each SQL statement, that is, the specification
of a result table, into a sequence of operations that optimizedata retrieval. This transformation occurs when the SQLstatement isprepared. This transformation is also known asbinding.
Tables: a brief introduction
-
8/12/2019 75640653 Mainframe Testing
130/186
2007, Cognizant Technology Solutions Confidential 130
Tablesare logical structures that DB2 maintains.
Tables are made up of columns and rows.
DB2 supports several different types of tables, some of whichare listed here: base table-is created with the SQL statement CREATE TABLE and that holds
persistent user data.
temporary table-is defined by the SQL statement CREATE GLOBALTEMPORARY TABLE or DECLARE GLOBAL TEMPORARY TABLE to hold datatemporarily. Its useful to sort or query intermediate result tables that contain alarge number of rows, but you want to store only a small subset of those rowspermanently .
result table- contains a set of rows that DB2 returns when you use an SQL
statement to query the tables in the database . materialized query table- can be user-maintained or system-maintained.
Materialized query tables are useful for complex queries that run on very largeamounts of data
View, Alias & Synonyms
-
8/12/2019 75640653 Mainframe Testing
131/186
2007, Cognizant Technology Solutions Confidential 131
Views are virtual tables based on one or more base tables.
When data in the base table changes, these changes are also reflected in theview.
We cannot perform Insert/ Update /Delete in a View with Joins ,Functions,Distinct, Group By and Having.
SYNONYMS.
An alternative private name for a table or a view. It can be used only by its Creator.
It cannot refer to a remote table.
When a table/view is dropped, all synonyms defined on it are also dropped
ALIASES.
An alternative private name for a table or a view.
It can be used by users other than its creator.
When a table/view is dropped, all aliases defined on it are NOT dropped.
Indexes and Keys
-
8/12/2019 75640653 Mainframe Testing
132/186
2007, Cognizant Technology Solutions Confidential 132
An indexis an ordered set of pointers to rows of a table : An index is an object that is separate from the data in the table. When you
define an index by using the CREATE INDEX statement, DB2 builds thisstructure and maintains it automatically.
Each index is based on the values of data in one or more columns of a table.
DB2 uses indexes to improve performance and ensure uniqueness
Akeyis one or more columns that are identified as such in the descriptionof a table, an index, or a referential constraint.
Unique Keys- A table can have any number of unique keys. The columns of aunique key can contain only one null value.
Primary Keys- is a special type of unique key and cannot contain null values.
Parent Keys- is either a primary key or a unique key in the parent table of areferential constraint.
Foreign Keys- A foreign key refers to or is related to a specific parent key.
Table spaces and Index spaces
-
8/12/2019 75640653 Mainframe Testing
133/186
2007, Cognizant Technology Solutions Confidential 133
All tables are kept in table spaces. The primary types of table spaces are
described below: Segmented - can contain more than one table. The space is composed of groups
of pages called segments. Each segment is dedicated to holding rows of a singletable .
Partitioned -table space can contain only a single table and its divided intoseparate units of storage called partitions .
Large object (LOB) - contains all the data for a particular LOB column in therelated base table.
Universal table space - combination of partitioned and segmented table spaceschemes that provides better space management. it's a good choice for tablesthat are larger than 1 GB.
XML table space - is implicitly created when, an XML column is added to a base
table. The table space stores the XML table. An index space, which is another DB2 storage structure, contains a single
index defined in the same database as the table.
Accessing DB2 Tables in Mainframes
-
8/12/2019 75640653 Mainframe Testing
134/186
2007, Cognizant Technology Solutions Confidential 134
DB2 tables can be accessed in mainframes through SPFUI or
QMF (Query Management Facility).
To access DB2 from Cognizant Mainframes, enter Option 8from ISPF main menu.
Under DB2 Primary Option Menu, enter 1 to access SPFUI.
Enter the input dataset name, where you will be writing allDB2 queries.
Enter the output dataset name, where you will be viewing allthe output of the queries. Hit an Enter.
In Current SPFUI Defaults screen, again hit an enter.
Accessing DB2 Tables ( Continued)
-
8/12/2019 75640653 Mainframe Testing
135/186
2007, Cognizant Technology Solutions Confidential 135
Now you can enter all the DB2 queries.
All general windows database queries are applicable in DB2,except in CREATE TABLE query we need to specify the Table-space.
To comment a line in the query input, enter double hyphen --
in column 1 and 2.
To execute the query, enter three semi-colons ;;; in thecommand line and hit an F3.
Now you can view the output of the query.
To again come back to the query input screen, enter threesemi-colons ;;; in the command line and hit an F3.
To exit SPFUI, hit an F3.
-
8/12/2019 75640653 Mainframe Testing
136/186
2007, Cognizant Technology Solutions Confide