Sunteți pe pagina 1din 186

Mainframe Testing

C3: Protected

About the Author


Created By: Mainframe CoE

Credential Information:
Version and Date: ST/PPT/0907/1.0

2007, Cognizant Technology Solutions

Confidential

Icons Used
Hands on Exercise

Questions

Tools

Coding Standards

Test Your Understanding

Reference

Demonstration

A Welcome Break

Contacts

2007, Cognizant Technology Solutions

Confidential

TSO/ISPF

C3: Protected

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. a user to navigate through the panels.
2007, Cognizant Technology Solutions Confidential 5

ISPF provides the

underlying dialog management service that displays panels and enables

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 provides

line mode only. Provides facilities for Editing and Browsing data sets. ISPF uses panels to display and receive information, and allows customization of 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 an ISPF Client at a workstation and a host TSO/ISPF session.
2007, Cognizant Technology Solutions Confidential 6

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.

2007, Cognizant Technology Solutions

Confidential

Logging on
COGNIZANT TECHNOLOGY SOLUTIONS CHENNAI SOFTWARE DEVELOPMENT CENTER

CCCCCCCCC\ TTTTTTTTTTTT\ CCCCCCCCCCCC\ TTTTTTTTTTTT\ CCCC CC\ TTTT\ CCC TTTT\ CCC TTTT\ CCCC CC\ TTTT\ CCCCCCCCCCCC\ TTTT\ CCCCCCCCC\ TTTT\ \\\\\\\\\ \\\\\

SSSSSS\ SSSS\ SSS\ SSSS\ SSSS\ SSSS\ SSS\ SSS\ SSSS\ SSSSSS\ \\\\\\\

IBM

S/390

ENTER LOGON OR LOGON <USERID>

CICS1

OR IMS

2007, Cognizant Technology Solutions

Confidential

Authentication screen
------------------------------- TSO/E LOGON -----------------------------------

Enter LOGON parameters below: Userid Password ===> USERID ===>

RACF LOGON parameters:

New Password ===> Group Ident ===>

Procedure ===> IKJUSER 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 ==> Reshow You may request specific help information by entering a '?' in any entry field

2007, Cognizant Technology Solutions

Confidential

ISPF Main Menu


----------------------OPTION ===> 0 1 2 3 4 5 6 7 8 9 TS SD T D CC X ISPF PARMS BROWSE EDIT UTILITIES FOREGROUND BATCH COMMAND DIALOG TEST DB2 MQSeries TOOLS SDSF TUTORIAL DEBUG TOOL CCCA EXIT ISPF/PDF PRIMARY OPTION MENU ---------------- <USERID> - <CurrentDate> - <CurrentTime> USERID Specify terminal and user parameters DATE Display source data or output listings TIME Create or change source data Perform utility functions Invoke language processors in foreground Submit job for language processing Enter TSO command or CLIST Perform dialog testing Perform DATABASE 2 Interactive Functions Websphere MQ Interactive Functions Tools SDSF Panel Display information about ISPF/PDF Debug Tool Utility Functions COBAL CICS Conversion Aid Terminate ISPF using log and list defaults

Enter END command to terminate ISPF.

2007, Cognizant Technology Solutions

Confidential

10

Utility Menu
Menu Help -----------------------------------------------------------------------------Utility Selection Panel Option ===> 1 2 3 4 Library Compress or print data set. Print index listing. Print, rename, delete, browse, edit or view members Data Set Allocate, rename, delete, catalog, uncatalog, or display information of an entire data set Move/Copy Move, or copy members or data sets Dslist Print or display (to process) list of data set names. Print or display VTOC information Reset Reset statistics for members of ISPF library Hardcopy Initiate hardcopy output Transfer Download ISPF Client/Server or Transfer data set Outlist Display, delete, or print held job output Commands Create/change an application command table Format Format definition for formatted data Edit/Browse SuperC Compare data sets (Standard Dialog) SuperCE Compare data sets Extended (Extended Dialog) Search-For Search data sets for strings of data (Standard Dialog) Search-ForE Search data sets for strings of data Extended (Extended Dialog)

5 6 7 8 9 11 12 13 14 15

2007, Cognizant Technology Solutions

Confidential

11

Utility Options
Option 2 from the utilities menu (or) 3.2 from the ISPF main menu helps us

to allocate, delete and rename datasets, both PDS and PS.


Option 3 from the utilities menu (or) 3.3 from the ISPF main menu helps us

to move or copy datasets.


Option 4 from the utilities menu (or) 3.4 from the ISPF main menu helps us

to print or display datasets.

2007, Cognizant Technology Solutions

Confidential

12

Dataset Allocation
Menu RefList Utilities Help Data Set Utility Option ===>

A R D blank

Allocate new data set Rename entire data set Delete entire data set Data set information

C U S V

Catalog data set Uncatalog data set Short data set information 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)

2007, Cognizant Technology Solutions

Confidential

13

Dataset Allocation (Contd)


Menu RefList Utilities Help Allocate New Data Set Command ===>

More:
Data Set Name . . . : . . . . . . . . . . . . . . . . . . (Blank for default management class) (Blank for default storage class) (Blank for system default volume) ** (Generic unit or device address) ** (Blank for default data class) (BLKS, TRKS, CYLS, KB, MB, BYTES or RECORDS) (M, K, or U) (In above units) (In above units) (Zero for sequential data set) *

Management class Storage class . Volume serial . Device type . . Data class . . . Space units . .

Average record unit Primary quantity . Secondary quantity Directory blocks . Record format . . . Record length . . . Block size . . . . Data set name type

. . . . . :

Expiration date . . .

(LIBRARY, HFS, PDS, or blank) * (YY/MM/DD, YYYY/MM/DD YY.DDD, YYYY.DDD in Julian form

2007, Cognizant Technology Solutions

Confidential

14

Field Description
Management Class
TSO tries to acquire management-related information (migration, backup,

retention criteria etc) from the Management Class for default dataset information and allocates the dataset. allocation.

Storage Class
Used to obtain the storage-related information (volume serial) for the data set

Data class Used to obtain the data-related information (space units, primary quantity, Primary Quantity
The amount of space allocated for the dataset.

secondary quantity, directory block, record format, record length, and data set name type) for the allocation of the data set.

Secondary Quantity
Used to allocate additional space to the dataset when the space allocated in the

primary allocation is insufficient.

2007, Cognizant Technology Solutions

Confidential

15

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 0 denotes that the dataset is a PS.

Record Format
The value in this field determines the format of the PDS or PS being

allocated.

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 data to put into each block, based on the record length.

2007, Cognizant Technology Solutions

Confidential

16

Line Commands
After you create & display a data set list, you can enter a line command to
V E B C D R I Z CO MO X NX View Data Set Edit Data Set Browse Data Set Catalog Data Set Delete Data Set Rename Data Set Data Set Information Compress Data Set Copy Move Exclude Data Set Unexclude Data Set

the left of the data set name. The most frequently used line commands are:

2007, Cognizant Technology Solutions

Confidential

17

Primary Commands
Following are the list of frequently used primary commands. For more

details on these commands and an exhaustive list, refer to the ISPF manual on 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 sequential dataset RESET Redisplays excluded data sets and removes line commands. FIND Finds a string within the data set name EXCLUDE Excludes a line containing a string within the data set name. DSLSET Displays the data set list settings panel REFRESH Refreshes the displayed list with any changes that have occurred.

2007, Cognizant Technology Solutions

Confidential

18

Scrolling
Valid values on the scroll field and their properties are :
CSR

Specifies that the screen will scroll depending on the cursor position 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 the specified number of lines, irrespective of the cursor position. (nnn represents a number)

2007, Cognizant Technology Solutions

Confidential

19

Basic Line Commands


A single blank line is inserted with an I in 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 the

number of lines to be deleted). A block of lines can be deleted by placing the lines to be deleted between a pair of DD commands. Place a DD on the first line of the block and a DD on the last line of the block and press ENTER. This deletes all the lines between the DDs

