Mainframes
Mainframes
Mainframes
C3: Protected
Credential Information:
Version and Date: ST/PPT/0907/1.0
Confidential
Icons Used
Hands on Exercise
Questions
Tools
Coding Standards
Reference
Demonstration
A Welcome Break
Contacts
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: 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
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
CICS1
OR IMS
Confidential
Authentication screen
------------------------------- TSO/E LOGON -----------------------------------
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
Confidential
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
Confidential
11
Utility Options
Option 2 from the utilities menu (or) 3.2 from the ISPF main menu helps us
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)
Confidential
13
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
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
Confidential
15
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.
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:
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.
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)
Confidential
19
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
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.
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)
Confidential
22
SuperCE Compare
Confidential
23
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).
Confidential
24
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
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.
Confidential
26
Q&A
Questions from participants
Confidential
27
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?
Confidential
28
JCL
C3: Protected
Confidential
30
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.
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
Confidential
32
General Rules
Must begin with // (except for the /* statement) in columns 1 and 2
Confidential
33
Data Definition, i.e., identifies what resources (datasets) are needed and where to find them
Confidential
34
the necessary accounting information, and supplies run parameters. Each job must begin with a single JOB statement .
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
or cataloged procedure or in-stream procedure that this job is to execute and to tell the system how to process the job.
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
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
Confidential
38
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.
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
Confidential
40
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
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
Confidential
43
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
Confidential
45
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?
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
address.
Confidential
48
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
IDCAMS
IDCAMS utility is used to handle VSAM data sets
Confidential
51
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
Confidential
53
ESDS
The features of ESDS is as follows,
Similar to Sequential File
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
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
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
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
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
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
DELETE
DELETE <object name> (parameters)
Example: DELETE CTS.NLT.CLUSTER Deletes all subordinate objects such as AIX, Path
61
Batch Execution
C3: Protected
Confidential
63
data.
The SUBMIT command in TSO sends jobs to z/OS (OS/390).
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
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.
Confidential
65
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
Confidential
66
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
Supervisor .
RESEARCH - class (Class R) is for CPU-intensive research computing jobs. EVENING RESEARCH -
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.
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.
Confidential
68
Confidential
69
Confidential
70
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
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
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]
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]
Confidential
76
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.
Confidential
77
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
Represents one or more spaces Represents the highest value Represents the lowest value Represents single or double quotes Fill With Literal
Confidential
78
Confidential
79
77
88
Picture Clause:
PICTURE Symbol 9 A X Meaning Numeric Alphabetic Alphanumeric
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.
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}
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
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
Confidential
87
Files
FILE Types:
1.Sequential 2.Indexed 3.Relative
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,
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.
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
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.
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.
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.
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
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)
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
Confidential
98
Questions
Questions from participants
Confidential
99
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?
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.
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
Confidential
103
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
Confidential
104
Calls / Uses
Mapset
Contains
Map
Contains
Field
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
Confidential
106
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
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]]
Confidential
108
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]
Confidential
110
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.
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
DFHMDF
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.
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.
Confidential
114
//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)
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)
Confidential
117
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.
Confidential
118
All CICS-COBOL program must not contain the ACCEPT, DISPLAY and STOP RUN statements.
Confidential
119
Confidential
120
compiler (Contd):
//********************************************************************** //* COBOL COMPILER * //********************************************************************** //COBCOMP EXEC PGM=IGYCRCTL,COND=(5,LT) //STEPLIB DD DSN=IGY.SIGYCOMP,DISP=SHR //SYSIN DD DSN=&&SYSIN00,DISP=(OLD,DELETE) //SYSLIB DD DSN=CICSTS23.CICS.SDFHCOB,DISP=SHR // DD DISP=SHR,DSN=©BOOK //SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA, // SPACE=(100,(100,100),RLSE) //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA //SYSUT2 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA //SYSUT3 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA //SYSUT4 DD SPACE=(10,(50,500),,,ROUND),UNIT=SYSDA //SYSUT5 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA //SYSUT6 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA //SYSUT7 DD SPACE=(1,(10,100),,,ROUND),UNIT=SYSDA //********************************************************************** //* LINKER FOR CICS PROGRAMS * //********************************************************************** //LKED EXEC PGM=IEWL,PARM='XREF',COND=(5,LT) //SYSLIB DD DSN=CICSTS23.CICS.SDFHEXCI,DISP=SHR // DD DSN=CICSTS23.CICS.SDFHLOAD,DISP=SHR // DD DSN=TIG06431.CICS.LOAD,DISP=SHR // DD DSN=DSN810.SDSNLOAD,DISP=SHR // DD DSN=CEE.SCEELKED,DISP=SHR // DD DSN=CEE.SCEERUN,DISP=SHR // DD DSN=ISP.SISPLOAD,DISP=SHR //SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE) // DD DDNAME=SYSIN //SYSLMOD DD DISP=SHR,DSN=&LOADLIB(&LOADMEM) //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(1024,(50,50)),UNIT=SYSDA //SYSIN DD * INCLUDE SYSLIB(DFHECI) INCLUDE SYSLIB(DSNCLI) // /* 2007, Cognizant Technology Solutions Confidential 121
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.
Confidential
122
Q&A
Questions from participants
Confidential
123
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?
Confidential
124
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.
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
Confidential
127
Db2
Db2:
Db2 is relational database.
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 .
Confidential
128
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
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. 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
Confidential
131
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
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.
Confidential
132
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.
Confidential
133
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.
Confidential
134
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
Confidential
136
1. 2. 3.
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
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.
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
Confidential
141
Features of REXX
Various features of REXX are as follows,
Ease of Use
Free format
Debugging capabilities
Interpreted language
Confidential
142
When you run the exec, you can see the sentence in your screen
This is a REXX exec
Confidential
143
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
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.
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.
Confidential
146
Expressions are statements with something that needs to be calculated or evaluated. It consists of numbers, variables or strings and one or more operators.
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
%
//
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
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 \
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%
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
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
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
Confidential
153
Conditional Statements
Syntax of IF statement
IF expression THEN statement ELSE statement IF expression THEN DO statements END ELSE DO statements END
Looping Statements
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
Confidential
155
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.
Confidential
156
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.
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
Confidential
159
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
Confidential
160
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
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
/**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
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)
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)
Confidential
164
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).
Confidential
165
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-
Confidential
166
Questions
Questions from participants
Confidential
167
Confidential
168
FILE AID
C3: Protected
How to Copy a Data File to another Data File using File Aid
How to Compare two Data Files using File Aid
Confidential
170
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
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
Confidential
172
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).
Confidential
173
Confidential
174
Confidential
175
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
Confidential
177
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?
Confidential
178
Mainframe Macros
Introduction to Mainframe Macros
C3: Protected
Advantages:
It prevents the need for manual repetition of same activity many times.
Reduces the work and thereby saves time.
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
Confidential
182
Files\Personal Communications\private\)
Right click on the file to be opened Select Open With and then select Note pad
Confidential
183
Q&A
Questions from participants
Confidential
184
Confidential
185