2007, Cognizant Technology Solutions

Confidential

20

Move/Copy Commands
The copy and move commands are similar in execution but for the fact that

the Copy command retains the original content but Move remove the content 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 line where you want the data to be placed and press ENTER. Placing a B instead of A, copies the information before the line. A combination of CC and A/B does the same for a block of lines. Use M and MM with A/B similarly to move the data.

2007, Cognizant Technology Solutions

Confidential

21

Commands
Text handling Commands
LC lowercase, to change text from uppercase to lowercase . UC uppercase, 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. XX identifies the first and last lines of a block of lines to be excluded. (Usage is like Block copying)

2007, Cognizant Technology Solutions

Confidential

22

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.

2007, Cognizant Technology Solutions

Confidential

23

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 and typically used for the source change compares Word Comparison Checks the differences at the word level. A word is a string separated by one or more blanks or a line separator. Byte Comparison Byte level comparison with the output in HEX (Like a dump).

2007, Cognizant Technology Solutions

Confidential

24

SuperCE Compare (Cont.)


The Compare output can be listed in the following five ways
OVSUM Lists the Overall Summary of the changes. In case of PDS comparison

the 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 each line of output. CHNG Lists the differences with a specified number of lines before and after the changes. Makes the user comfortable in reading the output in case 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 output data is flagged. The format is the same as the DELTA with all matching data shown. Nolist Generates no listing output. Used to quickly find if any data is changed between two datasets.
2007, Cognizant Technology Solutions Confidential 25

Search-For Utility
This option is used to search for a particular string in a dataset or members

of a PDS
Option 3.14 from the main menu (or) 14 from the Utilities Menu takes you

to the appropriate panel.


The search string can optionally be followed by one of the following

keywords:
WORD PREFIX SUFFIX

Lists full word occurrences of the string Lists only if the string is a prefix to a word. Lists only if the string is a suffix to a word.

2007, Cognizant Technology Solutions

Confidential

26

Q&A
Questions from participants

2007, Cognizant Technology Solutions

Confidential

27

Test Your Understanding

1. 2. 3. 4.

What is TSO? Which option is used to allocate the new dataset? What is the use of Option 3.3? Which command helps you to replace a particular text in a dataset?

2007, Cognizant Technology Solutions

Confidential

28

JCL

C3: Protected

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

2007, Cognizant Technology Solutions

Confidential

30

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.

2007, Cognizant Technology Solutions

Confidential

31

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.

2007, Cognizant Technology Solutions

Confidential

32

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

2007, Cognizant Technology Solutions

Confidential

33

Types of JCL statements


There are three types of JCL statements. They are:
JOB Identifies the beginning of a job
EXEC Indicates what work is to be done DD

Data Definition, i.e., identifies what resources (datasets) are needed and where to find them

2007, Cognizant Technology Solutions

Confidential

34

The Job Statement


The JOB statement informs the operating system of the start of a job, gives

the necessary accounting information, and supplies run parameters. Each job 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 JOB Userid

A descriptive name assigned to the job by the user Keyword that indicates the beginning of a job It is 1 to 7 character user identification assigned to access the system TIME Total minutes allowed for a job to execute MSGCLASS Describes where the output of a job log should be directed NOTIFY User-id of the user who receives a TSO message upon completion of the job
2007, Cognizant Technology Solutions Confidential 35

The EXEC Statement


The EXEC (execute) statement is used to identify the application program

or cataloged procedure or in-stream procedure that this job is to execute and 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 or cataloged procedure procedure Name of the cataloged procedure to be executed program Name of the program to be executed
2007, Cognizant Technology Solutions Confidential 36

Data Definition (DD) Statement


A DD (Data Definition) statement must be included after the EXEC

statement for each data set used in the step. volume to use, and the data set disposition.

The DD statement gives the data set name, I/O unit, perhaps a specific The DD statement may also give the system various information about the

data 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 identifier or keyword operand - parameters used to define the input or output dataset
2007, Cognizant Technology Solutions Confidential 37

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

2007, Cognizant Technology Solutions

Confidential

38

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 the

same step.

2007, Cognizant Technology Solutions

Confidential

39

Beginning Dispositions
The various beginning disposition parameters are:
NEW creates a new data set OLD designates an existing data set; it can be an input data set or an output data

set to rewrite
SHR identical to OLD except that several jobs may read from the data set at the

same time.
MOD modifies a sequential data set - positions the pointer at the end of the data

set in order to add new data to the data set.

2007, Cognizant Technology Solutions

Confidential

40

Normal and Abnormal termination Dispositions


Normal disposition, the second term in the DISP parameter, indicates the

disposition 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:
PASS passes the data set on to subsequent job steps, and each step can use the data set

once.
KEEP keeps non-temporary data sets. DELETE deletes data sets. CATLG catalogs 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.
UNCATLG un-catalogs a data set. UNCATLG is the same as KEEP except that the data set

name is removed from the catalog.


2007, Cognizant Technology Solutions Confidential 41

Space parameter
All new data sets on disk volumes must be allocated space. Storage on disk

volumes can be allocated in units of blocks, cylinders, tracks, kilobytes, and bytes. The space may be requested as a primary and a secondary quantity. The primary quantity is allocated when the data set is opened with a disposition 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 secondary Allocates this amount of space each time more is needed (up to 15 times) directory reserve this amount of blocks to keep the directory of a partitioned dataset (NOT USED for a sequential dataset).1 directory block allows 5 members in a partitioned dataset
2007, Cognizant Technology Solutions Confidential 42

Dataset Attributes
Data Set attributes are:
RECFM=xx specifies 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=zz specifies the blocksize, this denotes the number of records read in a single read operation

2007, Cognizant Technology Solutions

Confidential

43

JCL ABEND CODES


ABEND is the acronym of ABnormalEND. This is similar to run-time exceptions in windows platform. JCL ABEND codes are:
S0CB Attempting to divide by 0 and not using ON SIZE ERROR S002 Very large record length/ wrong record length S222 The job was cancelled (by subsystem or operator) because it
S522 S806 S837 S913 SOC7 SOC4 S0C1 SE37

violated some restriction JOB or TSO session exceeded maximum job wait time OR operator did not mount the require tape within allowed time limit Load module not found Space problem, Allotted space is not enough for data set You are trying to access a dataset which you are not authorized to use. 1. Moving non-numeric value to numeric field 2. Not initializing the numeric variables before first use 1. Index exceeds the size of table 2. Trying to use File Section variables without opening the file Operation Exception. Check for subscript errors, missing DD card, file not opened. Insufficient disk space.
2007, Cognizant Technology Solutions Confidential 44

Questions
Questions from participants

2007, Cognizant Technology Solutions

Confidential

45

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?

2007, Cognizant Technology Solutions

Confidential

46

VSAM

C3: Protected

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 byte

address.

2007, Cognizant Technology Solutions

Confidential

48

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

2007, Cognizant Technology Solutions

Confidential

49

VSAM Datasets
VSAM datasets are of 4 types:
ESDS Entry Sequenced Data Set
KSDS Key Sequenced Data Set RRDS Relative 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
2007, Cognizant Technology Solutions Confidential 50

IDCAMS
IDCAMS utility is used to handle VSAM data sets

Some of the functions are as follows,

DESCRIPTION Create Copy Print Delete Lists Characteristics

KEYWORDS DEFINE REPRO PRINT DELETE LISTCAT

2007, Cognizant Technology Solutions

Confidential

51

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

2007, Cognizant Technology Solutions

Confidential

52

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

2007, Cognizant Technology Solutions

Confidential

53

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

2007, Cognizant Technology Solutions

Confidential

54

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 existing

records No primary Index or Alternate Index Supports Fixed and Variable formats RRN cannot be changed

2007, Cognizant Technology Solutions

Confidential

55

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

2007, Cognizant Technology Solutions

Confidential

56

IDCAMS
Always has the following JCL structure

//STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD* <IDCAMS command from col.2 to col.72> /* //* Basic IDCAMS Commands
DEFINE (Cluster, Alternate Index etc.) BUILDINDEX (Alternate Index)

REPRO (Cluster)
LISTCAT (Catalog Entries) IMPORT / EXPORT (Cluster) VERIFY (Cluster)
2007, Cognizant Technology Solutions Confidential 57

DEFINE

DEFINE command is used to create a Cluster, Index or

Alternate 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.

2007, Cognizant Technology Solutions

Confidential

58

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 is

mandatory All other parameters are optional

2007, Cognizant Technology Solutions

Confidential

59

REPRO (Contd.,)
SKIP specifies number of input records to skip before

beginning to copy COUNT specifies number of output records to copy REUSE parameter
Can be used only if the VSAM dataset was originally defined with REUSE

option 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 is inappropriate.
2007, Cognizant Technology Solutions Confidential 60

ALTER & DELETE


ALTER
Used to change parameters such as FREESPACE Has no effect on existing CI & CA splits Syntax: ALTER entry-name

DELETE
DELETE <object name> (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


2007, Cognizant Technology Solutions Confidential

61

Batch Execution

C3: Protected

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

2007, Cognizant Technology Solutions

Confidential

63

Job and Job Processing : Introduction


A job is a set of data and the instructions that tell the system what you want it to do

with that data.


A batch job is submitted to the system in its entirety, including instructions and

data.
The SUBMIT command in TSO sends jobs to z/OS (OS/390).

Batch Job Processing


system assigns it a five-digit JOB-ID to each new job, it will exist until it leaves

the system . It uniquely identifies your job . JES2 (Job Entry Subsystem) controls the processing of batch jobs. When a job is submitted, the userid and password are checked. Jobs are submitted in job classes, which specify the type of job, and help determine the priority . The job's position in the queue depends upon several factors like job class , job's size, amount of time the job is in the system.
2007, Cognizant Technology Solutions Confidential 64

Job Processing (continued)


When the job finishes executing, it is placed into a queue of jobs waiting to be

printed. 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 automatically purged by the system.

2007, Cognizant Technology Solutions

Confidential

65

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 called priority 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.

2007, Cognizant Technology Solutions

Confidential

66

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 .
2007, Cognizant Technology Solutions Confidential 67

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.

2007, Cognizant Technology Solutions

Confidential

68

Questions from participants

2007, Cognizant Technology Solutions

Confidential

69

Test Your Understanding

1. What is the batch Job?


2. What are different job class are there and how they help ?

2007, Cognizant Technology Solutions

Confidential

70

Batch Execution : Summary


In this chapter you have learnt about
Introduction to Batch Job
Job Processing Job priorities Different types of class

2007, Cognizant Technology Solutions

Confidential

71

COBOL Basics
Common Business Oriented Language

C3: Protected

COBOL - Overview
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

2007, Cognizant Technology Solutions

Confidential

73

COBOL: Objectives
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

2007, Cognizant Technology Solutions

Confidential

74

Divisions
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]

2007, Cognizant Technology Solutions

Confidential

75

Environmental Division
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]

2007, Cognizant Technology Solutions

Confidential

76

Data Division and Procedure Division


Data Division:
The Data Division defines the nature and characteristics of all data (variables) the program is to process. This includes both Input/Output data and data used for internal processing. Data Division has the following section
1. FILE SECTION This describes most of the data that is sent to, or coming from, the computers peripherals. 2.WORKING-STORAGE SECTION This describes the general variables used in the program. 3.LINKAGE SECTION This 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.

2007, Cognizant Technology Solutions

Confidential

77

Data Types in COBOL


Alphabetic Numeric

Alphanumeric
Edited numeric Edited alphanumeric

Figurative constants:
Figurative constants ZERO(S) or ZEROES Meaning Represents the value 0, one or more depending on the context

SPACE(S) HIGH-VALUE(S) LOW-VALUE(S) QUOTE(S) ALL literal

Represents one or more spaces Represents the highest value Represents the lowest value Represents single or double quotes Fill With Literal

2007, Cognizant Technology Solutions

Confidential

78

Data Names and Picture Clause


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 PROCEDURE DIVISION
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 number expresses data hierarchy


(2) PICTURE clause specifies data type and storage (3) VALUE clause initializes the data names

PICTURE clause: Is used to specify the following


(1) The data type (2) The storage requirement

Can be abbreviated as PIC.

2007, Cognizant Technology Solutions

Confidential

79

Level Numbers & Picture Clause


Level syntax number:
LEVEL NUMBER 1 02 49 66 Description Record Description for files and independent data items Fields within records and sub-items RENAMES Clause Coding Rules Must begin in Area A Can begin in Area A or Area B Must begin in Area A

77
88

Independent elementary items


Condition Names

Must begin in Area A


Can begin in Area A or Area B

Picture Clause:
PICTURE Symbol 9 A X Meaning Numeric Alphabetic Alphanumeric

2007, Cognizant Technology Solutions

Confidential

80

REDEFINES Clause
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 and data- 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 VALUE clauses 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 assumed to be the redefinition of the first 01 level record.
2007, Cognizant Technology Solutions Confidential

implicitly
81

RENAMES Clause:
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 however cant 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 can they 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 sub fields.

2007, Cognizant Technology Solutions

Confidential

82

USAGE Clause:
These are forms of internal representation of data in the memory.
1.Computational 2. Display 3.Packed decimal

The syntax of the USAGE clause is USAGE IS {BINARY COMP COMPUTATIONAL COMP-1 COMPUTATIONAL-1 COMP-2 COMPUTATIONAL-2 COMP-3 COMPUTATIONAL-3 COMP-4 COMPUTATIONAL-4 DISPLAY PACKED-DECIMAL}

2007, Cognizant Technology Solutions

Confidential

83

Binary Clause
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 same absolute value.

The amount of storage occupied by a binary item depends on the number of decimal digits defined in its PICTURE clause
Digits in PICTURE Clause Storage Occupied

1 through 4 5 through 9 10 through 18

2 bytes (halfword) 4 bytes (fullword) 8 bytes (doubleword)

COMPUTATIONAL or COMP: This is the equivalent of BINARY. The COMPUTATIONAL phrase is synonymous with BINARY.
2007, Cognizant Technology Solutions Confidential 84

Computational Clauses
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 one digit takes half-a-byte. The sign is stored separately as rightmost half-a-byte regardless of whether S is specified in the PIC clause 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
2007, Cognizant Technology Solutions Confidential 85

Index Clause
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 describe group or elementary items described with the USAGE IS INDEX clause.
2007, Cognizant Technology Solutions Confidential 86

Procedure Division Verbs


Data movement Verb Move copies data from the source identifier or literal to one or more destination identifiers Syntax: MOVE {identifier, literal} to {indentifier} Arithmetic Verbs
1.ADD 2.SUBTRACT 3.MULTIPLY 4.DIVIDE 5.COMPUTE

Input / Output Verbs


1. ACCEPT Verb Syntax: ACCEPT identifier [ FROM { DATE, DAY, TIME, mnemonic-name }]. 2. DISPLAY Verb Syntax: DISPLAY { identifier-1, literal-1 } .

Sequence control Verbs


1. GO TO 2. IF . . . THEN . . . 3. EVALUATE 4. STOP RUN 5. PERFORM

2007, Cognizant Technology Solutions

Confidential

87

Files
FILE Types:
1.Sequential 2.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
2007, Cognizant Technology Solutions Confidential 88

Read Clause
READ: Format-1 - Sequential Read
Syntax: 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 Read
Syntax: 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 1.Data name specified in KEY phrase 2.The prime RECORD KEY data name is taken if KEY phrase not specified Relative random read The KEY phrase must not be specified Statement reads the record whose relative record number is contained in the RELATIVE KEY data item,

2007, Cognizant Technology Solutions

Confidential

89

Start Clause
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.

2007, Cognizant Technology Solutions

Confidential

90

Rewrite Clause
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 in identifier-1 File position indicator not affected For Sequential files - INVALID KEY not allowed - Record length cant change

2007, Cognizant Technology Solutions

Confidential

91

Delete Clause
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 successfully executed READ statement. When the DELETE statement is executed, the system removes the record 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) or RELATIVE 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.

2007, Cognizant Technology Solutions

Confidential

92

Sort
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 be variably 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
2007, Cognizant Technology Solutions Confidential 93

Sort (cont)
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 PROCEDURE before sort operation., Then the processed records are released to SORT operation using RELEASE statement.

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 discussed later in this chapter.

Return: Transfers records from the final phase of a sorting or merging operation to an OUTPUT PROCEDURE.Its like READ statement
2007, Cognizant Technology Solutions Confidential 94

Merge
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.
2007, Cognizant Technology Solutions Confidential 95

Sub Program
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
2007, Cognizant Technology Solutions Confidential 96

Sub Program (cont)


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 a CANCEL, 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)

2007, Cognizant Technology Solutions

Confidential

97

Search
To search a table element that satisfies a specified condition SEARCH VARYING LINEAR SEARCH SEARCH ALL
Search Syntax: SEARCH id-1 [ VARYING { id-2 index-name-1 } ] [ AT END imperative-statement-1 ] WHEN condition-1 { imper-stmt2 NEXT SENTENCE } [ END-SEARCH ] This search is serial search or linear search Set starting points of index. The increment of the index taken care of by the search statement itself. The table may sorted or not SEARCH ALL Syntax: SEARCH ALL id-1 [ AT END imperative-statement-1 ] WHEN { dataname-1= equal-clause Condition-name-1} NEXT SENTENCE } [ END-SEARCH ] This SEARCH all is the Binary search. Initial setting of index ignored, but if set it must not be greater than the maximum For this search the table needs to be in sorted order using ASCENDING/DESCENDING option in occurs clause

2007, Cognizant Technology Solutions

Confidential

98

Questions
Questions from participants

2007, Cognizant Technology Solutions

Confidential

99

Test Your Understanding


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?

2007, Cognizant Technology Solutions

Confidential

100

Introduction to CICS
Customer Information Control System

C3: Protected

Introduction to CICS
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.

2007, Cognizant Technology Solutions

Confidential

102

Objectives
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

2007, Cognizant Technology Solutions

Confidential

103

Basic Terminology in CICS


Terminology:
Field is basic element in CICS UI (User Interface). Each and every option available in the

screen 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.


Mapset is a collection of maps linked together. It is used to logically group the maps. Transaction-ID is the unique four digit number assigned to each online program.

Symbolic Map is the copybook generated after compilation of a map.


Physical Map is the load-module (binary file) generated after compilation of a map.

2007, Cognizant Technology Solutions

Confidential

104

Hierarchy of CICS Objects


Transaction

Calls / Uses

Mapset

Contains

Map

Contains

Field

2007, Cognizant Technology Solutions

Confidential

105

Naming Conventions
The below naming convention should be used while creating Maps or

CICS-COBOL programs
S. No
1
2 3 4 5

Object
Map
Mapset CICS-COBOL program Load Module Transaction ID

Name to be Used
Map Name Allocated by Mainframe Administrator
Mapset Name Allocated by Mainframe Administrator Program Name Allocated by Mainframe Administrator Same as CICS-COBOL program name Transaction ID allocated by Mainframe Administrator

2007, Cognizant Technology Solutions

Confidential

106

Introduction to Creating Maps

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. While creating maps, follow the below order:
Mapset Map A Field A Field Map A Field A Field Map A Field A Field

Column format for coding :


Col.1 Name Col.16 Operation Operands (Parameters separated by commas)
2007, Cognizant Technology Solutions

Col.72 Continuation Character


Confidential 107

Creating Mapset
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]]

2007, Cognizant Technology Solutions

Confidential

108

Creating Mapset (Contd.)


Sample program:
Mapset1 DFHMSD TYPE=&&SYSPARM, CTRL=(FREEKB,FRSET), LANG=COBOL, STORAGE=AUTO, TIOAPFX=YES, MODE=INOUT, TERM=3270 . Map Definitions .. DFHMSD TYPE=FINAL END X

X X X X X

Where,
Mapset1

Mapset name, can't be more than 8 characters, and must start in the 1st column. CTRL=(FREEKB,FRSET) Control parameters, FREEKB is used to free the keyboard when an 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.
2007, Cognizant Technology Solutions Confidential 109

Creating Map
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]

2007, Cognizant Technology Solutions

Confidential

110

Creating Map (Contd.)


Sample program:
MAPNAME DFHMDI SIZE=(24,80),
LINE=01, COLUMN=01, CTRL=(FREEKB,FRSET) . FIELD Definitions .

X
X X

Where,
SIZE LINE COLUMN

The rows and columns the map occupies the screen. The starting row of the map in the screen. 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.

2007, Cognizant Technology Solutions

Confidential

111

Creating Fields
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.
2007, Cognizant Technology Solutions Confidential 112

Creating Fields (Contd.)


Sample program:

DFHMDF

POS=(01,01), LENGTH=4, INITIAL=SCR1, ATTRB=(PROT,NORM)

X X X

Where,
POS LENGTH INITIAL ATTRB

The row number and column number where the field will be positioned. The total length of the field. The initial value that will be displayed in the field. Whether the field is a protected or unprotected field.

2007, Cognizant Technology Solutions

Confidential

113

Sample Map
Complete sample Map

MAPSET1 DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL,STORAGE=AUTO, TIOAPFX=YES MAP1 DFHMDI SIZE=(24,80),LINE=1,COLUMN=1 DFHMDF POS=(7,16),INITIAL='ENTER THE NO :',LENGTH=15, ATTRB=PROT NUM DFHMDF POS=(7,32),LENGTH=5,ATTRB=(UNPROT,IC) DFHMDF POS=(7,38),LENGTH=1,ATTRB=ASKIP DFHMDF POS=(9,16),INITIAL='ENTER THE NAME:',LENGTH=15, ATTRB=PROT NAME DFHMDF POS=(9,32),LENGTH=5,ATTRB=UNPROT DFHMDF POS=(22,10),INITIAL='MESSAGE :',LENGTH=10,ATTRB=PROT MSG DFHMDF POS=(22,25),LENGTH=30,ATTRB=PROT MAPSET1 DFHMSD TYPE=FINAL END

X X

After defining the map, compile the map using the sample map compiler.

2007, Cognizant Technology Solutions

Confidential

114

Sample Map (Contd.)


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))
2007, Cognizant Technology Solutions Confidential 115

Sample Map (Contd.)


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 SYSPUNCH DD statement enter the copy-library name. In SYSIN DD statement enter the map-library name.

In SYSLMOD DD statement enter the load-library name.

2007, Cognizant Technology Solutions

Confidential

116

Viewing a Map
After successful compilation, login to CICS region and enter the below command,
CEMT SET PROGRAM(Load_Module_Name) NEW 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.

After successful completion of the above command, Hit Pause/ Break button in keyboard to 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.

2007, Cognizant Technology Solutions

Confidential

117

Embedding CICS in COBOL


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 the below statement,
WORKING-STORAGE SECTION. COPY symbolic_map_name.

Then the CICS maps can be sent through COBOL programs using SEND MAP command as follows,
EXEC CICS SEND MAP('Map_Name') MAPSET('Mapset_Name') ERASE END-EXEC.

The CICS maps can be received through COBOL programs using RECEIVE MAP command as follows,
EXEC CICS RECEIVE MAP('Map_Name') MAPSET('Mapset_Name') INTO(SymbolicMap_InputVar) END-EXEC.

2007, Cognizant Technology Solutions

Confidential

118

Embedding CICS in COBOL (Contd.)


After executing a RECEIVE MAP command, all the values entered in the unprotected fields are populated in the copybook variable (that is specified in the INTO clause).

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 RETURN END-EXEC.

2007, Cognizant Technology Solutions

Confidential

119

Sample CICS-COBOL Compiler


Sample CICS-COBOL compiler:
//CICSCOMP JOB MSGCLASS=O,MSGLEVEL=(1,1),CLASS=T, // REGION=5M,NOTIFY=&SYSUID //********************************************************************** // SET MEMNAME=PGMNAME <- SOURCE PGM NAME // SET LOADMEM=LODNAME <- LOAD MODULE NAME // SET SOURCE=CTS. CICS.COBOL <-SOURCE LIBRARY // SET COPYBOOK=CTS.CICS.COPYLIB <- COPY LIBRARY // SET LOADLIB=TIG06431.CICS.LOAD <- LOAD LIBRARY //********************************************************************** //* CICS TRANSLATOR * //********************************************************************** //PRECOMP EXEC PGM=DFHECP1$, // PARM='NOSOURCE,NOSEQ,' //STEPLIB DD DSN=CICSTS23.CICS.SDFHLOAD,DISP=SHR // DD DSN=TIG06431.CICS.LOAD,DISP=SHR //SYSIN DD DISP=SHR,DSN=&SOURCE(&MEMNAME) //SYSLIB DD DSN=CICSTS23.CICS.SDFHCOB,DISP=SHR // DD DSN=U131184.TRAIN.CICS.COPYLIB,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSPUNCH DD DSN=&&SYSIN00,DISP=(,PASS),UNIT=SYSDA, // DCB=BLKSIZE=400,SPACE=(CYL,(10,10))

2007, Cognizant Technology Solutions

Confidential

120

Sample CICS-COBOL Compiler (Contd)


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=&COPYBOOK //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) // /* 2007, Cognizant Technology Solutions Confidential 121

Sample CICS-COBOL Compiler (Contd)


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 command in 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.

2007, Cognizant Technology Solutions

Confidential

122

Q&A
Questions from participants

2007, Cognizant Technology Solutions

Confidential

123

Test Your Understanding


List the Hierarchy of CICS Objects? How will you creating Maps using Basic Mapping Support assembler macros?

1. 2.

3.
4.

How will you send & receive the maps in the CICS-COBOL program?
How will you receive the map in CICS region?

2007, Cognizant Technology Solutions

Confidential

124

Introduction to DB2 Basics

C3: Protected

Database: Overview
Introduction:
A database, for example, can contain all the data (in form of Tables) that is

associated 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 same database Whenever a table space is created, it is explicitly or implicitly assigned to an existing database.

2007, Cognizant Technology Solutions

Confidential

126

Db2: Objectives
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

2007, Cognizant Technology Solutions

Confidential

127

Db2
Db2:
Db2 is relational database.

In a relational database, data is perceived to exist in one or more tables. Each

table contains a specific number of columns and 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 .

2007, Cognizant Technology Solutions

Confidential

128

SQL( Structured Query Language )


The language that you use to access the data in DB2 tables is the Structured Query Language (SQL). Based on functionality SQL can be classified into 3 categories,
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 optimize data retrieval. This transformation occurs when the SQL statement is prepared. This transformation is also known as binding.
2007, Cognizant Technology Solutions Confidential 129

Tables: a brief introduction


Tables are logical structures that DB2 maintains. Tables are made up of columns and rows. DB2 supports several different types of tables, some of which

are 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 GLOBAL TEMPORARY TABLE or DECLARE GLOBAL TEMPORARY TABLE to hold data temporarily. Its useful to sort or query intermediate result tables that contain a large number of rows, but you want to store only a small subset of those rows permanently . 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 large amounts of data
2007, Cognizant Technology Solutions Confidential 130

View, Alias & Synonyms


Views are virtual tables based on one or more base tables.
When data in the base table changes, these changes are also reflected in the

view. 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.

2007, Cognizant Technology Solutions

Confidential

131

Indexes and Keys


An index is 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 this structure 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

A key is one or more columns that are identified as such in the description

of a table, an index, or a referential constraint.


Unique Keys - A table can have any number of unique keys. The columns of a

unique 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 a referential constraint. Foreign Keys - A foreign key refers to or is related to a specific parent key.

2007, Cognizant Technology Solutions

Confidential

132

Table spaces and Index spaces


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 single table . Partitioned - table space can contain only a single table and its divided into separate units of storage called partitions . Large object (LOB) - contains all the data for a particular LOB column in the related base table. Universal table space - combination of partitioned and segmented table space schemes that provides better space management. it's a good choice for tables that 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.

2007, Cognizant Technology Solutions

Confidential

133

Accessing DB2 Tables in Mainframes


DB2 tables can be accessed in mainframes through SPFUI or

QMF (Query Management Facility). To access DB2 from Cognizant Mainframes, enter Option 8 from ISPF main menu. Under DB2 Primary Option Menu, enter 1 to access SPFUI. Enter the input dataset name, where you will be writing all DB2 queries. Enter the output dataset name, where you will be viewing all the output of the queries. Hit an Enter. In Current SPFUI Defaults screen, again hit an enter.

2007, Cognizant Technology Solutions

Confidential

134

Accessing DB2 Tables ( Continued)


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 Tablespace. 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 the command line and hit an F3. Now you can view the output of the query. To again come back to the query input screen, enter three semi-colons ;;; in the command line and hit an F3. To exit SPFUI, hit an F3.
2007, Cognizant Technology Solutions Confidential 135

Questions from participants

2007, Cognizant Technology Solutions

Confidential

136

Test Your Understanding


What is the difference between unique and primary key? What is the benefit of index and keys? Which is the tool / utility used to access DB2 tables in Mainframes?

1. 2. 3.

2007, Cognizant Technology Solutions

Confidential

137

DB2 : Summary
In this chapter you have learnt about
Introduction to database
What is Db2 Difference between tables, views and alias Different types of keys

Table spaces

2007, Cognizant Technology Solutions

Confidential

138

REXX
Restructured EXtended eXecutor

C3: Protected

REXX: Overview
Introduction:
REXX is a programming language that is extremely flexible. REXX is the

abbreviation of Restructured EXtended eXecutor. It can be used to link various environments like TSO, ISPF, etc., It is the widely used programming language for developing tools in mainframes.

2007, Cognizant Technology Solutions

Confidential

140

Objectives

After completing this chapter, you will be able to understand the following:
Writing and Executing a REXX Exec

Rexx Syntax
Variables & Expressions Operators Parsing

Conditional & Looping Statements


Interrupt Instructions Functions & Sub-routines Built-in Functions

Read a Dataset Using REXX


Writing into a Dataset Using REXX

2007, Cognizant Technology Solutions

Confidential

141

Features of REXX
Various features of REXX are as follows,
Ease of Use
Free format

Debugging capabilities
Interpreted language

2007, Cognizant Technology Solutions

Confidential

142

Writing a REXX Exec


Inorder to write a REXX program called an exec, there is a need to create a data set to contain the exec. The data set can be either sequential or partitioned. A REXX exec consists of REXX language instructions that are interpreted directly by the REXX interpreter. For example, an exec to display a sentence on the screen uses the REXX instruction SAY followed by the sentence to be displayed.
/******* REXX *******/ SAY 'This is a REXX exec'

When you run the exec, you can see the sentence in your screen
This is a REXX exec

2007, Cognizant Technology Solutions

Confidential

143

Executing a REXX Exec


REXX exec can be executed in the below four ways,
Explicit execution from TSO ready prompt
READY EXEC CTS.REXX.EXEC (MYFIRST) READY

Implicit execution from TSO ready prompt requires the PDS library to be concatenated to either SYSEXEC or the SYSPROC system DDNAMEs.
READY ALLOC DD(SYSEXEC) DSN(CTS.REXX.EXEC) SHR REUSE READY %MYFIRST

Implicit execution from ISPF requires the PDS library to be concatenated to either SYSEXEC or the SYSPROC system DDNAMEs. From the edit panel, enter the below command,
TSO CONCAT SYSEXEC CTS.REXX.EXEC

After successful concatenation, enter the PDS member name of the REXX exec you want to execute, in the command prompt of the edit panel.
2007, Cognizant Technology Solutions Confidential 144

Executing a REXX Exec(Contd.)


Batch Execution Need arises when the REXX exec takes longer time to complete the execution. Major advantage in batch mode does not interfere with persons use of the terminal. Only those execs which do not require any sort of terminal interaction can be run in batch mode. A JCL as shown below can be used to invoke a REXX exec.
//TSOBATCH EXEC PGM=IKJEFT01,DYNAMBR=30,REGION=4096K //SYSEXEC DD DSN=CTS.REXX.EXEC,DISP=SHR //SYSTSPRT DD SYSOUT=A //SYSTSIN DD * % SETUP /* //

Where,
IKJEFT01

TSO command processor program. SYSEXEC System DD card to which REXX libraries are concatenated. SYSTSPRT Destination of the REXX output. SYSTSIN In-stream card wherein TSO commands or invocation of REXX execs can be issued. The dataset CTS.REXX.EXEC is a PDS and has a member of the name SETUP.

2007, Cognizant Technology Solutions

Confidential

145

REXX Syntax
All REXX execs must have the first line as /* REXX */. This makes the command processor (TSO) invoke the REXX interpreter. A REXX instruction (statement) is not case sensitive. REXX uses a free format (Column restrictions are not enforced, like COBOL).

A line usually contains one instruction except when it ends with a comma (,) or contains a semi-colon (;).
Comma is the continuation character, indicates that the instruction continues to the next line. Semi-colon indicates the end of the instruction, used to separate multiple instructions on one line.

2007, Cognizant Technology Solutions

Confidential

146

Variables & Expressions


Variables need not be explicitly declared in REXX. Variable names can consist of the below character-set:
A....Z / a - Z 0....9 @ # $ ? ! . _ Alphabetic Numbers Special characters

Restrictions on the variable name are as follows:


The first character cannot be 0 through 9 or a period (.) The variable name cannot exceed 250 bytes. The variable name should not be RC, SIGL, or RESULT, which are REXX special variables.

Expressions are statements with something that needs to be calculated or evaluated. It consists of numbers, variables or strings and one or more operators.

2007, Cognizant Technology Solutions

Confidential

147

Operators

There are four types of operators in REXX, Arithmetic Operators. Comparison Operators. Logical Operators. Concatenation Operators. Arithmetic Operators works on valid numeric constants or on variables that represent valid numeric constants. The various arithmetic operators are as follows, + -number * ** / Add Subtract Negate the number Multiply Raise a number to a whole number power Divide

%
//

Divide and return a whole number without a remainder (quotient only)


Divide and return remainder only

2007, Cognizant Technology Solutions

Confidential

148

Operators (Contd)
Comparison Operators returns either a true or false response in terms of 1 or 0 respectively. The various comparison operators are as follows, == = > < >= <= /== /= >< /< /> Strictly Equal (everything including the blanks and case is exactly the same). Equal Greater than Less than Greater than or equal to Less than or equal to Not strictly equal Not equal Greater than or less than (same as not equal) Not less than Not greater than

2007, Cognizant Technology Solutions

Confidential

149

Operators (Contd)
Logical Operators combines two comparisons and return the True (1) or False (0) value depending on the results of the comparisons. The various logical operators are as follows,

&
| && Prefix \

AND (Returns 1 if both comparisons are true)


Inclusive OR (Returns 1 if at least one comparison is true) Exclusive OR (Returns 1 if only one comparison (but not both) is true) Logical NOT (Returns the opposite response)

Concatenation Operators combines two strings into one. The below are the various concatenation operators, blank || abuttal

concatenate strings, one blank in between example Cognizant Technology results is Cognizant Technology
concatenate strings, no blanks in between example a||.b result is a.b concatenate strings, no blanks in between example per_cent%, if per_cent = 90, result is 90%

2007, Cognizant Technology Solutions

Confidential

150

Operators (Contd)
Operator Priority is as follows, \- + ** * / % // + Blank || abuttal == = >< & | && Prefix operators Power (exponential) Multiply and Divide Add and Subtract Concatenation operators Comparison operators Logical AND inclusive OR, exclusive OR

2007, Cognizant Technology Solutions

Confidential

151

Parsing

Parsing is the process of separating data by comparing the data to a template (or pattern of variable names). Separators in a template can be one of the following, Blank String Variable Number that represents column position PARSE VALUE with blank example,
PARSE VALUE Cognizant Technology Solutions WITH Str1 Str2 Str3

Str1 contains Cognizant, Str2 contains Technology and Str3 contains Solutions. PARSE VALUE with separators example,
PARSE VALUE Dun & Bradstreet WITH Str1 & Str2

Str1 contains Dun and Str2 contains Bradstreet.

2007, Cognizant Technology Solutions

Confidential

152

Parsing(Contd.)
PARSE VAR (variable) with absolute column position example,
String1 = Dun & Bradstreet PARSE VAR String1 Str1 6 Str2

Str1 contains Dun & and Str2 contains Bradstreet PARSE VAR (variable) with relative column position example,
String1 = Dun & Bradstreet PARSE VAR String1 Str1 +5 Str2 +5 Str3

Str1 contains Dun &, Str2 contains Brad and Str3 contains street

2007, Cognizant Technology Solutions

Confidential

153

Conditional Statements

Two types of conditional statements in REXX are:


IF/THEN/ELSE SELECT/WHEN/OTHERWISE

Syntax of IF statement
IF expression THEN statement ELSE statement IF expression THEN DO statements END ELSE DO statements END

Syntax of SELECT statement


SELECT WHEN WHEN : expression statement expression statement THEN THEN

OTHERWISE statement(s) END


2007, Cognizant Technology Solutions Confidential 154

Looping Statements

Two types of looping statements in REXX are:


Repetitive repeat instructions a certain number of times. Conditional use a condition to control repeating.

Repetitive loops Example1


DO i = 1 to 5 SAY The Value of i is i END

Repetitive loops Example2


DO i = 1 to 10 STEP 2 SAY The Value of i is i END

Output of Example1:
The The The The The Value Value Value Value Value of of of of of i i i i i is is is is is 1 2 3 4 5

Output of Example2:
The The The The The Value Value Value Value Value of of of of of i i i i i is is is is is 1 3 5 7 9

2007, Cognizant Technology Solutions

Confidential

155

Looping Statements (Contd)


Infinite Loops are achieved in REXX using DO FOREVER loops. Example1 - DO FOREVER loop with EXIT statement
DO FOREVER IF X = 10 THEN EXIT END SAY Outside The Loop

Output of Example1: The above exec will execute till the value of X becomes 10. The next statement (SAY) will not be executed. Example2 - DO FOREVER loop with LEAVE statement
DO FOREVER IF X = 10 THEN LEAVE END SAY Outside The Loop

Output of Example2: The above loop will execute till the value of X becomes 10, after that the next statement (SAY) will be executed.

2007, Cognizant Technology Solutions

Confidential

156

Looping Statements (Contd)


Conditional Loops are achieved in REXX using DO WHILE and DO UNTIL statements. Syntax of DO WHILE statement:
DO WHILE expression statement(s) END

DO WHILE statement tests the expression before the loop executes the first time and repeat only when the expression is true. Syntax of DO UNTIL statement:
DO UNTIL expression statement(s) END

DO UNTIL statement tests the expression after the loop executes at least once and repeat only when the expression is false.

2007, Cognizant Technology Solutions

Confidential

157

Interrupt Instructions

Interrupt instructions tells the language processor to leave the exec entirely or leave one part of the exec and go to another part either permanently or temporarily There are three types of interrupt instructions as follows, EXIT SIGNAL CALL/RETURN EXIT statement causes the exec to terminate unconditionally. SIGNAL statement interrupts the normal flow of an exec and causes control to pass to a specified label. Example SIGNAL statement
/*REXX*/ SAY 'BEFORE SIGNAL' SIGNAL BYE SAY 'AFTER SIGNAL' EXIT

BYE: SAY 'INSIDE SIGNAL' EXIT

The output of the above exec is as follows


BEFORE SIGNAL INSIDE SIGNAL
2007, Cognizant Technology Solutions Confidential 158

Interrupt Instructions (Contd)


CALL / RETURN statement is used to pass the control to the specified sub-routine or label When calling an internal subroutine, CALL statement passes control to a label specified after the CALL keyword. When the subroutine ends with the RETURN instruction, the instructions following CALL are executed.
/*REXX*/ SAY ' BEFORE CALL' CALL BYE SAY ' AFTER CALL' EXIT BYE: SAY ' INSIDE CALL' RETURN

The output of the above exec is as follows,


BEFORE CALL INSIDE CALL AFTER CALL

2007, Cognizant Technology Solutions

Confidential

159

Functions & Sub-routines

Functions : Functions are sequence of statements that can receive data, process that data and return a value. Syntax of a function call:
Return_value = Function(arguments)

There are two types of functions, namely, Built-in functions (built into the language processor). User-defined functions.

Subroutines : Subroutine is a series of instructions that an exec invokes to perform a specific task. The subroutine is invoked by the CALL statement.

Subroutines are of two types as follows, Internal subroutine and designated by a label. External subroutine and designated by the member name that contains the subroutine. Sharing information can be done in the following ways, Passing variables Passing arguments

2007, Cognizant Technology Solutions

Confidential

160

Functions & Sub-routines (Contd)

Passing variables shares the same variable in both main exec and subroutine. The variables need not be explicitly passes as shown in the below example,
/**REXX**/ number1 = 20 number2 = 30 CALL sub1 SAY answer /** (Displays 50) **/ EXIT sub1: answer = number1 + number2 RETURN

We can prevent all the main exec variables from being exposed to subroutines by using PROCEDURE statement, as shown below,
/**REXX**/ number1 = 20 CALL sub2 SAY number1 /** (displays 20) **/ EXIT sub2: PROCEDURE number1 = 5 RETURN
2007, Cognizant Technology Solutions Confidential 161

Functions & Sub-routines (Contd)

We can expose only few main exec variables to subroutines by using PROCEDURE statement with EXPOSE, as shown below,
/**REXX**/ number1 = 10 number2 = 20 CALL sub3 SAY number1 , number2 /** (displays 5 , 20) **/ EXIT sub3: PROCEDURE EXPOSE number1 number1 = 5 number2 = 15 RETURN

Passing arguments can be done by calling the subroutine from the main exec as follows,
CALL subroutine_name argument1, argument2, argument3, etc

Receiving arguments in the subroutine is as follows,


ARG arg1, arg2, arg3, etc

Example - passing arguments to subroutines

/**REXX**/ length = 10 width = 7 Result = CALL Calc length, width SAY The perimeter is Result Meters EXIT Calc: ARG len, wid perim = 2 * ( len + wid) RETURN perim
Confidential

2007, Cognizant Technology Solutions

162

Built-in Functions
Some of Built-in-Functions in REXX are given below:
Compare function is used to compare two strings and return a zero if the strings are the same, or a non-zero number if they are not. Non-zero number is the position of the first mismatching character found. Syntax of Compare function:
COMPARE(string1,string2)

Example Compare function:


COMPARE('123','123')returns 0 (exact match) COMPARE('abc','ak')returns 2 (first mismatching char)

Syntax of Date function:


DATE({option})

Some of the options that can be passed to date function are as follows: U returns date in USA format, 'mm/dd/yy J returns a Julian date in the form 'yyddd W returns the day of the week (e.g. 'Tuesday', 'Sunday', etc.) Few examples for date function is as follows,
say date() say date('U') say date('J') say date('W') /* returns Current Date 24 Oct 2007 */ /* returns Current Date in USA format 10/24/07 */ /* returns Current Date in Julian format */ /* returns Current Day Wednesday */
2007, Cognizant Technology Solutions Confidential

163

Built-in Functions(Contd.)
Length function returns the length of the string passed. Syntax of Length function:
LENGTH(string)

Example Length function:


LENGTH('COGNIZANT') /** returns 9 **/ LENGTH('') /** returns 0 (null string) **/

2007, Cognizant Technology Solutions

Confidential

164

Read a Dataset using REXX


EXECIO DISKR command is used read the contents of a PS or a PDS member TSO command. Syntax of EXCEIO DISKR statement :
EXECIO [lines or *] DISKR ddname ( [STEM var [FINIS] )

Where, LINES - number of lines to read. ddname- name of the dd that is allocated using ALLOC statement. STEM - Keyword. Var - Stem variable name. FINIS - Keyword, used to to close the file after reading.

Example: reads the dataset with name CTS.IN.FILE and displays the contents of the file.
/**REXX**/ ADDRESS TSO "ALLOC DD(INFILE) DSN('CTS.IN.FILE') SHR" "EXECIO * DISKR INFILE(STEM OUTREC. FINIS" SAY "THE RECORDS ARE : " DO I = 1 TO OUTREC.0 /** OUTREC.0 contains the number of records** / SAY OUTREC.I /** Displays the content of the file, till end of file **/ END EXIT

In the above example, OUTREC. Is the stem variable. After EXECIO statement, the total number of records will be populated in the zero index of the stem variable (OUTREC.0).

2007, Cognizant Technology Solutions

Confidential

165

Writing into Dataset using REXX


EXECIO DISKW statement is used to write the contents of a stem variable to a PS or PDS member. All rules that are applicable to DISKR is applicable to DISKW.
EXECIO [lines or *] DISKW ddname ( [STEM var [FINIS] )

Example: creates a new dataset with name CTS.OUT.FILE and writes the contents of the stem variable into a dataset
/**REXX**/ ADDRESS TSO "ALLOC DD(OUTFILE) DSN(CTS.OUT.FILE) NEW CAT TRACKS SPACE(5 10) LRECL(80) RECFM(F B)" REC.1 = "COGNIZANT" REC.2 = "TECHNOLOGY" REC.3 = "SOLUTIONS" "EXECIO * DISKW OUTFILE(STEM REC. FINIS" EXIT-

2007, Cognizant Technology Solutions

Confidential

166

Questions
Questions from participants

2007, Cognizant Technology Solutions

Confidential

167

Test Your Understanding


1. How will you executing a REXX exec?
2. What is meant by parsing in REXX? 3. List the types of interrupt instructions. 4. How will you expose only few main function exec variables to subroutine? 5. Name the some built in functions used in REXX. 6. How will you read and write into a dataset using REXX?

2007, Cognizant Technology Solutions

Confidential

168

FILE AID

C3: Protected

File Aid - Objectives


Objective:
After completing this chapter, you will be able to:
Define File Aid Describe three display mode to view the data

How to Copy a Data File to another Data File using File Aid
How to Compare two Data Files using File Aid

2007, Cognizant Technology Solutions

Confidential

170

File Aid - Introduction


FileAid:
File-Aid is a comprehensive data management tool developed by Compuware. It is designed to help developers, testers, and DBAs work efficiently with data as they develop, test and implement distributed applications.

Pre-requisite:
Familiarity with TSO/ISPF is a prerequisite for using File-AID.

Why FileAid:
File-AID offers a range of functionality which includes the ability to browse, copy, modify and compare data without having to be an expert in databases like IMS or DB2
2007, Cognizant Technology Solutions Confidential 171

Browse a Data File using File Aid

File-AID can be accessed from ISPF menu. The option code is F to enter into the File -AID menu. For Browse, select option 1 from the above menu and press Enter.

There are three display modes to view the data in the file.
1.Character 2. Formatted 3.Vertical formatted

Character Mode: The character browse mode provides a full-screen view of the data From character mode, it is possible to go to the FMT primary command to redisplay the data in formatted mode or use the VFMT primary command to redisplay the data in vertical formatted mode.
Formatted Mode: A data set can be opened only with a copybook in formatted mode. This option is almost similar to VFMT, except that it can show only one record at a time. Even if we are in different format of viewing the file, it can be changed to formatted mode, by typing FMT on command line and pressing

2007, Cognizant Technology Solutions

Confidential

172

Browse a Data File using File Aid (cont)


Vertical Formatted Mode:
A data set can be opened only with a copybook in vertical formatted mode Some of the command used in VFM DISP OFF 1-3 8 12 The above would remove variables with offset number 1,2,3,8, & 12.
DISPLAY 1-3 8 12 ONLY

The above would show only variables with offset number 1,2,3,8, & 12.
To bring to normal view of the variable, type DISP (field number) RESET To get some other fields after giving a DISP OFF or DISP ONLY, type DISP (field-number) ON.

To get all the fields after giving a DISP OFF or DISP ONLY, type DISP ALL.

To see the HEX value for a variable, we can give DISP HEX (field number).

2007, Cognizant Technology Solutions

Confidential

173

Copy a Data File using File Aid


For Copy, select option 3(UTILITIES) from the File-Aid Primary Option menu. Enter 3(COPY) in EXTENDED UTILITIES screen.The copy utility screen appears. Specify the FROM Dataset and TO Dataset. Specify Execution Information (O = Online or B = Batch ) Specify Selection Criteria Information (E = Existing; T = Temporary; M = Modify; Q = Quick; N = None ) If you are copying the dataset to a new data set, the disposition parameter is given as NEW. You can also copy the file to the already existing file, then the disposition parameter is given as OLD or SHR If the dataset to which it is copied is new, Fileaid will allow us to create a new dataset where the record size and record format for the new dataset should be given. If the old dataset is of LRECL 400 and it is required to copy it to a new file of LRECL 300, then Fileaid will prompt for the confirm copy screen. Press enter to copy, the old dataset will be copied to the new dataset.

2007, Cognizant Technology Solutions

Confidential

174

Record Layout and Selection Criteria usage


Record layout Usage: When we want to view a file in a particular layout, we specify S and give the corresponding copybook PS or PDS for reference. Selection Criteria usage: E If we have an existing selection criterion in a dataset that can be provided. M If we have an existing selection criterion in a dataset and we want to modify the criteria for the current usage. Q This option takes us directly to query mode based on position and length. T This has three options in it; they are numbered as 1, 2, and 3. 1 OPTIONS - Enter selection criteria options 2 FORMATTED - Edit formatted selection criteria 3 UNFORMATTED - Edit unformatted selection criteria Edit a Data File : File-AID enables you to edit a file created through MVS.
For Edit, select option 2 from the File-Aid Primary Option menu, other options for Edit would be the same as View or Browse.

2007, Cognizant Technology Solutions

Confidential

175

Compare two Data Files using File Aid


The File-AID Compare function compares any two similar files and produces reports showing any differences You may optionally use standard File-AID selection criteria to select only a subset of records to be compared Steps: 1. From the File-AID Primary Option Menu, select File-AID option 10. 2. Press Enter. File-AID displays the Compare Old Datasets Specification screen Enter the first data set that needs to be compared 4. File-AID displays the Compare New Datasets Specification screen Enter the second data set that needs to be compared 5. Specify Record layout usage , Selection criteria usage in both the data set 6. File-AID displays Compare - Criteria Options screen. Specify the Compare type , Read-ahead record count ,Read-ahead sequence, Records to compare ,Differences to compare, Modify print defaults ,Specify output criteria

7. The Compare - Criteria Build Complete screen appears, hit enter key.
8. The final Compare Criteria Contents Report screen appears displaying the report showing any differences.
2007, Cognizant Technology Solutions Confidential

176

Questions
Questions from participants

2007, Cognizant Technology Solutions

Confidential

177

Test Your Understanding

1.What is File Aid? 2. What is the display mode to View data? 3. How to copy a data file to another data file? 4. How to compare to data file?

2007, Cognizant Technology Solutions

Confidential

178

Mainframe Macros
Introduction to Mainframe Macros

C3: Protected

Mainframe Macros : Overview


Macros:
To record and playback frequently repeated activity (or) To automatically repeat an activity which should be repeated in the

course of the project by recording only once using Macros.

Advantages:
It prevents the need for manual repetition of same activity many times.
Reduces the work and thereby saves time.

2007, Cognizant Technology Solutions

Confidential

180

Record A Macro
To Start Recording
Click Start Keystroke Recording icon (or) Actions Start Recording Macro menu

Click OK after entering all the details and perform the operations to be recorded.

To Stop Recording
Click Stop Keystroke Recording and Save icon Actions Stop Recording Macro
2007, Cognizant Technology Solutions Confidential 181

(or)

Playback A Macro
To Start Playback
Click Start a Macro / Script icon (or) Action Start Playing Macro / Script

Select the macro from the drop down box and click ok While playback make sure that you are in the same screen as you were while recording.

To Stop Playback
Click Stop running Macro / Script icon (or) Action Stop Playing Macro / Script

2007, Cognizant Technology Solutions

Confidential

182

View A Recorded Macro


Default saving location of Macro file is \Personal Communications\private (example: D:\Program Files\Personal Communications\private\)

Steps to View a Record:


Go to the location where the macros is saved (example: D:\Program

Files\Personal Communications\private\)
Right click on the file to be opened Select Open With and then select Note pad

2007, Cognizant Technology Solutions

Confidential

183

Q&A
Questions from participants

2007, Cognizant Technology Solutions

Confidential

184

Test Your Understanding

1. How will you record a Macro using PCOMM?


2. How will you playback the recorded Macro? 3. Where the Macro files will be saved?

2007, Cognizant Technology Solutions

Confidential

185

You have successfully completed Mainframe Testing

S-ar putea să vă placă și