0% found this document useful (0 votes)
681 views204 pages

Mainframe ISPF & TSO Commands Guide

This document provides information about commands for the ISPF editor on mainframe systems. It discusses primary commands that can be entered in the command line as well as line commands. Examples are given for finding, copying, moving, and deleting lines of text. Special characters that can be used in find commands are also outlined. The document includes tables listing primary commands, line commands, and frequently used TSO commands.

Uploaded by

Shiba Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
681 views204 pages

Mainframe ISPF & TSO Commands Guide

This document provides information about commands for the ISPF editor on mainframe systems. It discusses primary commands that can be entered in the command line as well as line commands. Examples are given for finding, copying, moving, and deleting lines of text. Special characters that can be used in find commands are also outlined. The document includes tables listing primary commands, line commands, and frequently used TSO commands.

Uploaded by

Shiba Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 204

Mainframe Refresher Part-1 Page:1

ISPF &
TSO

Mainframe Refresher Part-1 Page:2

ISPF
ISPF (Interactive Spool Productivity Facility) is a popular editor in the mainframe
platform !here are t"o #inds of commands that can $e entered in edit%vie" panel of
ISPF editor
!hey are:
1 Primary &ommands that can $e entered in the &ommand 'ine
( 'ine &ommands that can $e entered in the line(s)
Mastering in these commands "ill $e highly helpful in analy)ing%developing
application programs
Primary &ommand Meaning
*+,S -isplays the PF *eys and its definition for that panel
PFS./0 Sho"s PF *eys definition at the $ottom of panel !o /FF
this option enter P.S./0 /FF
R+S+! &lears all message lines and reset the display of the
dataset R+S+! '12+' is re3uired to clear la$els
4 1'' +5clude all the lines
&/'6M7S%&/'S % &/'S
/7%&/'
-isplay a ruler at the top of the screen !his can $e
removed $y &/'S /FF or R+S+!
!/P%2/! Move to the !/P or 2/!!/M of the file
.+4 -isplays the data in .e5adecimal mode !ype .+4 /FF to
come $ac# to normal display .ighly helpful for reading
computational fields and lo"-values
S01P S"itch $et"een split screens
S01P 'IS! 'ists the availa$le screens
&6! 0ith & or && line command8 this "ill copy the lines to
temporary storage
&6! 1 2 "ill cut the lines in $et"een the la$els 1 9 2
&6! -ISP'1, -isplay the lines already cut
&6! 1PP+7- 1ppended the lines to the lines already cut
P1S!+ Paste the already cut lines 'ine commands 1 or 2 should
$e used $efore issuing paste to indicate after or $efore
"hich line this paste should occur
S&R71M+ 44444 !he current screen is named as 44444 If you are using
multiple split screens8 then you can come $ac# to this
screen $y S01P 44444 line command Its good
convention to name the screens "ith the purpose so that
you can easily come $ac# 2y default the screens are
named "ith num$ers
'/&1!+ line-
num$er%'a$el
'ocates the line-num$er or the la$el 'a$els can $e
esta$lished in any line $y the line command
la$elname
R+&/:+R, /7
R+&/:+R, /FF
R+&/:+R, /FF
6701R7
67-/
0ith R+&/:+R, on8 67-/ line command "ill revert the
last recent change made in the edit%vie" session R+&
/FF "ill off the recovery option and 67-/ 6navaila$le
message "ill appear in the first line R+& /FF 6701R7 is
same as R+& /FF $ut there "on;t $e any 67-/

Mainframe Refresher Part-1 Page:3

unavaila$le "arning message
F <Musa;
F <Musa; 1
F <Musa; 1 =>
'ocates the ne5t <Musa;
'ocates the ne5t <Musa; in the first column
'ocates the ne5t <Musa; that appear any"here $et"een
column 1 and =>
!he a$ove commands "ill do the find from the current
cursor position and place the cursor over the string found
F <Musa; 1''
F <Musa; FIRS!%'1S!
F <Musa; 7+4!%PR+:
Independent of cursor position8 this "ill count all the
<Musa; and displays the total count in the upper right
corner and place the cursor over the first occurrence from
top
'ocates the First%'ast <Musa; in the dataset%mem$er
opened
'ocates the 7e5t%Previous <Musa; "ith respect to the
current cursor position in the dataset%mem$er opened
7ote: 1''%FIRS!%7+4!%PR+:%'1S! are mutually e5clusive
#ey"ords
F <Musa; &.1RS
F <Musa; 0/R-
F <Musa; PR+FI4%S6FFI4
!his is same as F <Musa; 'oo# for <Musa;
'oo# for < Musa < 0ord is a string follo"ed and prefi5ed $y
space
'oo# for <Musa; as a prefi5 or suffi5 "ith some other
strings
7ote: PR+FI4%S6FFI4%0/R-%&.1RS are mutually
e5clusive
F <Musa; 4 'ocates the string <Musa; in e5cluded lines
74 searches the string only in non-e5cluded lines
7ote: 4%74 are mutually e5clusive "ith each other
F ? 7+4!
'ocates the ne5t occurrence of the string that "as
searched in the last find command
& 1'' <Musa; <Muthu; &hanges all <Musa; as <Muthu;
7ote: &hange command is nothing $ut find and replace So
from string can $e 3ualified "ith other #ey"ords availa$le
in FI7- command +5 & <st1; <str(; 1 replaces only the str1
that are in first position to str(
-+' 1'' 4%74 -elete all the e5cluded%7ot e5cluded lines -+' 1 2
deletes all the lines $et"een 1 and 2
@ Represents +nter #ey So multiple commands can $e given
in one shot "ith <@; separation
S/R! A 1A 1 Sorts in A-1A in ascending se3uence Ma5imum A fields can
$e given - for descending

Mainframe Refresher Part-1 Page:4

Special String &haracters that can $e used "ith FI7- and &.17B+:
&har Meaning &har Meaning
P;C; -isplays any character P;; -isplays any non-displaya$le
character
P;D; -isplays any numeric P;-< -isplays any non-numeric
P;E; -isplays any alpha$etic P;F; -isplays any lo"er-case
alpha$etic
P;G; -isplays any upper-case
alpha$etic
P;H; -isplays any special character
4;nn; Finds the he5 value of nn P < -isplays any non-$lan#
character
C P 73 80 ALL changes all non-$lan# characters in I=-J> to spaces
Primary commands prefi5ed "ith 9 (ampersand) is left in the command line after
e5ecution !his "ay the same command can $e entered multiple times "ithout
retyping it in each time
Primary &ommands Mapping to PF *ey
1ny of the line commands can $e mapped to a PF #ey and invo#ed $y
pressing that #ey +5ample if you map <4 1''; command "ith PFK8 then every time
PFK is pressed8 all the lines are e5cluded Mapping can $e done $y the line command
*+,S In this "ay8 (K #eys PF1-PF(K can $e mapped PF1=-PF(K is nothing $ut Shift
L PF1- PF1(
!ypical assignment of the #eys is given $elo":
PF1 .elp
PF( SP'I! - Split the screen at the cursor;s location
PF= +5it
PFK +5it or R+!6R7
PFA RFI7- - Find ne5t occurrence of the last F command
PFM R&.17B+ N &hange ne5t occurrence of the last & command
PFI 6P
PFJ -/07
PFO S01P
PF1> '+F!
PF11 RIB.!
PF1( R+!RI+:+ - repeats the previous command line command

Mainframe Refresher Part-1 Page:5

'I7+ &ommands:
&om-
mand
Meaning &om-
Mand
Meaning
& &opy this line & 1> copies 1>
lines !his "ill $e follo"ed $y the
line commands 1 or 2
&& &opy the $loc# of lines
M Move this line M 1> copies
move 1> lines !his "ill $e
follo"ed $y the line commands 1
or 2
MM Move the $loc# of lines
1%2 1fter(1)%2efore(2) this line8
place the copied%moved line(s)
11> repeats the copied%moved
lines 1> times
R n Repeats the current line n times
Pust R repeat 1 time
RR Repeats the $loc# of lines RR 1>
repeats the $loc# 1> times
6& &hange this line content to
uppercase
6&& &hanges the content of the
$loc#ed lines to upper-case
'& &hange this line content to
lo"er-case
'&& &hanges the content of the
$loc#ed lines to lo"er-case
- -eletes the line <- n < deletes n
lines from this line
-- -eletes the $loc# of lines
I Insert 1 line 1fter entering the
data in the first line8 ne5t line
"ill $e inserted
6seful for line $y line data entry
I 1> Insert 1> lines /nce enter is
pressed8 the remaining
untouched lines "ill $e removed
6seful for control-&8 control-:
actions
4 +5clude this line 41> e5cludes
1> lines starting "ith this line
44 +5clude a $loc# of lines
S Sho" one line of the e5cluded
te5t S 1> sho"s 1> lines
F%' Sho"s the First%last line of
e5cluded te5t ' 1> sho"s the
last 1> lines
)n Shift the line content $y n
columns to the right side
(outside) Gn is same as )n $ut
in case of data truncation8
operation "ill $e error out
))n Shift the $loc# of lines $y n
columns to the right side
GGn is same as ))n $ut in case
of data truncation8 operation "ill
$e error out
(n Shift the line content $y n
columns to the left side(inside)
Fn is same as (n $ut in case of
data truncation8 operation "ill
$e error out
((n Shift the $loc# of lines $y n
columns to the left side
FFn is same as ((n $ut in case
of data truncation8 operation "ill
$e error out
!S n !o split te5t in t"o at the point
of cursor to allo" a "ord8 phrase
or sentence to $e inserted 7
num$er of lines are inserted
$et"een the t"o parts of te5t
!F n !o flo" fragments of sentences
into paragraph 7 defines the
"idth
!+ !e5t +ntry mode is used for $ul#
entry of te5t and allo"s po"er
typing techni3ues to $e used at
27-S !o process only over a column of
data8 define the range of
columns using 27-S line

Mainframe Refresher Part-1 Page:6

the terminal (!ype data "ithout
$othering a$out end of line8 line
num$ers etc !he FI71' enter
"ill re flo" the data)
command
M1S* It allo"s to put fi5ed data into
the ne" lines $eing entered
!ype M1S* over a line num$er
and press enter /vertype the
mas# "ith "hatever "e "ant
7o" every time "e enter ne"
lines "ith I8 !+8 !S N mas# lines
"ill $e displayed rather than
empty lines
/
(over
lay)
/verlay command indicates the
target line(s) "hen merging
lines /verlay is used in
conQunction "ith M or & line
commands
C 0300 *
O 0400 MVSQuest
Result:
0300 *
0400 * MVSQuest
/1> overlaid the first 1> lines
//-// overlaid the $loc# of
lines

!S/
Fre3uently used !S/ commands are listed in the ta$le !hey can $e issued
from any ISPF panel "ith !S/ prefi5 !S/ prefi5 is not re3uired if you e5ecute them
in !S/ panel (/ption M of ISPF)
If the command is incomplete8 !S/ prompts for the missed parameters
!he output of the processed command is displayed in ISPF8 in line mode
SYS1.HELP dataset contains all the !S/ commands8 synta5 and their usage
&ommand Synta5 Purpose
.+'P R&/MM17-S -isplays the purpose and synta5 of the command
!he source for this information is retrieved from <S,S1.+'P;
+5: .+'P 1''/&1!+
S+7- It is used to communicate "ith other users
S+7- <R+FR+S.+R &/MP'+!+-; 6S+R(SMS4'JM) '/B/7
Message <hi; is sent to user SMS4'JM If the user is not logged
on8 the message should $e displayed the ne5t time user logs
on '/B/7 is an optional parameter
Message: 11A chars ma5imum
'IS!&1! It is used to list entries in M:S catalog !he synta5 and the
availa$le options are e5plained in :S1M - I-&1MS section
'IS!&1! +7!RI+S;SMS4'JM!+S!S/6R&+; 1''
'IS!-S It is used get the information a$out one or more datasets
'IS!-S <dataset-name; M+M2+RST.IS!/R,TS!1!6ST'+:+'
M+M2+RS list all the mem$ers of a P-S !his command is
useful in R+44 to process all the mem$ers of a P-S
R+71M+ It is used to rename a dataset Beneric datasets are allo"ed
R+71M+ <2P1M1I7!+S!?; <2PM1I767I!?; renames all the

Mainframe Refresher Part-1 Page:7

datasets start "ith 2PM1I7!+S! to 2PM1I767I!
R+71M+ <SMS4'JM!+S!(M+M1); <M+M(; renames mem1 as
mem( in the P-S <SMS4'JM!+S!;
-+'+!+ It is used to delete dataset(s) P6RB+ 3ualifier is needed to
$ypass e5piration date chec#ing
-+'+!+ <2PM1I7!+S!?; P6RB+
1''/&1!+
(+5isting dataset)
1''/&1!+ -1(<SMS4'JM!+S!S/6R&+;) FI'+(I7P) S.R
It allocates the dataset <SMS4'JM!+S!S/6R&+; "ith logical
name I7P I7P can $e used in R+44 for R+1-%0RI!+
1''/&1!+
(7e" dataset)
1llocation can $e done using model-dataset attri$utes or "ith
ne" attri$utes or com$ination of $oth
1ttri$utes that can $e specified are:
67I!8 :/'6M+8 SP1&+8 !R1&*ST&,'I7-+RST2'/&*($l#-
length)8 -IR8 R+&FM8 'R+&'8 2'*SIU+8 -1!1&'1SS8
S!/R&'1S8 MBM!&'1S8 +4P-!%R+!P-
Model parameter: 'I*+(<model-dataset;)
FR++ -e-allocate the allocated-datasets
FR++ FI(logical-name)
FR++ -S71M+(<dataset-name;)
FR++ 1''
ISR--7 It displays the files%datasets allocated to your session
<M mem$er; command searches the mem$er in all the datasets
allocated to you If you "ant to see the source of a utility8 give
a search using the command < M utility-name; in the ISR--7
panel
&1'' It is used to e5ecute a load module
&1'' <2PM1I7!+S!'/1-'I2(!+S!1); N +5ecutes the load
!+S!1 If the program needs any datasets8 then they should
$e allocated $efore issuing this command
S62MI! It is used to su$mit a Qo$ to P+S
S62MI! <P-S(M+M2+R);R P/2&.1R(<1;)S
&17&+' It is used to &17&+' %P6RB+ the Qo$ from P+S
&17&+' P/2-71M+T P/2-71M+(P/2-I-) RP6RB+S
S!1!6S It is used to get the status of the su$mitted-Qo$ in P+S
S!1!6S P/2-71M+ T P/2-71M+(P/2-I-)
1'!+R It is used to alter the attri$utes of a dataset +5: Management
class
!S/ &ommands can $e e5ecuted in $atch (P&') using terminal monitor program
I*P+F!>1
%%R6721!&. +4+& PBMCI*P+F!>1
%%S,S!SPR! -- S,S/6!C?
%%S,S!SI7 -- ?
R+71M+ <M:SV6+S!+MP-1!1; <'+1-S/F!+MP-1!1;
R+71M+ < M:SV6+S!S1'+S-1!1; <'+1-S/F!+MP-1!1;
%?

Mainframe Refresher Part-1 Page:8

!he a$ove step renames t"o datasets from M:SV6+S! 3ualifier to '+1-S/F!
3ualifier 1ny high volume manual Qo$ can $e completed in matter of minutes if you
have good #no"ledge in ISPF and !S/ commands "ith little e5posure to R+44

Mainframe Refresher Part-1 Page:9

Job Control Lan!a"
JCL

Mainframe Refresher Part-1 Page:10

P&'
1ny $usiness application is divided into logical modules and these modules are
developed using programming languages !hese programs should $e e5ecuted in a
pre-defined se3uence to achieve the $usiness functionality
P&' (Po$ &ontrol 'anguage) is used to -+FI7+ and &/7!R/' the P/2 to the
operating system
-efinition involves definition of the programs need to $e e5ecuted8 the data for the
programs and the se3uence of programs &/7!R/' involves controlling the
e5ecution or $ypassing of a program in the se3uence $ased on the result of the prior
program e5ecution
P&' &oding Sheet
1 ( = 11 1M I= J>
71M+ /P+R1!I/7 /P+R17-S
P&' statements should have %% in column 1 and ( S!1R (<?<) in the third column8
indicates that the line is a comment line
71M+ is optional field If coded8 it should start at column= and can have ma5imum J
characters !he first character should $e an alpha$et or national character (E8 D or
H) Remaining characters can $e any alphanumeric or national characters
/P+R1!I/7 follo"s 71M+ field !here should $e at least one space $et"een 71M+
and /P+R1!I/7 If 71M+ is not coded then /P+R1!I/7 can start at fourth column
itself !ypical /P+R1!I/7 #ey"ords are P/28 +4+& and --
/P+R17-S are the parameters for the operation /P+R17-S follo" /P+R1!I/7 and
there should $e at least one space $et"een them 1 comma separates parameters
and there should not any space $et"een parameters If the /P+R17-S are more8
then they can $e continued in the ne5t line !o continue the current line8 end the
current line $efore column I( "ith <8; and start the ne5t line any"here $et"een
columns K-1M &olumns 1-= should $e <%% <
&/MM+7! FI+'- N &omment field optionally follo"s /P+R17- FI+'-8 preceded $y at
least one $lan#
+nd of Po$ is identified $y 76'' statement 76'' statement has %% in column 1 and (
"ith no 71M+8 /P+R1!I/7 or /P+R17- fields !he statements coded after 76''
statement "ill not $e processed
-+'IMI!+R N Some times "e pass the data in the P&' itself !his is called in-stream
data !he starting of data is identified $y <?; in the operand field of -- operation
-+'IMI!+R indicates the end of data %? in column 1 and ( is the default delimiter

Mainframe Refresher Part-1 Page:11

Po$ +ntry Su$system (P+S)
Po$ +ntry Su$system (P+S) is the Qo$ processor of M:S operating system
M:S installation can have either P+S( or P+S= !he su$mitted Qo$s are ta#en $y P+S
for processing
P+S( P+S=
-ecentrali)ed +nvironment +very
processor processes the incoming Qo$s
individually
&entrali)ed +nvironment !here is a
glo$al processor that controls all the
other processors and assigns the Qo$s to
them
-atasets are allocated $efore the step
e5ecution
-atasets are allocated $efore the Qo$
e5ecution
P&' Statements
P/2 It should $e the first statement in the P&' It indicates accounting information
and P/2 related information to the system If the mem$er $eing su$mitted contains
multiple Qo$ cards8 then multiple Qo$s "ill $e su$mitted !hese Qo$s "ill run
concurrently or one after other $ased on Qo$ name8 class and initiator availa$ility
+4+& !he name of the program or procedure to $e e5ecuted is coded here +very
+4+& statement in a P/2 identifies one step Ma5imum of (AA +4+& statements can
$e coded in a P/2
-- -ata -escriptor !he dataset details are coded here -ataset contains the data
that need to $e processed $y the program or data that is produced $y the program
Ma5imum =(I= -- statements can $e coded in a step
Abnormal End (ABEND) & ERROR
/nce the "or# to $e done is defined in P&'8 it can $e su$mitted to the
operating system using S62MI! command 6sually programmer is e5pected to issue
P+M or PS&17 to chec# out any possi$le P&' +rrors $efore su$mission
P&' +RR/R:
1 +rrors $efore Qo$ starts e5ecution: If there are synta5 errors8 then the "hole
Qo$ is reQected "ith error message in P+S M+SS1B+S !ypically this needs
correction and resu$mission of the "hole P/2
( +rrors $efore step starts e5ecution: If there is any allocation issues in a
particular (li#e dataset not found8 duplicate dataset)8 then also the Qo$ "ill $e
error out $ut in this case there might $e already n steps got e5ecuted
!ypically this needs correction and restart in the P/2
12+7-:
6nli#e P&' +rrors8 12+7- happens during the e5ecution of a program in a
step 12+7-S are classified into ( categories
System 12+7-(Snnn): System a$end occurs "hen the system is not a$le to e5ecute
a statement that is instructed in the program -ivide $y U+R/ results S/&2 system
a$end !he /S thro"s it

Mainframe Refresher Part-1 Page:12

6ser 12+7-(6nnnn): 0hen some une5pected condition occurs in the data passed8
the program "ill call an a$end routine and a$end the step "ith proper displays !his
is thro"n $y application $ased on the re3uirement
JOB Sa!m!n
Sample Synta5:
%%P/271M+ P/2 (1&&/67!I7B I7F/)8 (PR/BR1MM+R 71M+)8
%% !IM+C(MI76!+S8S+&/7-S)8 &'1SSC18MSB&'1SSC18PR!,C1K81--RC:IR!8
%% R+BI/7Cn*8MSB'+:+'C(182)8&/7-C(78/P+R1!/R)8 !,PR67CS&17

JOBNA"E
It identifies name of the Qo$ !he Qo$ is identified in the P+S SP//' using this
name 7aming rules are already mentioned in the coding sheet section
1&&/67!I7B I7F/ (Mandatory Installation -ependant)
1 Resource usage charges are charged to the account mentioned here
( If you don;t #no" your installation account8 you cannot su$mit the Qo$ It is li#e
"hen you don;t have account8 you cannot "ithdra" cash in $an#
= Ma5imum 1K( characters can $e coded as accounting information
#RO$RA""ER NA"E
Programmer name or program functionality or group can $e mentioned It is
used for documentation (Ma5 (> chars)
%&ASS ('n(alla)on D!*)n!d)
1 &'1SS is coded "ith single alphanumeric character (1-U8 >-O)
( -uring installation8 every &'1SS and its properties are defined
= -efinition descri$es the Qo$ characteristics li#e &P6 time usage8 num$er of
tape%cart usage and other resource constraints
K +very class is assigned to one or more initiators !he Qo$s run in initiator address
space /ne initiator can process one Qo$ at one time
#R+,
Synta5: PR!,C7 (7 can $e > N1A)
1 0hile selecting the Qo$s "ith same class for e5ecution8 P+S schedules the high
priority Qo$s first !he Qo$ coded "ith PR!,C1A has the highest priority and
PR!,C> has the lo"est priority
( PR!, "or#s "ithin the P/2&'1SS If there are ( Qo$s "ith &'1SS 1 is su$mitted
and one "ith PR!, = and other "ith PR!, K then PR!, K "ill get into e5ecution
3ueue first
= PR!, function is disa$led in most of the installations

"S$&E-E&
Synta5: MSB'+:+'C(48,) (4 can $e >-( 9 , can $e >-1)
1 It is used to control the lists of information appear in the Po$ log !o get
ma5imum information in the listing8 code MSB'+:+' as MSB'+:+'(181)
( !he first parameter controls the statements (>-/nly Qo$ statement8 1-P&'8 P+S
statements "ith e5panded procedures8 (-/nly P&' and P+S statement)
= !he second parameter controls the messages (>- /nly Step e5ecution messages8
1-1ll P&'8 P+S8 operator and allocation messages)

Mainframe Refresher Part-1 Page:13

"S$%&ASS ('n(alla)on D!*)n!d)
Synta5: MSB&'1SSC4 (4 can $e 1-U8 >-O)
1 MSB&'1SS is coded "ith single alphanumeric character (1-U8 >-O)
( +ach MSB&'1SS is mapped to a device or location8 "here the messages are
routed
ADDRS#%
It is used to specify "hether the Qo$ "ill run in the Real storage or :irtual
storage
Synta5: 1--RSP&CWR+1'T:IR!X
R+1' N 1llocation is done in R+1' storage and the program is not page-a$le
:IR! N 1llocation is done in :IR!61' storage and the program is page-a$le
RE$'ON
Synta5: R+BI/7CW5* T yMX (5 can $e 1-(>OM1(J 9 y can $e 1-(>KI)
1 It is used to specify the amount of central %virtual storage the Qo$ re3uires
It can $e re3uested in the units of #ilo$ytes (5*) or mega$ytes (yM) If re3uested
in terms of #ilo$ytes8 then 5 should $e multiple of K or the system "ill round it to
nearest K* allocates for your Qo$
( R+BI/7 can $e coded in +4+& statement also R+BI/7 parameter coded on P/2
card overrides the parameter coded on +4+& card
= Ma5imum virtual memory availa$le is (B2
K RegionC>M allocate all the availa$le memory in the address space to this Qo$
A Region related 12+7-S: 0hen the re3uested region is not availa$le8 the P/2 "ill
12+7- "ith SJ(( 0hen the re3uested region is not enough for the program to
run8 you "ill get 12+7- SJ>1 or SJ>K
RES+AR+
R+S!1R! parameter allo"s restarting from any particular step in the Qo$
Synta5: R+S!1R! C Step-name in the Qo$
R+S!1R! C ? means restart from the $eginning
!o restart from any procedure steps8 code R+S!1R!CPR/&S!+PS!+P71M+
0hereas PR/&S!+PCname of the P&' step that invo#ed the PR/& 9
S!+P71M+Cname of the proc step "here you "ant e5ecution to start
R+S!1R! ignores any condition in the step $eing restarted and it can also $e step
that is in the +'S+ part of the IF+'S++7-IF
+,#R.N
It is used to re3uest special Qo$ processing
1 !,PR67CS&17 chec#s the synta5 errors "ithout actual e5ecution
( !,PR67C./'- chec#s the synta5 error and if there is any error8 it is notified and
if there are no errors8 the Qo$ is #ept in a"aiting e5ecution 3ueue and it should $e
released $y user for e5ecution Release can $e done $y typing <1; against the Qo$
name in S-SF
= !,PR67CP&'./'- Function is same as ./'- $ut the synta5 chec# starts only
after the release of the Qo$

Mainframe Refresher Part-1 Page:14

+'"E
It defines the ma5imum allo"a$le &P6 time for the P/2 !he parameter can $e coded
at +4+& card also /n +4+&8 it defines &P6 limit of step
Synta5: !IM+ C (MI76!+S8 S+&/7-S)8 MI76!+S FC 1KK> and S+&/7-S F M>
!IM+C7/'IMI!%1KK>%M14IM6M means the Qo$ can use &P6 for unlimited time
!IM+C> "ill produce unpredicta$le results
If !IM+ is coded on $oth P/2 as "ell as +4+&8 then +4+& !ime limit or the
time left out in the Qo$ !ime limit N "hichever is smaller "ill $e the time permitted
for the step to complete
If a P/2 runs more than allo"ed time8 then it "ill 12+7- "ith system 12+7-
code S=(( If there is no !IM+ parameter8 then the &P6 time limit pre-defined "ith
&'1SS Parameter "ill $e effective
NO+'/,
!S/ 6ser-id to "hom the Qo$ +7- % 12+7- % +RR/R status should $e
notified 7/!IF,C9S,S6I- "ill send the notification to the user "ho su$mitted the
Qo$
%OND
1 It is used for conditional e5ecution of P/2 $ased on return code of P/2 steps
( !he return code of every step is chec#ed against the condition coded on P/2
card If the condition is found !R6+8 then all the steps follo"ing it are $ypassed
= Ma5imum eight conditions can $e coded in the &/7- parameter In case of
multiple conditions8 if 17, of the condition is found !R6+ then the P/2 stops
proceeding further
Synta5: &/7-C(&/-+8/P+R1!/R8S!+P71M+)
S!+P71M+ is optional If you code it8 then that particular step-name return
code is chec#ed against the &/-+ "ith the /P+R1!/R If omitted8 then the return
codes of all the steps are chec#ed /n comparison8 if the condition found to $e true8
then all the follo"ing steps are $ypassed
&/-+ can $e >-K>OA
/P+R1!/R can $e B!8 '!8 B+8 '+8 +V
It can $e coded on +4+& statement S!+P level control is popular then P/2
level control /n +4+& statement8 you may find /7',8 +:+7 #ey"ords against &/7-
parameter
&/7-C/7', allo"s the step e5ecution only if any prior step is 12+7-+-
&/7-C+:+7 allo"s the step e5ecution independent of any prior 12+7-S
&onsider the &/7- parameter coded on +4+& statement8
+5: %%S!+P( +4+& PBMCPBM=8&/7-C((1M8B+)8(O>8'+8S!+P1)8/7',)
Step gets e5ecuted only if
1 preceding step a$normally terminated /R
!he return codes from all preceding steps are 1I or greater /R
!he return code from S!+P1 is JO or less
E0E% Sa!m!n
It defines the Step and Step level information to the system
Synta5: %%S!+P71M+ +4+& WPBMCprogram-name T
PR/&Cproc-name T
proc-nameX

Mainframe Refresher Part-1 Page:15

S+E#NA"E
It is an /P!I/71' field $ut it is needed if you "ant to restart a Qo$ from this
step and for the same reason8 it should $e uni3ue "ithin the Qo$
#$" or #RO%
&ode the Program name or PR/& name to $e e5ecuted (1-J characters)

#AR"
1 It is used to pass varia$le information to the processing program8 e5ecuted $y this
Qo$ step
( If there is more than one su$ parameter or if there is any special character then
enclose them in parentheses%3uotes
= Ma5imum 1>> characters can $e passed in this "ay Vuotes and $rac#ets are not
included in this 1>>!o pass a 3uote to the program8 indicate that "ith t"o 3uotes
one follo"ed $y other
K !he program can receive them using lin#age section 'in#age section must $e
coded "ith half "ord $inary field as first field !his field is populated "ith length of
the P1RM passed from the P&'
+5ample:
%%S!+P= +4+& PBMC0/R*8P1RMC(-+&*8'IS!8Y'I7+&7!CJ>Y8
%% Y1(LJ>Y87/M1P)
A !o continue the P1RM in the second line8 start the second line from 1M
th
position
-PR!,
PR!, assigns priority to a Qo$ and -PR!, assigns dispatching priority to Qo$
step Synta5: -PR!,C(value18 value() :alue1 and value( can $e >-1A --Priority is
calculated using the formula (value1?1M L value)
'/ 1+2EN1E&SE1END3'/
It is used for conditionally e5ecuting one or more steps 7esting is possi$le up
to 1A levels !he meaning is same as programming IF If the coded condition is true8
the follo"ing steps till +'S+ "ill $e e5ecuted If the condition is false8 then the steps
coded on +'S+ part "ill $e e5ecuted
Synta5:
%%name IF (relational operation) !.+7
%%ZSteps
%% +'S+
%%ZSteps
%% +7-IF
PR/& P+7- I7&'6-+ <%?; <%% < <%%?; are e5ecuted irrespective of their place
-on;t specify P/2'I28 P&''I28 P/2&1!8 S!+P&1!8 P/28 S,S&.* "ithin the
!.+7 or +'S+ Scope of IF statement
Relational condition can $e also coded as follo"s:
S!+P71M+12+7-C!R6+8 S!+P71M+R67C!R6+8 S!+P71M+ 7/! R67
S!+P71M+12+7-&& C any-a$end-code or
-- Statement
It defines the data re3uirements of the program It is coded for every file
used in the program If the employee details are stored in a file and catalogued "ith

Mainframe Refresher Part-1 Page:16

the name <SMS4'JM+MP'/,++-+!1I'S;8 one of the programs (+MPPBM) in the
application reads this file8 then P&' card for the -- loo#s li#e
%%S!+P +4+& PBMC+MPPBM8R+BI/7C1M
%%EMPFILE -- -S7CSMS4'JM+MP'/,++-+!1I'S8-ISPCS.R
0hen the program opens +MPFI'+8 it "ould open SMS4'JM+MP'/,++-+!1I'S
!he mapping is done as follo"s in the program So in future8 if you process the same
program "ith another file SMS4'JM+MP'/,++-+!1I'S(8 then change of dataset
name in the P&' is enough 2ecause of logical mapping8 program need not $e
changed
S+'+&! file1 1SSIB7 !/ EMPFILE (&/2/' Program)
-+&'1R+ (EMPFILE) FI'+@ (P'%I Program)
-&2 --71M+CEMPFILE (1SS+M2'+R)
F/P+7(EMPFILE8mode) (& )
-S71M+(-S7)
!he name of the dataset is coded in the -S7 parameter -ataset name can
contain KK characters including the periods in $et"een 3ualifier +ach 3ualifier can
have J characters and there can $e (( 3ualifiers 2ut usually "e don;t code more
than K 3ualifiers
-S7C4444,,,,UUUU8-ISPCS.R
!emporary datasets are indicated $y 99 in the -S7 (-S7C99temp)
If -S7 is not specified8 then the system assigns the specific name to dataset
If -S7C76''FI'+ or -6MM, is coded8 then all the I%/ s against this file are
$ypassed
-ISP
It is used to descri$e the status of a dataset to the system and instructs the
system "hat to do "ith that dataset after successful%unsuccessful termination of the
step or Qo$
-ISPC(current-status8 normal-termination-status8 a$normal-termination-status)
Current-status can be:
7+0 -ataset does not e5ist It "ill $e created in this step
S.R -ataset already e5ist and this step need it "ithout any e5clusive access
/'- -ataset already e5ist and this step need it "ith e5clusive access
M/- If the dataset does not e5ist8 it is to $e created If it already e5ists8 records
are to $e added to the end of the dataset In $oth the cases8 e5clusive is
needed
Normal-termination-status:
&1!'B System is to place an entry8 pointing to the dataset in the system%user
catalog
-+'+!+ -ataset is no longer re3uired Space availa$le for use $y another dataset
$ut e5isting dataset not physically erased until over"ritten $y another
dataset
P1SS -ataset is passed to su$se3uent steps in the same Qo$ and each step can
use the dataset only once

Mainframe Refresher Part-1 Page:17

*++P -ataset is to $e #ept on the volume
67&1!'B System is to delete the catalog entry corresponding to this dataset and
#eep this dataset
Abnormal-termination-status:
P1SS is not allo"ed Meaning of &1!'B8 67&1!'B8 *++P8 -+'+!+ are same as
normal-termination status
1$sence of any parameter should $e mentioned "ith <8; as they are positional
parameters +5: -ISPC(88&1!'B) If the dataset is a ne" dataset and -ISP is not
coded8 then the default in effect "ould $e DISP=(NEW,DELEE,DELEE!"
-&2 (-ata &ontrol 2loc#)
-&2 specifies attri$utes of the records in the dataset
Synta5 -&2C('R+&'C7782'*SIU+C,,8R+&FMCU8-S/RBCMM826F7/Cnn)
R+&FM
It specifies format of the dataset It can $e Fi5ed8 :aria$le8 6ndefined8 Fi5ed
2loc#ed8 varia$le 2loc#ed (F8 :8 68 F28 :2) /ther special record formats are :2S8
F2S8 :!8 F!8 F21
'R+&'
It specifies logical record length !he length of the record is as in the program
for fi5ed length records8 length of the longest record "ith four more $ytes for
varia$le length records
2'*SIU+
It contains physical record length !hat is the length of the record in the
storage medium /ne $loc# contains one or more logical records It is suggested to
code 2'*SIU+ as > so that the $est si)e is chosen $y the system8 $ased on device
If you e5plicitly code it8 then it should multiple of 'R+&' for F2 datasets and
should not $e less than length of the longest records "ith eight more $ytes for :2
dataset In the e5tra eight $ytes8 four $ytes are used for length of the record and
four $ytes are used for length of the $loc#
-S/RB
PS (Physical se3uential) P/ (Partitioned organi)ation)
26F7/
!he num$er of $uffers to $e allocated for the dataset is coded "ith 26F7/
parameter Ma5imum of (AA $uffers can $e coded !he performance of se3uential
processing "ill increase if more $uffers are allocated !he default $uffers are enough
for most of the cases
Source of -&2:
0e don;t al"ays have to "rite the -&2 parameter for a dataset 0riting -&2
parameter is one of the three "ays8 the information can $e supplied !he other t"o
"ays are:
1 &oded in the program In &/2/'8 R+&/R- &/7!1I7S clause specifies the 'R+&'8
2'/&* &/7!1I7S clause specifies the 2'*SIU+8 R+&/R-I7B M/-+ clause specifies

Mainframe Refresher Part-1 Page:18

R+&FM and R+S+R:+ clause specifies 26F7/ -S/RB can $e assumed from the
name of the dataset and the directory space allocation of SP1&+ parameter
( 6sually for an e5isting dataset8 "e don;t have to code -&2 parameters It "ill $e
availa$le in the dataset la$el !he dataset la$el is STO#E$ in the :!/& (-1S-) or
along "ith dataset (!1P+) during the dataset creation
'12+'
Synta5: '12+' C (-ataset-se3uence-num$er
8la$el-type
8P1SS0/R- T 7/P0R+1-
8I7 T /6!
8R+!P-Cnnn T+4P-! C (yydddTyyyy%ddd))
Dataset Se#uence number - identifies the relative position of a dataset on a
tape%cart volume Should $e 1 through K decimal digits /mit this parameter if
access is $eing made to the first dataset on the tape volume
Label - indicates the la$el type of the tape%cart volume
S' - indicates that a dataset has I2M standard la$els -efault value
7' - indicates that a tape dataset has no la$els
7S' - indicates that a tape dataset has nonstandard la$els
S6' - indicates that a tape dataset has $oth I2M standard and user la$els
2'P - re3uests that the system $ypass la$el processing for a tape dataset
PASSW$%D - indicates that a dataset cannot $e read8 changed8 deleted or "ritten to
unless the correct pass"ord is specified
N$PW%EAD - indicates that a dataset cannot $e changed8 deleted or "ritten8 unless
the correct pass"ord is specified 7o pass"ord is necessary for reading the dataset
IN - indicates that a dataset opened for I%/ is to $e read only
$& - indicates that a dataset opened for I%/ is to $e "ritten only
%EPD ' E(PD - indicates the retention period and the e5piration date for a
dataset

+5: '12+'C+4P-!C>K1(1 (-ataset e5pires on 1(1
st
day of (>>K)
'12+'CR+!P-C(>> (-ataset is retained for (>> days)

Mainframe Refresher Part-1 Page:19

S#A%E
It is used to re3uest space for the ne" dataset It is mandatory for all the
7+0 datasets
SP1&+ C (W!R* T &,' T $l#lgthX (8Primary-3ty 8 Second-3ty8 -irectory)
R8R'S+S R8&/7!IBS R8M4IBS R8R/67-S)
%)'C*L - Re3uests that space $e allocated in trac#s or cylinders
+l,l-t. - Specifies the average $loc# length8 in $ytes8 of data Specify a decimal
num$er from 1 through MAA=A !his ta#es precedence8 "hen specified8 together "ith
the 2'*SIU+ field of -&2 parameter
Primar/-#t/ - Specifies the amount of primary space re3uired in terms of the space
unit (trac#s%cylinders%num$er of data $loc#s) /ne volume must have enough space
for the primary 3uantity If a particular volume is re3uested and it does not have
enough space availa$le for the re3uest8 the Qo$ step is terminated
Secon0-#t/ - Specifies the num$er of additional trac#s8 cylinders8 $loc#s to $e
allocated8 if additional space is re3uired
Director/ - Specifies the num$er of (AM-$yte records needed in the directory of a
P-S (In every $loc# "e can store A-M mem$ers)
%LSE - re3uests that space allocated to an output dataset8 $ut not used8 is to $e
released "hen the dataset is closed Release occurs only if dataset is open for output
and the last operation "as a "rite
C$NI1 - re3uests that space allocated to the dataset must $e contiguous It affects
only primary space allocation
MI(I1 N It is used to specify that space re3uested should $e allocated to the largest
contiguous area of space availa$le on the volume It affects only primary allocation
%$&ND - 0hen the first parameter specifies the average $loc# length8 this parameter
re3uests that allocated space must $e e3ual to an integral num$er of cylinders +lse
ignored

Mainframe Refresher Part-1 Page:20

E4!n(
+5tent is contiguous memory location /nly 1M e5tents are possi$le for a
physical se3uential dataset in a volume In loose terms8 only 1M pointers can $e
stored for a PS dataset in one volume For a :S1M dataset it can $e 1(= In addition
to this8 the primary (first) or secondary (consecutive) space re3uest has to $e met
"ithin A e5tents
If any of the a$ove is not met8 then there "ill $e space 12+7- So for a PS
dataset8 even though you re3uest 1M>> trac#s (using the space parameter
(SP1&+C!R*S8(1>>81>>))8 the system may not allocate you 1M>> trac#s al"ays
If all the contiguous availa$le spaces are of si)e (> trac#s8 then A e5tents are
used for satisfying every primary or secondary So 1A e5tents are used for providing
Qust =>> trac#s If the system could find any 1>> trac#s for the 1M
th
e5tent8 it "ould
offer it and if not8 there "ill $e space 12+7- So in the $est case you "ill get 1M>>
trac#s and in the "orst case you "ill get K>> trac#s for the space parameter
mentioned
Space 12+7-S:
!he most fre3uent 12+7- in any production system is space a$end
S2=I: +nd of volume If the program tries to "rite more than the allocated space or
if the system could not find the re3uested primary or secondary space even $y
Qoining A e5tents8 then the step a$normally ends "ith S2=I
!o solve this a$end8 increase the primary%secondary reasona$ly and if the Qo$
again comes do"n8 create the dataset as multi-volume $y coding :/'C(888=) 1s
every volume "ill offer 1M e5tents8 KJ e5tents in this case should $e more than
enough
S-=I: If the primary space is filled and the program tries to "rite more $ut no
secondary is mentioned in the SP1&+ parameter8 then the step "ill come do"n "ith
S-=I!o solve this a$end8 provide secondary allocation in the SP1&+ parameter
S+=I: +nd of :olume !his is same as S2=I ,ou "ill get this 12+7- usually for a
partitioned dataset !o solve this8 compress the P-S $y typing <U; in ISPF =K panel
against the dataset or use I+2B+7+R If again the Qo$ comes do"n8 rename the old
one8 reallocate the ne" dataset "ith more space and copy the old mem$ers to here
and delete the renamed dataset and restart the Qo$

Mainframe Refresher Part-1 Page:21

.N'+
It is used to re3uest the system to place the dataset on a specific device%a
certain type or group of devices or the same device as another dataset
67I!C((device-num$er T device-type T group-name)
(8unit-count T P)
(8-+F+R))
/R
67I!C1FFCddname
0e2ice-number - identifies a particular device $y a =-character he5adecimal num$er
It should not $e used unless a$solutely necessary
0e2ice-t/3e - Re3uests a device $y its I2M supplied generic name (+g ==J>)
-rou3-name - Re3uests a group of devices $y its sym$olic name Installation must
have assigned the name to the device(s) during system initiali)ation
!he group-name is 1 through J alphanumeric characters (+g !+MP-1)
unit-count - Specifies the num$er of devices for the dataset (1-AO)
P - as#s the system to mount all volumes for a dataset in parallel
DEFE% - 1s#s the system to assign the dataset to the device $ut re3uests that
the volume(s) not $e mounted until the dataset is opened -+F+R is ignored for a
ne" dataset on direct access
AFF=00name - Re3uests that system to allocate different datasets residing on
different remova$le volumes to the same device during step e5ecution !he ddname
is that of an earlier -- statement in the same step It reduces num$er of devices
used in a Qo$ step
+5: 67I!C(!1P+88-+F+R) 67I!C1FFC--1
-O&."E
1 reel of !1P+ or a dis# pac# is called as one volume :/'6M+ parameter is
used to identify the volume(s) on "hich a dataset resides or "ill reside
:/'6M+ C ((PRI:1!+)
(8R+!1I7)
(8volume-se3uence-num$er)
(8volume-count))
(S+RCserial-num$er18
serial num$er()
P%I4AE - Re3uests a private volume8 that is e5clusive use of volume for the dataset
specified /nly one Qo$ can access it at a time !1P+S are PRI:1!+ $y default

%EAIN - Re3uests that volume is not to $e demounted or re"ound after the dataset
is closed or at the end of this step It is used "hen a follo"ing step is to use the
same volume
2olume-se#uence-number - identifies the volume of an e5isting multi volume dataset
to $e used to $egin processing the dataset (1-(AA)

Mainframe Refresher Part-1 Page:22

2olume-count - Specifies the ma5imum num$er of volumes that an output dataset
re3uires (1-(AA)
SE%=serial-number - Identifies $y serial num$er the volume(s) on "hich the dataset
resides or "ill reside 1 through M alphanumeric or national(E8D8H) characters
,ou can code a ma5imum of (AA volume serials
+5 : :/'6M+CS+RC-+:>>1 :/'C(888=8S+RC(P1B+>18P1B+>(8P1B+>=))
S,SO.+56la(( 7 8
It is used to identify this dataset as a system output dataset !he S,S/6!
dataset is assigned to an output class !he attri$utes for each class are defined
during P+S initiali)ation8 including device or devices for the output class ;?; refer-
$ac#s to MSB&'1SS character of P/2 &1R-
#o())onal and 9!:;ord #aram!!r(
1ll the parameters of P/28 -- and +4+& statements can $e $roadly classified
into t"o types !hey are P/SI!I/71' and *+,0/R- parameters
Parameter that has its meaning defined $y its position is positional parameter
2ypassing of any positional parameter has to $e informed to system $y <8; +5:
accounting information and programmer name of Po$ card
*ey"ord parameters follo" positional parameter and they can $e coded in
any order +5: 1ll the parameters suffi5ed $y <C; are #ey"ord parameters PBMC and
PR/&C are e5ceptions for this rule !hey are positional parameters
In-stream data
!he data passed in the P&' stream along "ith P&' statements is called in-
stream data
Synta5: %%S,SI7 -- 9999
9999 Meaning
? !he data follo"s from the ne5t line and ends "hen any %% or %? appears
at column 19 ( So <%%; and <%?; cannot $e passed to the program
%%+MPFI'+ -- ?
5675M&8&
96::DE4
%?
-1!1 !he data follo"s from the ne5t line and ends "hen any %? appears at
column 1 9 ( So <%?; cannot $e passed to the program
%%S,S6!1 -- -1!1
''SEP9 E(EC P1M=IN496;6
''IN4LSA DD S*S$&=A
''IN4LS+ DD S*S$&=A
%?
-1!18
-'MCEE
!he data follo"s from the ne5t line and ends "hen the characters coded
in -'M appears at column 1 9 (
%%S,SI7 -- -1!18-'MCDD
''EMPFILE DD <
5675M&8&
96::DE4
'<

Mainframe Refresher Part-1 Page:23

DD
O+2ER Sa!m!n(
O.+&'"
It limits the num$er of print lines !he limit ranges from 1 to 1MIII(1A !he
Qo$ is terminated if the limit is reached
%%name -- S,S/6!C?8/6!'IMC=>>>
If the program tries to "rite =>>1
st
line8 P/2 "ill 12+7- "ith SI((
DES+
!he -+S! parameter is used in conQunction "ith the S,S/6! parameter
"here the output is to $e sent !his might $e used "here a Qo$ is run on several M:S
systems and the output is directed to a single system for the convenience of the end-
user
Synta5: %%name -- S,S/6!C?8-+S!Cdestination-I-
O.+#.+
/6!P6! statement is used to specify S,S/6! parameters for several --
statements "ith a single P&' statement It allo"s printing the output from single --
statement several times8 each "ith different S,S/6! parameters
&/PI+S8 /6!'IM8 &'1SS8 -+S!8 F/RMS8 BR/6PI- can $e coded in /6!P6!

-+F16'!C, can $e coded on P/2 and S!+P level S!+P level default overrides
P/2'+:+' default
%%!+S!D1> P/2
%%S!+P1 +4+& PBMC/7+
%%F/RM( /6!P6! -+F16'!C,+S8&/PI+SC(8-+S!CPPP
%%S,SPRI7! -- S,S/6!C1 --G Produces ( copies at PPP
%%S!+P( +4+& PBMC!0/
%%F/RM= /6!P6! &/PI+SC=8-+S!C4,U
%%S,SPRI7! -- S,S/6!CV8/6!P6!C(S!+P(F/RM=8S!+P1F/RM()
--G Produces = copies at 4,U and ( copies at PPP
Ma5imum num$er of &/PI+S possi$le is (AK
/OR"S
Specify the type of forms on "hich the S,S/6! datasets should $e printed
It is 1-J alphanumeric or national character S,S/6! -- F/RMS parameter overrides
/6!P6! P1RMS parameter
%%name /6!P6! F/RMSCform-name
/REE
!he datasets are allocated Qust $efore the e5ecution of step and de-allocated
after the e5ecution of step FR++ parameter de-allocates the file as soon as the file is
closed %%ddname -- S,S/6!C48FR++C&'/S+
'N%&.DE
!he purpose of I7&'6-+ statement is same as &/P, statement of &/2/'
program !his is used to specify a P-S mem$er that "ill $e copied into the P&' at Qo$
su$mission time It is used to specify a standard list of --71M+S8 "hich "ould
other"ise $e duplicated in many similar PR/&S !his also has the advantage that

Mainframe Refresher Part-1 Page:24

amendments need only $e made in one place 2ut it ma#es P&' unnecessarily
fragmented or difficult to read%maintain in a live environment
%% I7&'6-+ M+M2+R1
M+M2+R1 should e5ist in the procedure li$rary Procedure li$raries are coded using
P&''I2 statement Include must not $e used to e5ecute a PR/& It is possi$le to nest
up to 1A levels of I7&'6-+ statements
%on6a!na)on R<l!(
&oncatenation allo"s naming of more than one dataset in a single input file
"ithout physically com$ining them:
%%S!+P'I2 -- -S7CPR/-'I2R1R,8-ISPCS.R
%% -- -S7C!+S!'I2R1R,8-ISPCS.R
%% -- -S7C6SR'I2R1R,8-ISPCS.R

In this case Prod8 !est 9 6ser li$raries are concatenated
11M P-S or (AA Se3uential datasets can $e concatenated
('R+&' and Record format should $e same
=If the 2loc# si)e is different8 then largest $loc# si)e dataset should $e first
K-atasets may reside on different devices and device types

Mainframe Refresher Part-1 Page:25

RE/ERBA%9
!he $ac#"ard reference or refer $ac# permits you to o$tain information from
a previous P&' statement in the Qo$ stream S!1R (?) is the refer-$ac# operator
It improves consistency and ma#es the coding easier
-&28 -S78 :/'CS+R8 /6!P6!8 PBM can $e referred-$ac#
Refer $ac# can $e done using the follo"ing "ays:
11nother -- of the same step "ill $e referred
?--71M+
(-- of another step can $e referred
?S!+P71M+--71M+ (--71M+ of the S!+P71M+)
=-- of another proc step can $e referred
?S!+P-I7:/*I7B-PR/&PR/&-S!+P-71M+--71M+
S!1R in the S,S/6! parameter refers $ac# to MSB&'1SS of P/2 card
Refer-$ac# e5ample:
%%S!+P1 +4+& PBMC!R17S
%%!R17FI'+ -- -S71M+C1R!R17SFI'+8-ISPC(7+08*++P)8
%% 67I!CS,S-18:/'CS+RCMPSJ>>8
%% SP1&+C(&,'8(A81))8
%% -&2C(-S/RBCPS8R+&FMCF28'R+&'CJ>)
%%!R17+RR -- -S71M+C1R!R17S+RR8-ISPC(7+08*++P)8
%% 67I!CS,S-18:/'CS+RCMPSJ>18
%% SP1&+C(&,'8((81))8
%% -&2C?!R17FI'+
%%S!+P( +4+& PBMC!R17S+P
%%!R17I7 -- -S71M+C?S!+P1!R17FI'+8-ISPCS.R
%%!R17/6! -- -S71M+C1R!R17S1FI'+8-ISPC(7+08*++P)8
%% 67I!CS,S-18:/'CR+FC?S!+P1!R17FI'+8
%% SP1&+C(&,'8(A81))8
%% -&2C?S!+P1!R17FI'+

%%S!+PA +4+& PBMC?S!+P='/1-M/-



Mainframe Refresher Part-1 Page:26

S=!6)al DD nam!(
S+E#&'B
It follo"s +4+& statement 'oad modules "ill $e chec#ed first in this li$rary
and then in the system li$raries If it is not found in $oth places8 then the P/2 "ould
12+7- "ith SJ>M code

JOB&'B
It follo"s the Qo$ statement 'oad modules of any steps (+4+&) that don;t
have respective S!+P'I2 "ill $e loo#ed into this P-S If not found8 it "ill $e chec#ed
against system li$raries If it is not found there also8 then the P/2 "ould 12+7- "ith
SJ>M
J%&&'B
It follo"s P/2 statement &atalogued procedures in the P/2 are searched in
this P-S If they are not found8 they "ill $e chec#ed in system procedure li$raries
If they are not there8 then there "ill $e P&'+RR/R "ith <Proc not found; message
Synta5: %%PR/&'I2 P&''I2 /R-+R(P-S18P-S()
I7&'6-+ mem$ers are also #ept in procedure li$raries (P&''I2)
ABEND DA+ASE+S
In case of 12+7-8 one of the follo"ing three datasets "ill $e useful If more
than one of the three datasets is coded8 then the last coded -- "ill $e effective
S,S.D."#
Prints the program area8 contents of registers8 and gives a trace $ac# of
su$routines called It "ill $e in he5adecimal format
S,SABEND
Same as S,S6-6MP8 $ut also prints the system nucleus -onYt use unless you
need the nucleus It "ill $e in he5adecimal format
S,SM-6MP
Same information as S,S12+7-8 $ut dump "ill $e in machine language
6sed to store dumps in a data set to $e processed $y an application program
JOB%A+ and S+E#%A+
!he datasets used in step are first chec#ed in the S!+P&1! (I&F or :S1M
&atalog) $efore chec#ing in system catalog If no S!+P&1! in the step and there is a
P/2&1!8 then the datasets are first searched in P/2&1! $efore chec#ing in system
catalog
S,S'N
In-stream data can $e coded in S,SI7 -- ? 6sing 1&&+P! statement8 these
records are read into the program +very accept "ill read one line into "or#ing
storage (J> column)

Mainframe Refresher Part-1 Page:27

#ro6!d<r!(
Set of Po$ control statements that are fre3uently used are defined separately
as a procedure and it can $e invo#ed as many times as "e need from the Qo$
!he use of procedures helps in minimi)ing duplication of code and pro$a$ility of
error
If a procedure is defined in the same Qo$ stream8 then it is called In-stream
procedure !hey are coded $efore the first +4+& statement in the Qo$ !he definition
starts "ith PR/& statement and ends "ith P+7- Instead procedures can $e saved in
a P-S and invo#ed from Qo$ and they are called as catalogued procedures /ne
procedure can call other !his is called nesting and nesting is possi$le up to 1A levels
In-stream Procedure &atalogued Procedure
//JOB1 JOB
//PROC1 EXEC PROC
//STEP1 EXEC PGM=IKJEFT01
//SSTSPRT !! SSO"T=*
//SSTSI# !!
!ISP=S$R%!S#=MT001&'MSG(TEST)
// PE#!
//STEP01 EXEC PROC1
%%P/21 P/2
%% P&''I2 /R-+RC(<M!>>1(PR/&P-S;)
%%S!+P>1 +4+& PR/&1
M!>>1(PR/&P-S(PR/&1)
//STEP1 EXEC PGM=IKJEFT01
//SSTSPRT !! SSO"T=*
//SSTSI# !!
!ISP=S$R%!S#=MT001&'MSG(TEST)
/*
#ro6!d<r! "od)*)6a)on
Procedure should $e generic so that it can easily $e used $y the multiple
P/2S $y simple overrides -uring the invo#ing of procedures in the P/28 one can do
the follo"ing
1 /verride: &hange the dataset names or parameters that are already coded in
the procedure
( 1ddition: 1dd ne" datasets or parameters in the already e5isting steps of the
procedure
= 7ullify: /mit the datasets or parameters that are already coded in procedure
0hen you override a cataloged procedure8 the override applies Qust to that e5ecution
of the Qo$ !he cataloged procedure itself isnYt changed
#ro6!d<r! "od)*)6a)on3 E0E% (a!m!n(
&/7-8 !IM+ and P1RM values of an +4+& statement in the procedure can $e
added%modified%nullified in the invo#ing P&' in the follo"ing "ay
%%S!+P1 +4+& PR/&-71M+8 P1R1M+!+R-71M+S!+P71M+-I7-PR/&C7+0-:1'6+
+5: PR/& &/2&'B has a statement
%%&/2 +4+& PBMCIB,&R&!'8R+BI/7CK>>*
%% +4+& &/2&'B8 R+BI/7&/2C1M CG /verrides the value of K>>*
%% +4+& &/2&'B8 !IM+&/2C(>81>) CG 1dds 1> seconds time limit for &/2 step
%% +4+& &/2&'B8 R+BI/7&/2C CG 7ullifies K>>* region re3uest -efault
region "ill $e allocated no"

Mainframe Refresher Part-1 Page:28

/ther Rules:
1 Multiple overrides are allo"ed $ut they should follo" the order !hat is first you
should override the parameters of step18 then step( and then step= 1ny overrides in
the "rong order are IB7/R+-
( If the S!+P71M+ is not coded during override8 then the system applies the
override to first step alone
%%+4+& &/2&'B8R+BI/7CA1(*
#ro6!d<r! "od)*)6a)on3 DD Sa!m!n(
-- statement in the procedure can $e modified $y
%%S!+P71M+-I7-PR/&--71M+-/F-S!+P -- parameters of dataset
1 -- statement overrides should $e done in the same order they appear in
procedure 0ithin a -- statement8 the order of parameters does not matter
(1ny additions should follo" modifications In a step8 if you "ant to override the
dataset attri$ute of one e5isting dataset and add another dataset8 you should
override the old one $efore adding the ne" one

= !o omit a parameter from a -- statement in a procedure8 Qust name it $ut don;t
pass any value for it
#ro6!d<r! "od)*)6a)on .()n> S:mbol)6 #aram!!r
1 sym$olic is a PR/& placeholder !he value for the sym$olic is supplied "hen
the PR/& is invo#ed (9sym$olCvalue) If the value is not provided during invo#e8
then the default value coded in the PR/& definition "ould $e used for su$stitution
+5: If you "ant to override 67I! Parameter value of all the -- statements8 define
this as sym$olic parameter in proc
&atalog Procedure: PR/&1
%%PR/&1 PR/&867I!CS,S-1 CG S+!S -efault value of 67I! as S,S-1
%%S1 +4+& PBMC!+S!1
%%--1 -- 67I!C967I!
%%--( -- 67I!C967I!
%%S!+P1 +4+& PR/&1867I!C!+MP-1 "ill set 967I! as !+MP-1 for this run of
procedure
Sa!m!n( No Allo;!d )n a #ro6!d<r!
,ou can place most statements in a procedure8 $ut there are a fe"
e5ceptions Some of these e5ceptions are:
1 !he P/2 statement and P+S(%P+S= &ontrol statements
( !he P/2&1! and P/2'I2 statement
= 1n instream procedure (an internal PR/&%P+7- pair)
K S,SI7 -- ?8 -1!1 statements
7ested Procedures-1dd%/verride%7ullification is applica$le at only one level In other
"ords8 if PR/&1 calls PR/&2 and PR/&2 calls PR/&&8 then no statement in PR/&&
can $e overridden from PR/&1 invocation /nly PR/&2 can do that

Mainframe Refresher Part-1 Page:29

#ro6!d<r! E4am=l!
SMS4'JM!+S!PR/&'I2(+MPPR/&)
%%+MPPR/& PR/& &'1SSCY?Y8SP1&+CY181Y -efault values defined for &'1SS
%%S!+P11 +4+& PBMC+MPPBM and SP1&+ sym$olic parameters
%%S,S/6! -- S,S/6!C9&'1SS
%%+MPM1S! -- -S7C9.'V+MP'/,+++-S8-ISPCS.R
%% -- -S7C9.'V+MP'/,++IMR8-ISPCS.R
%% -- -S7C9.'V+MP'/,++:U8-ISPCS.R
%%+MP/6! -- -S7C99I7:S+'8-ISPC(7+08P1SS)8 I7:S+' is temporary
%% 67I!CS,S-18SP1&+C(&,'8(9SP1&+)) dataset
%%+MP&7!' -- -6MM,
%%? +MP&7!' is a control card and any in-stream data can $e coded during the
%%? invo#e
%%?
%%I7:=>(> +4+& PBMC+MPRP!
%%S,S/6! -- S,S/6!C9&'1SS
%%I7:M1S! -- -S71M+C99I7:S+'8-ISPC(/'-8-+'+!+)
%%I7:S'S! -- S,S/6!C9&'1SS
SMS4'JM!+S!P&''I2(+MPP&')
%%+MPP&'1 P/2 (1>>>8(>>)8&'1SSC18MSB&'1SSCV87/!IF,C9S,S6I-
%%PR/&'I2 P&''I2 /R-+RC(SMS4'JM!+S!PR/&'I2)
%% S+! SP1&+C<181; 4alue is -i2en =or s/mbolic 3arameter SPACE"
''<SEP9A PA%M is a00e0 an0 2alue =or s/mbolic 3arameter 8L> is su33lie0"
%%S!+P>1 +4+& +MPPR/&8P1RMS!+P11C;>(%11%1OIO;8.'VCPR/-
%%S!+P11+MPM1S! --
%% -- -S7CPR/-+MP'/,++&!S8-ISPCS.R
''<Instea0 o= P%$D"EMPL$*EE"IM%, P%$D"EMPL$*EE"CS 0ataset is use0 ?.ereas
''<ot.er t?o 0atasets P%$D"EMPL$*EE"EDS an0 P%$D"EMPL$*EE"4@ retains t.eir
''<3osition in concatenation"
%%S!+P11+MP/6! -- 67I!C!+MP-1
''<&NI 3arameter o= EMP$& =ile is mo0i=ie0
%%S!+P11+MP&7!' -- ?
-+SIBCSS+
%?
''<EMPCNL control car0 2alue is 3asse0"
%%S!+P11+MP/6!( -- -S7CPR/-+MP'/,++&/7&1!8
%% -ISPC(7+08&1!'B8-+'+!+)867I!CS,S-18
%% SP1&+C(&,'8(1>81>))
''<EMP$&5 =ile is a00e0 to t.e ste3 SEP9A"
In the a$ove e5ample8 &'1SS retains the default value coded on the PR/& definition
Statement (&'1SSCY?Y)

Mainframe Refresher Part-1 Page:30

'EB%O#,
It is used to copy one or more mem$ers from an e5isting dataset to a ne" or
e5isting P-S data set It can $e also used for compressing P-S8 'oading P-S to !1P+
and unloading from !1P+ to dis# !his utility needs t"o "or# files S,S6!= and
S,S6!K in addition to S,SI7 and S,SPRI7!
FI+'- Meaning
&/P, Function is &/P,
S+'+&! Specifies the mem$ers to $e copied%replaced
Synta5: (71M+-I7-/6!P6!871M+-I7-/6!P6!8#+P'1&+-IF-+4IS!S)
+4&'6-+ Specifies the mem$ers to $e e5cluded from copy
'IS!C,+S -isplays the copied mem$ers in the S,SPRI7!
I7-- Points to input dataset
/6!-- Points to output dataset Should e5ist on the same line of &/P,
'EB%O#,3 %ON+RO& %ARD /OR "ER$'N$ +?O &'BRAR'ES
%%S,SI7 -- ?
&/P, /6!--C/6!P6! I7--C(I7P6!>18(I7P6!>(8R)8'IS!C7/)
%?
It says -- statements I7P6!>1 and I7P6!>( are input files /6!P6! is the
output file 7ote the YRY in (I7P6!>(8R) It instructs to I+2&/P, that li#e named
mem$ers are to $e replaced 'IS!C7/ indicates that the names of the mem$ers
copied need not $e listed in the S,SPRI7! dataset
'EB%O#,3%ON+RO& %ARD /OR SE&E%+'-E %O#,1RE#&A%E
&/P, /6!--C/6!P6!8I7--CI7P6!>1
S+'+&! M+M2+RC((M+M187+071M+8R)8(M+M(88R))
M+M1 is copied as 7+0M+M in /6!P6! If already 7+0M+M e5ist8 it "ill $e replaced
'EB%O#,3%ON+RO& %ARD /OR O"'++'N$ SE&E%+ED "E"BERS
&/P, /6!--C/6!P6!8I7--CI7P6!>1
+4&'6-+ M+M2+RC(M+M18M+M()
1ll the mem$ers e5cept M+M1 and M+M( are copied into /6!P6! from I7P6!>1
'EB%O#,3%om=l!! (!= *or %om=r!(()n> #DS
%%&/MPR+SS +4+& PBMCI+2&/P,
%%S,SPRI7! -- S,S/6!C?
%%&/MPFI'+ -- -S7CMM>1&/P,'I2&/28-ISPC/'-
%%S,S6!= -- 67I!CS,S-18SP1&+C(!R*8(181))
%%S,S6!K -- 67I!CS,S-18SP1&+C(!R*8(181))
%%S,SI7 -- ?
&/P, /6!--C&/MPFI'+8I7--C&/MPFI'+
%?

Mainframe Refresher Part-1 Page:31

'EB$ENER
In addition to S,SI7 and S,SPRI7! datasets8 it needs S,S6!1 and S,S6!(
datasets S,S6!1 is coded "ith input dataset and S,S6!( is coded "ith output
dataset If attri$utes "ere not given for S,S6!(8 then the program "ould assume
S,S6!1 attri$utes for S,S6!(
It is primarily used as &/P, utility If you "ant to copy any !1P+ file to -IS*
or -IS* to !1P+8 then no S,SI7 is needed
If you "ant to reformat your input file or if you "ant to create mem$ers out
of your PS file8 then you need control card (S,SI7) and the first statement should $e
B+7+R1!+
FI+'- Meaning
B+7+R1!+ First Statement "hich sets the values for M1471M+8M14BPS8
M14'I!S8 M14F'-S
M1471M+ Ma5imum M+M2+R statements that can follo"(-uring mem$er
generation)
Synta5: M1471M+C=
M14BPS Ma5imum I-+7! statement that can follo" (-uring mem$er
generation)
M14F'- Ma5imum FI'+- statements that can follo" (-uring reformatting)
Synta5: M14F'-SC1>
M14'I!S Ma5imum si)e of literal during reformatting
M+M2+R It identifies the name of the mem$er to $e created
Synta5: M+M2+R 71M+CM+M1
R+&/R-
I-+7!
It usually follo"s M+M2+R statement to identify the last record to $e
copied from the input dataset
R+&/R- I-+7!C ('ength8;'iteral;8Start-&olumn)
+5ample: R+&/R- I-+7!C(=8;M:S;81)8 then the last record to $e
copied into the mem$er from the input dataset8 has M:S in column
1-=
R+&/R-
FI+'-
It is used for reformatting the records in the input file
R+&/R- FI+'-C('ength8 ;literal; or input column8 conversion8 output
column)
/utput column says "here the field should $e placed in the output
file &onversion can $e UP or PU PU means the input pac#ed decimal
field is $eing converted into )oned format and UP is the reverse

'EB$ENER3 S,S'N %ARD /OR %REA+'N$ +2REE "E"BERS /RO" 'N#.+ #S /'&E
%%S,SI7 -- ?
B+7+R1!+ M1471M+C=8M14BPSC(
M+M2+R 71M+C M+M21
R+&/R- I-+7!C(J8Y11111111Y1)
M+M2+R 71M+CM+M2(
R+&/R- I-+7!C(J8Y((((((((Y81)
M+M2+R 71M+CM+M2=
%%
I+2B+7+R creates three mem$ers It reads input file "rites into mem$1 until it finds
11111111 in column 1 In the same "ay it reads and "rites the records into mem$(

Mainframe Refresher Part-1 Page:32

until it finds (((((((( in column 1 !he remaining records in the input dataset are
copied into M+M2=
'EB$ENER3 S,S'N %ARD /OR RE/OR"A++'N$ D.R'N$ %O#,
%%S,SI7 -- ?
B+7+R1!+ M14F'-SCA8M14'I!SCK
R+&/R- FI+'-C(A81881)8FI+'-C((>8(188M)8FI+'-C(O8M18UP8(M)8 4
FI+'-C(O8I>8UP8=1)8FI+'-C(K8Y!+S!Y88=M)
%?
Input &olumn 1ny &onversion /utput column
:alues in column 1-A &opied into column 1-A
:alues in column (1-K> &opied into column M-(A
:alues in column M1-O &onvert the )oned into
pac#ed $efore copying
Pac#ed value is "ritten in
(M-=>
:alues in I>-O &onvert the )oned into
pac#ed $efore copying
Pac#ed value is "ritten in
=1-=A
!+S! literal is "ritten in
column =M-=O
'E2&'S+
It is used to list
1 !he entries in the catalog (S,SI7 *+,0/R-- 'IS!&!'B)
( -irectory(s) of 1-1> P-S (S,SI7 *+,0/R-- 'IS!P-S)
= !he entries in :!/& (S,SI7 *+,0/R--'IS!:!/&)
&ode S,SI78 S,SPRI7! and one more -- that "ill mount the volume 3ueried in
S,SI7
!he follo"ing P/2 lists the :!/& of I7!2>1 in a formatted "ay
%%M,P/2 P/2 &'1SSC18MSB&'1SSC18R+BI/7C(AM*8MSB'+:+'C(181)
%%'IS!:!/& +4+& PBMCI+.'IS!
%%S,SPRI7! -- S,S/6!C?
%%:/'-- -- 67I!CS,S-18:/'CS+RCI7!2>18-ISPC/'-
%%S,SI7 -- ?
'IS!:!/& F/RM1!8:/'C===>CI7!2>1
%?
!o list the contents of any P-S:
'IS!P-S -S71M+C(S,S1'I7*'I2)8 :/'CS+RCI7!2>1
!o list the catalog for a specific -1S- volume:
'IS!&!'B :/'C==A>CP62>>>
'E2"O-E
It is used to move one dataset from one volume to another volume
//STEP01 EXEC PGM=IE$MOVE
//FROMVO* !! VO*=SER=TST001%!ISP=O*!%"#IT=SS!+ /*+**OC+T FROM VO*"ME*/
//TOVO* !! VO*=SER=PR!001%!ISP=O*!%"#IT=SS!+ /*+**OC+TE TO VO*"ME*/
//SSPRI#T !! SSO"T=*
//!!01 !! "#IT=SS!+%VO*=REF=SS1'SVC*IB%!ISP=O*!
//SSI# !! *
MOVE P!S=M"T$"'TEST'P!S%TO=33,0=PR!001%FROM=33,0=TST001

Mainframe Refresher Part-1 Page:33

/*
FR/M clause in the S,SI7 is not needed for catalogued datasets It is suggested to
allocate the Supervisor &all 'i$rary
'EB%O"#R
It is used to compare t"o PS or P-S datasets !"o PS are same8 if the
num$er of records is same and all the records are identical S,SI7 is not needed for
PS comparison If they are not identical8 then the follo"ing "ill $e listed in the
S,SPRI7!
-- statements that define the dataset8 Record and 2loc# num$ers8 the
une3ual records and ma5imum of 1> une3ual records found
!"o P-S are same8 if the corresponding mem$ers contain same num$er of
records and all the records are identical S,SI7 should have &/MP1R+ !,P+CP/ for
P-S
%%S,S6!1 I7P6! -1!1S+! 1
%%S,S6!( I7P6! -1!1S+! (
%%S,SPRI7!
%%S,SI7 -- ?
I+22!P&.
I+2+-I!:
/ne typical intervie" 3uestion is ho" to run the selected steps For e5ample8 ho" to
e5ecute stepK and stepO of 1> steps P&' !he typical ans"er is to restart the Qo$
from stepK and include a <1'01,S !R6+; condition (li#e &/7-C(>8'+) or
&/7-C(K>OM8B!)) in steps A8M8I8J and 1> If the intervie"er said &/7- should not
used8 then only "ay is I+2+-I!
%%MMMA(=A& P/2 (M:SVuest)8YI+2+-I! !+S!Y8
%% &'1SSC28MSB&'1SSC487/!IF,C:MMA(=A8R+BI/7C(JM
%%?
%%S62MI! +4+& PBMCI+2+-I!
%%S,S6!1 -- -S7C!+S!M6!.6P&'(P&'I7P)8-ISPCS.R
%%S,S6!( -- S,S/6!C(?8I7!R-R)
%%S,SPRI7! -- S,S/6!C?
%%S,SI7 -- ?
+-I! S!1R!CMMMA(=A&8!,P+CI7&'6-+8S!+P71M+C(S!+P>>>K8S!+P>>>O)
%%?
In the a$ove P&'8 P&'I7P is the 1> steps P&' MMMA(=A& is the Qo$-name in the P&'
If !,P+ is e5clude8 then the mentioned steps "ill not $e copied%su$mitted
D/SOR+
If you do a glo$al search of your P&' inventory8 you "ill find the program that
is used very fre3uently is S/R! !here are t"o famous S/R! products are availa$le in
the mar#et /ne is -FS/R! and the other is S,7&S/R! !he $asic commands in $oth
the products are same

Mainframe Refresher Part-1 Page:34

I&+!//' provides a lot more than "hat S/R! can offer and it comes "ith
-FS/R! product S,7&!//' comes "ith S,7&S/R! product PBMCS/R! can point
to -FS/R! or S,7&S/R! It is actually an alias to S/R! product in your installation
-FS/R! is I2M product and it needs the follo"ing datasets for its operation
S/R!I7 (Input dataset)8 S/R!/6! (/utput dataset)8 S,SI7 (&ontrol &ard) and
S,S/6! (Message dataset)
Message dataset can $e altered using MSB--7C parameter of S,SI7
SOR+ %ard o 6o=: all @! r!6ord( *rom SOR+'N o SOR+O.+
S/R! FI+'-SC&/P,
SOR+ 6ard o (A)= *)r( 100 r!6ord( and @!n 6o=: 20 r!6ord(
S/R! FI+'-SC&/P, S*IPR+&C1>> S!/P1F!C(>
SOR+ %ard o (or @! r!6ord( ba(!d on A!: *)!ld(
S/R! FI+'-SC(S!1R!P/S8'+7B!.8!,P+8AS&T$+S&)
!ype C &. (&haracter)8 2I (2inary)8 U- (Uoned -ecimal)8 P-(Pac#ed -ecimal)8
FS (Signed num$ers)
+5: S/R! FI+'-SC(181>8&.8181A8(8&.81)
SOR+S all @! SOR+'N r!6ord( ;)@ 1310
@
6ol<mn a( maBor A!: and 15316
@
6ol<mn
a( m)nor A!: b!*or! ;r))n> o SOR+O.+C
SOR+ 6ard o (!l!6 @! r!6ord( m!!)n> @! 6r)!r)a
I7&'6-+ &/7-C(S!1R!P/S8'+7B!.8!,P+8R/8:1'6+)
R/-Relational operator can $e +V87+8'!8B!8'+8B+
&ard to select the records "ith !RI&., in the column K-O
I7&'6-+ &/7-C (K8M8&.8+V8&;!RI&.,;)
&ard to select the records "hich has same values in (-= and A-M
I7&'6-+ &/7-C ((8(8&.8+V8A8(8&.)
SOR+ 6ard o r!B!6 @! r!6ord( m!!)n> @! 6r)!r)a
/MI! &/7-C(S!1R!P/S8'+7B!.8!,P+8R/8:1'6+)
&ard to reQect the records "ith !RI&., in the column K-O
/MI! &/7-C (K8M8&.8+V8&;!RI&.,;)
&ard to reQect the records "hich has same values in (-= and A-M
/MI! &/7-C ((8(8&.8+V8A8(8&.)
S/R! card to change P- to U-
If input file has a P- field SO(A):OO &omp-= and to reformat as PI& SO(A)O(() then
use8
/6!R+& FI+'-SC(18A8P-8+-I!(S!!!!!!!)8SIB7SC(8-88))
S/R! card to remove the duplicates
S/R! FI+'-SC (18A8&.81)8+V61'S
S6M FI+'-SC7/7+
S/R!I7 records are sorted on the #ey 1-A and if more than one record is
found to have same #ey8 then only one record "ill $e "ritten to S/R!/6! If +V61'S
is coded8 then the record to $e "ritten is the FIRS! record else it can $e anything
SOR+ 6ard o (<m @! Dal<!( *or (am!3A!: r!6ord(
S/R! FI+'-SC (18A8&.81)8+V61'S
S6M FI+'-SC(1>8A8P-)

Mainframe Refresher Part-1 Page:35

S/R!I7 records are sorted on #ey 1-A and if more than one record is found to
have same #ey8 then the records are summed on column 1>-1K and one record is
"ritten "ith total sum
S/R! card to add se3uence num$er to the output file
/6!R+&C(18(>8S+V76M8K8U-) K digit )oned decimal se3uence num$er is
added "ith all the records of input file in column (1-(K
!his "ill $e useful for reading a file from $ottom to top !his "ill $e useful for
matching logic in P&' Matching logic in P&' "ill $e e5plained later
SOR+ 6ard o r!(r<6<r! @! )n=< *)l! b!*or! *!!d)n> o (or
I7R+& FI+'-SC(=I8(8M8M8K>8K8=18()
!he length of the output file is 1K
S/R! card to create multiple files from single input file (Ma5imum =( files)
/6!FI' FI'+SC1 I7&'6-+C(18M8&.8+V8&;M6M21I;)
/6!FI' FI'+SC( I7&'6-+C(18M8&.8+V8&;!RI&.,;)
&ode output files as S/R!/F1 and S/R!/F(
S/R! card to restructure the sorted file $efore "riting
/6!R+& FI+'-SC(1:18(>8 CG FIRS! (> &.1R FR/M I7P6! FI'+
(1:&;M6!.6;8 C G F/''/0+- 2, S!RI7B <M6!.6;
(M:1>U8 CG F/''/0+- 2, 1> 2I71R, U+R/S
=M:(181>) CG (1
S!
to 1> &.1R1&!+RS FR/M I7P6! FI'+
S/R! card to change any <44; in the column M-I to <,,;
/6!R+& FI+'-SC(1:18A8
M:18(8&.17B+C((8&Y44Y8&Y,,Y)87/M1!&.C(M8()8
J8K()
SOR+ 6ard o m!r>!
M+RB+ FI+'-SC(S!1R!P/S8'+7B!.8!,P+8AS&T$+S&8S!1R!P/S8Z)
1(J such *eys can $e given -atasets to $e merged are coded in S/R!I7>> to
S/R!I7OO
S/R! &1R- to e5tract all the PR/&S e5ecuted in a P&'
/P!I/7 &/P,
I7&'6-+ F/RM1!CSS8&/7-C(18J18+V8&Y+4+&Y817-818J187+8&YPBMC)
'%E+OO&
-- statements in I&+!//':
!//'MSB F/R I&+!//' M+SS1B+S
-FSMSB F/R S/R! M+SS1B+S
!//'I7 F/R I&+!//'-&/7!R/'-&1R-
4444&7!' F/R S/R!-&/7!R/'-&1R- 6S+- 2, I&+!//'
4444 is coded in 6SI7B clause of !//'I7
+OO&'N 6ard o 6o=:
&/P, FR/M(I7--) !/(/6!--) ( 6p-to 1> -- can $e given)

Mainframe Refresher Part-1 Page:36

+OO&'N 6ard o 6o=: <n)E<!1(!l!6!d d<=l)6a! r!6ord(
S+'+&! FR/M(I7--) !/(/6!--) /7 (S!1R!P/S8'+7B!.8!,P+)
7/-6PS%1''-6PS%'/0+R(n)%.IB.+R(n)%+V61'(n)%FIRS!%'1S!
7/-6PS N &/P, only the uni3ue records
1''-6PS N &/P, only the duplicates
.IB.+R(n) N &/P, those duplicates that occurs more than n times (n CG 1-OO)
'/0+R(n) N &/P, those duplicates that occurs less than n times (n CG 1-OO)
+V61'(n) N &/P, those duplicates that occurs e5actly n times (n CG 1-OO)
FIRS! - Retains the first copy in case of duplicates
'1S! - Retains the first copy in case of duplicates
+OO&'N %ard o >! @! (a)()6( o* a n<m!r)6 *)!ld
S!1!S FR/M(I7--) /7(S!1R!8'+7B!.8!,P+)
Print the ma5imum8 average and total for numeric fields (1> /7 possi$le)
+OO&'N %ard o >! @! n<mb!r o* <n)E<! Dal<!( )n a *)!ld
67IV6+ FR/M(I7--) /7(S!1R!8'+7B!.8!,P+)
Print count of uni3ue values
+OO&'N %ard o >! all @! Dal<!( *or a =ar)6<lar *)!ld
-ISP'1, FR/M(I7--) /7(S!1R!P/S8'+7B!.8!,P+) 'IS!('IS!--)
Prints values of a field in the input dataset to 'IS!-- ((> /7 possi$le)
+OO&'N %ard o >! all @! Dal<!( *or a =ar)6<lar *)!ld F ?)@ O66<rr!n6! 6on(ra)n
/&&6RS FR/M(I7--) /7(S!1R!P/S8'+7B!.8!,P+) 'IS!('IS!--) /P!I/7
/P!I/7 C G .IB.+R(n) '/0+R(n) +V61'(n) 1''-6PS 7/-6PS
.IB.+R(() means only the values that are repeated more than ( times is reported at
'IS!-- dataset
+OO&'N %ard o >! n<mb!r o* r!6ord( *!ll )no @! ran>! m!n)on!d
R17B+ FR/M(I7--) /7(S!1R!8'+7B!.8F/RM1!) 'IS!(/6!--) options
/ptions are /&&6RS .IB.+R(n)%'/0+R(n)%.IB.+R(n1) '/0+R(n()%
+V61'(n) 7/!+V61'(n)
It prints count of records meeting value criteria and the F/RM1! should $e numeric
+OO&'N 6ard o )nDoA! SOR+
S/R! FR/M(I7--) !/(/6!--) 6SI7B(5555)
S/R! statements should $e coded under the --71M+ 5555&7!'

Matching 'ogic in P&'
I have t"o files file1 and file( I "ant to generate three reports out of these
t"o files
1!he first report should have records that e5ist in $oth files
(!he second report should contain records that e5ist only in first file and not in
second file
=!he third report should contain records that e5ist only in the second file and not in
the first file
%%S!+P>1>> +4+& PBMCI&+!//'
%%?
%%!//'MSB -- S,S/6!C?

Mainframe Refresher Part-1 Page:37

%%-FSMSB -- S,S/6!C?
%%I71 -- ?
1(=KAMIJO>
=KAMIJO>1(
AMIJO>1(=K
%%I7( -- ?
=KAMIJO>1(
IJO>1(=KAM
JO>1(=KAMI
%%!1 -- -S7C9!18SP1&+C(&,'8(A8A)8R'S+)8-ISPC(8P1SS)
%%!( -- -S7C9!(8SP1&+C(&,'8(A8A)8R'S+)8-ISPC(8P1SS)
%%I7! -- -S7C?!18-ISPC(/'-8P1SS)8:/'CR+FC?!1
%% -- -S7C?!(8-ISPC(/'-8P1SS)8:/'CR+FC?!(
%%FI'+1 -- S,S/6!C?
%%FI'+2 -- S,S/6!C?
%%/6! -- S,S/6!C?
%%!//'I7 -- ?
S/R! FR/M(I71) 6SI7B(&!'1)
S/R! FR/M(I7() 6SI7B(&!'()
S/R! FR/M(I7!) 6SI7B(&!'=)
%%&!'1&7!' -- ?
S/R! FI+'-SC(181>8&.81)
/6!FI' F71M+SC!18/6!R+&C(18J>8&Y1Y)
%%&!'(&7!' -- ?
S/R! FI+'-SC(181>8&.81)
/6!FI' F71M+SC!(8/6!R+&C(18J>8&Y(Y)
%%&!'=&7!' -- ?
S/R! FI+'-SC(181>8&.81)
S6M FI+'-SC(J1818U-)
/6!FI' F71M+SC/6!8I7&'6-+C(J1818U-8+V8=)8/6!R+&C(18J>)
/6!FI' F71M+SCFI'+18I7&'6-+C(J1818&.8+V8&Y1Y)8/6!R+&C(18J>)
/6!FI' F71M+SCFI'+28I7&'6-+C(J1818&.8+V8&Y(Y)8/6!R+&C(18J>)
%?
+5planation:
&!'1 N 1dd 1 to all the records of the first file at J>
th
column
&!'( N 1dd ( to all the records of the second file at J>
th
column
&!'= N &oncatenate $oth files and sort the file on #ey if duplicates found8 sum on
J1
st
column So if any record e5ists in $oth the file8 it "ill have = after summing
So no" e5tract records "ith <1; 8 <(; and <=; into three files 0hile "riting the
records8 remove the J1
st
$yte added for our temporary purpose
<1; N Records only in first file
<(; N Records only in second file
<=; N Records e5ist in $oth the files
I+.PR/BM
It is used to
1&atalog a dataset (&1!'B -S71M+C12&8 :/'CS+RCnnnn)
(6ncatalog a dataset (67&1!'B -S71M+C12&)
=Rename a dataset (R+71M+ -S71M+C12&8:/'CS+RCnnnn87+071M+C-+F)
K&reate an inde5 for B-B (2'-B I7-+4Cgdg-name8 'IMI!Cn8 R8+MP!,SR8-+'+!+S)

Mainframe Refresher Part-1 Page:38

A-eleting the inde5 for B-B (-'!4 I7-+4Cinde5-name)
!he S,SI7 cards are given in $rac#et !he utility needs t"o "or# datasets and
S,SPRI7! for messages &ontinuation of control card needs to $e indicated $y <4; in
I(
nd
column
If your shop installed SMS8 then uncatalog "ont "or# it out $ecause SMS
handles the catalog
I+.I7I!!
It is used to initiali)e a tape It "ill "rite the volume serial num$er to the tape
//STEP01 EXEC PGM=IE$I#ITT
//SSPRI#T !! SSO"T=*
//*+BE* !! !CB=!E#=3%"#IT=(T+PE%%!EFER)%!ISP=(%KEEP)%*+BE*=(%S*)
//SSI# !!*
*+BE* I#ITT SER=!EVSMS%!ISP=RE-I#!
/*
$!n!ra)on Daa $ro<= ($D$)
B-B is group of datasets that are related to each other chronologically or
functionally +ach of these dataset is called a generation !he generation num$er
distinguishes each generation from others
If the B-B 2ase is MM>1P1,R/''M1S!+R8 then their generations are
identified using the generic name [MM>1P1,R/''M1S!+RBnnnn:55\
nnnn is generation num$er (>1-OOOO) and 55 is version num$er (>>-OO)
R!*!rr)n> $!n!ra)on( )n J%&
!he current generation is referred $y B-B21S+(>)8 the previous generation
$y B-B21S+(-1) and the ne5t generation $y B-B21S+(L1)
B+7+R1!I/7S 1R+ 6P-1!+- /7', 1! !.+ +7- /F !.+ P/2 It means8 if the
first step creates one generation8 code it as B-B21S+(L1) and if the second step
creates another generation8 then it S./6'- $e coded as B-B21S+(L() as the (L1)
version is not yet promoted to current version Similarly to refer the B-B created in
the second step8 refer it $y B-B21S+(L()
B-B datasets can $e also referenced "ith their generation num$er li#e
<MM>1P1,R/''M1S!+RB>>1:>>;
AdDana>! o* $D$
1 B-B datasets are referred in the P&' using B-B $ase and relative num$er So the
same P&' can $e used again and again "ithout changing the dataset name and this
is the $iggest advantage of B-B
(B-B 2ase has pointers to all its generations 0hen you "ant to read all the
transactions done till today8 you can easily do it $y reading the B-B $ase if it is
availa$le /ther"ise you have to concatenate all the transaction files $efore reading
%r!a)on o* $D$
1B-B 2ase is created using I-&1MS !he parameters given "hile creating the B-B
are:

Mainframe Refresher Part-1 Page:39

Parameter Purpose
71M+ 2ase of the B-B is given here
'IMI! !he ma5imum num$er of B-B version that can e5ist at any point
of time It is a num$er and should $e less than (AM
+MP!,%7/+MP!, 0hen the 'IMI! is e5ceeded8
+MP!, #eeps /7', the most recent generation
7/+MP!, #eeps the 'IMI! num$er of ne"est generation
S&R1!&.%
7/S&R1!&.
S&R1!&. un-catalogue and deletes the versions that are not #ept
7/S&R1!&. Qust does un-cataloguing and it is not physically
deleted from the volume
/07+R /"ner of the B-B
F/R -1,S (n) %
!/ (-1!+)
+5piry date &an $e coded either in the unit of days or till
particular date
( Model dataset is defined after or along "ith the creation of $ase /nce model -&2
is defined8 then during the allocation of ne" versions8 "e no need to code -&2
parameter Model -&2 parameter can $e overridden $y coding ne" parameter "hile
creating the B-B version It is "orth to note that t"o B-B version can e5ist in t"o
different formats
1 step that defines a B-B and allocates a model -S&2
%%B-B +4+& PBMCI-&1MS
%%S,SPRI7! -- S,S/6!C?
%%M/-+' -- -S71M+CMM>1P1,R/''M1S!+R8-ISPC(8*++P)8
%% 67I!CS,S-18:/'CS+RCMPSJ>>8SP1&+C(!R*8(>))8
%% -&2C(-S/RBCPS8R+&FMCF28'R+&'CK>>)
%%S,SI7 -- ?
-+FI7+ B-B ( 71M+(MM>1P1,R/''M1S!+R) -
'IMI!(A) -
7/+MP!, -
S&R1!&. )
%?
.o" to Solve 12+7-S]
!here are t"o #inds of a$ends- 6S+R and S,S!+M
6S+R (6nnnn) S,S!+M (Snnnn)
Prefi5ed "ith 6 Prefi5ed "ith S
1pplication -riven N !he application
program issues the user a$end $y calling
installation specific a$end routine
I2M Supplied a$end routine: I'2/127>
System -riven N 0hen the system is not
a$le to perform a statement8 it a$ended
"ith respective system a$end
M/:+ OOO !/ 12+7--&/-+
&1'' <I'2/127>; 6SI7B 12+7--&/-+
!his code 0ill a$end the program "ith
6>OOO

Mainframe Refresher Part-1 Page:40

+5: In a $illing application8 the country
referred in the $ill-to address is missing
in the country ta$le "hich is an serious
issue and so the program "ill $e "ritten
in such a "ay to a$end in this scenario
+5: !rying to do an arithmetic operation
on non-numeric data 1s system could
not perform this8 it "ill a$end "ith S>&I
Solution: 'oo# for the a$end code in the
program and study the application logic
$ehind this a$end !hen appropriately fi5
the data%rerun
Solution: Refer I2M Manuals for system
a$end and ta#e appropriate action ,ou
may need to analyse program%data to fi5
$ased on type of a$end
System a$ends can $e environment (space%region) related or program
related(logic%data driven logic) Fi5ing a program related a$end is comparatively
complicated than enviroment related system a$ends or user a$ends
!he usual process to solve a system a$end is:
1Refer the S,S/6! of the Qo$ and get the ne5t se3uential instruction to $e e5ecuted
(/ffset)
(&ompile the program "ith 'IS! option if the compiled one is not "ith either 'IS! or
/FFS+! option
=&hec# for the offset in the compilation list and Bet the respective statement
num$er
KIdentify the statement !his "ould $e a numeric operation on non-numeric data
AIdentify the source of the non-numeric data and correct it
!hough the process loo#s simple and this "ill "or# O> percent of the cases8 the
3uestions are:
In case offset and the a$ending module is not displayed in the sysout8 ho" to
proceed]
In case of data-e5ception #ind of a$end8 if the particular statement referred
more than one field8 ho" do you conclude "hich field have pro$lem "ithout display
and rerun]
If the source for the field in pro$lem is in file8 ho" do you #no" "hich record
of this field in the file]
-ump Reading e5posure "ill help you in all these cases 1s dump reading #no"ledge
is important for any maintenance % support proQect8 let us study "ith a simple
e5ample:
Simple Program
CB* *IST
I!E#TIFIC+TIO# !IVISIO#'
PROGR+M.I!'S+#SOFT'
*
E#VIRO#ME#T !IVISIO#'
*
!+T+ !IVISIO#'
-ORKI#G.STOR+GE SECTIO#'

Mainframe Refresher Part-1 Page:41

01 -S.V+RI+B*ES'
0/ -S.EMP.#+ME PIC X(10)'
0/ -S.EMP.+GE PIC 0(0&)'
0/ -S.EMP.CIT PIC X(10)'
0/ -S.EMP.S+* PIC S0(0,)'
0/ -S.EMP.BO#"S PIC S0(0,)'
0/ -S.EMP.CTC PIC S0(0,)'
*
PROCE!"RE !IVISIO#'
*
MOVE 1M"T$"1 TO -S.EMP.#+ME
MOVE &0 TO -S.EMP.+GE
MOVE 1TRIC$1 TO -S.EMP.CIT
MOVE 20000 TO -S.EMP.S+*
COMP"TE -S.EMP.CTC = (-S.EMP.S+* * 1&) 3 -S.EMP.BO#"S
!ISP*+ 1S+#SOFT COMP*ETE!1
!ISP*+ 1EMP*OEE !ET+I*41 -S.EMP.#+ME 1%1
-S.EMP.+GE 1%1
-S.EMP.CIT 1%1
-S.EMP.S+* 1%1
-S.EMP.CTC
STOP R"#'
!he program is compiled "ith 'IS! option to get assem$ler listing
/n successful compilation8 the program is su$mitted "ith the P&'
!he program is a$ended and the sysout says:
CEE3&05S T6e s7ste8 9ete:te9 ; 9;t; e<:e=t>?@ (S7ste8 C?8=Aet>?@ C?9e=0C5)'
FB?8 :?8=>Ae u@>t S+#SOFT ;t e@tB7 =?>@t S+#SOFT ;t :?8=>Ae u@>t
?CCset 30000032+ ;t e@tB7 ?CCset +0000036A
;t ;99Bess &500115+'
!he instruction at the /ffset =M1 is failed So loo# into the compilation listing for the
statement that is in the offset =M1

Mainframe Refresher Part-1 Page:42

0000&1 MOVE
0003/, !&05 &012 +0B! MVC &&(,%&)%1,0(10) (B*-=0)3&& PGM*IT +T 31,/
000022 COMP"TE
0003/E F&45 !0F, &01E P+CK &4,(/%13)%30(,%&) TS&=0 -S.EMP.BO#"S
000324 !&0F !0E, +0,! MVC &3&(12%13)%141(10) TS1=0 PGM*IT +T 3135
00036A FA54 D0F2 D0F8 AP 242(6,13),248(5,13) TS1=10 TS2=0
000350 040F !0F3 #I &43(13)%X10F1 TS1=11
000354 F,44 !0F3 !0F3 D+P &43(/%13)%&43(/%13) TS1=11 TS1=11
00035+ F354 &0&2 !0F3 "#PK 3,(,%&)%&43(/%13) -S.EMP.CTC TS1=11
0000&3 !ISP*+
=A+-=IF $elongs to the &/MP6!+ statement that is in line >>>>((
7o" loo# for line >>>(( in compilation listing
0000&1 MOVE 20000 TO -S.EMP.S+*
000022 COMPUTE WS-EMP-CTC = (WS-EMP-SAL * 12) + WS-EMP-BONUS
0000&3 !ISP*+ 1S+#SOFT COMP*ETE!1
So one of this field referred in this statement has Qun# in it Pust $efore compute "e
populated 0S-+MP-S1' and so there is a pro$lem "ith 0S-+MP-2/76S If you go
thru the code8 you "ill find the developer missed to populate%initiali)e 0S-+MP-
2/76S and that has caused data e5ception
If these fields are from file8 "e cannot easily confirm li#e a$ove So "e have to give
display for these t"o fields in the program and rerun the program or loo# for Qun#s in
the source file for these t"o fields using FI'+ 1I-% I7S,7& !he other approach "ill
$e loo# into data division map in the compilation listing
0S?uB:e $>eB;B:67 ;@9 B;se $e<.!>s=A;:e8e@t
+s8EAB !;t; !;t; !eC
*>@eI! !;t; #;8e *?:;t?B BAF StBu:tuBe
!eC>@>t>?@ !;t; T7=e +ttB>Eutes
& PROGR+M.I! S+#SOFT.........................................................*
, 1 -S.V+RI+B*ES' ' ' ' ' ' B*-=00000 000 !S 0C*42 GB?u=
0 & -S.EMP.#+ME ' ' ' ' ' B*-=00000 000 0 000 000 !S 10C !>s=A;7
10 & -S.EMP.+GE' ' ' ' ' ' B*-=00000 00+ 0 000 00+ !S &C !>s=.#u8
11 & -S.EMP.CIT ' ' ' ' ' B*-=00000 00C 0 000 00C !S 10C !>s=A;7
1& & -S.EMP.S+*' ' ' ' ' ' B*-=00000 012 0 000 012 !S ,C !>s=.#u8
13 & -S.EMP.BO#"S' ' ' ' ' B*-=00000 01E 0 000 01E !S ,C !>s=.#u8
14 & -S.EMP.CTC' ' ' ' ' ' B*-=00000 0&2 0 000 0&2 !S ,C !>s=.#u8
0S-+MP-S1' is in 2'0-> offset 1M "hereas 0S-+MP-2/76S in offset >1+
In the dump8 loo# for "or#ing-storage dump 2'0-> maps to (IOJO>2J
address
-ORKI#G.STOR+GE C?B S+#SOFT
B*-.04 &50,00B,
3000000 &50,00B, !4E4E3C, E4404040 4040F&F0 E3!0C0C3
C,E,4040 4040F0F0 F0F2F0F0 F0C00000
GM"T$" &0TRIC$ 0002000'''G
30000&0 &50,00!, 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
G''''''''''''''''''''''''''''''''G
B*-.04 &50,00B,
3000000 &50,00B, !4E4E3C, E4404040 4040F&F0 E3!0C0C3 C,E,4040 4040F0F0 F0F2F0F0 F0C00000 GM"T$" &0TRIC$ 0002000'''G
30000&0 &50,00!, 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 G''''''''''''''''''''''''''''''''G


Mainframe Refresher Part-1 Page:43

0S-+MP-71M+ is 1> $ytes starting at > - <-K+K+=&J+KK>K>K>K>K>; "hich is
nothing $ut <M6!.6 < 0S-+MP-1B+ is ( $ytes starting at 1>
th
$yte "hich is <(O;
(<F(FO;) Similarly read the contents of 0S-+MP-&I!,8 0S-+MP-S1'8 0+-+MP-2/76S
and 0S-+MP-&!&
0S-+MP-2/76S contains lo"-values It is a computational field and so it is
e5pected to have sign in the last ni$$le "hereas it doesnot as it is not properly
initialised in the program
In the dump8 in every line there "ill $e t"enty $ytes he5a decimal content "ill
$e follo"ed $y character content -ue to the column limit8 I have the one line dump
in three lines
So if there are million records in a file and during the processing it a$ended
after <n; num$er of records8 to identify the record caused pro$lem8 read the dump for
the file section uni3ue varia$le(s) values and loo# for the respective record in the file
and analyse%correct%delete
0e have ta#en offset directly from sysout If it is not availa$le8 then refer the
PS0 2ased on 1M/-+ (K%=18 the last (K%=1 $its contain the ne5t se3uential
instruction to $e e5ecuted From this value8 su$tract the entry point of the program
$eing a$ended and that "ill give you offset /ne instruction a$ove this offset is the
one that caused the a$end +ntry point of all the programs e5ecuted $e found in
trace $ac# or save trace section of the dump ,ou can directly found the offset in the
trace$ac# also (last =1 $its of 1IO>11J> is (IO>11J>8 (IO>11J>-(IO>>+1> C =I>
is the offset8 from the compilation listing one instruction Qust $efore =I> is =M1)
PS-''''' 05,!1000 A!01180
TB;:eE;:F4

!S+ +99B PB?HB;8 "@>t P" +99B P" OCCset E@tB7 E +99B E OCCset
0001!1&0 CEE$!SP 0/55,0F0 300003C34 CEE$!SP 0/55,0F0 300003C34
0001!01, S+#SOFT &5000E10 +0000036A S+#SOFT 2!00E10 30000032+
St;te8e@t *?;9 M?9 SeBI>:e St;tus
CEEP*PK+ "K0012/ C;AA
S+#SOFT E<:e=t>?@

Su$mission of Po$ from &/2/' Program
0rite the Po$ statements to a output file and route the file to I7!R-R instead
of cataloguing I7!R-R-Internal Reader
P/2: %%S!+P1 +4+& PBMCM1I7PBM
%%--1 -- -S7CM6!.6!+S!8-ISPCS.R
%%P&'-- -- S,S/6!C(?8I7!R-R)
PR/BR1M:M1I7PBM
S+'+&! P&'FI'+ 1SSIB7 !/ P&'--Z (+nvironment -ivision)
F- P&'FI'+
>1 P&'-R+& PI& 4(J>) (File Section)
/P+7 /6!P6! P&'FI'+ (/pen in output and "rite P&' statements)
M/:+ Y%%!+S!P/2 P/2 1111Y !/ P&'-R+&

Mainframe Refresher Part-1 Page:44

M/:+ Y%%S!+P>1 +4+& PBMCI+F2R1KY !/ P&'- R+&
&'/S+ P&'FI'+ (!+S!P/2 "ill $e su$mitted automatically)
Su$mission of Po$ from &I&S Program
P&' can $e su$mitted from &I&S $y SP//' /P+78 SP//' 0RI!+ and SP//'
&'/S+ commands !his needs SP//'C,+S entry in SI! ta$le Refer &I&S section for
more details
Storage Management Su$system
It is optional feature of the operating system that manages user datasets !he
SMS parameters apply only to the ne" datasets and the system ignores for e5isting
datasets8 --? or -- -1!1 datasets8 P/2&1! and P/2'I2 -- statements8 and
S,S/6! datasets
!he follo"ing data classes esta$lish various default values for catalogued
datasets 1n administrator assigns a name to each group of default values8 and then
you reference this name on your -- statements to use the values
S!/R&'1S N -efines 67I! and :/' parameters
-1!1&'1S - -efines R+&FM8 'R+&'8 1:BR+&8 SP1&+8 R+!P-%+4!P-8 -S7!,P+8
*+,'+78 R+&/RB8 *+,/FFetc
MBM!&'1S N Migration8 $ac#up8 releasing unused space in a dataset
If you "ant to override any one of the values of default8 you can do that
%%P-S -- -S7C2PM1I7M6!.6S/6R&+8-ISPC(7+08&1!'B)8
%% S!/R&'1SC-1S-/7+8SP1&+C(8(88A>))8-1!1&'1SC&/2(
/verrides the directory space defined for &/2( data class

P&' for S1R-I7-21!&.
!he production Po$ logs are usually routed to one of the third party products
S1R is one such product !he other products are &1-:I+0 and :I+0--IR+&!
!he follo"ing P&' is used to 3uery the S1R in $atch
//*O+!*OG EXEC PGM=S+RBC$
//STEP*IB !! !S#=SSP'C+I'C+I*IB%!ISP=S$R
//SSPRI#T !! SSO"T=*
//REPORT !! !S#=CORP'!BS&KT'JOBRPT%!ISP=MO!
//*O+!!! !! !S#=CORP'!BS&KT' *O+!*OG%!ISP=O*!
//SSI# !! !S#=CORP'!BS&KT'"TI*S(CCC+R!-)%!ISP=S$R
!o load the complete log (P/2 PR/-2*6P of generation KOK1) into a dataset
named as '/1---8 use the follo"ing card:
%'/1- --71M+C'/1--- I-CPR/-2*6P B+7CKOK1
!o get run-date8 run-time8 return code and generation of all the prior runs of
a Qo$8 use the follo"ing card !he result "ill $e stored in the dataset named as
R+P/R!
%'IS! I-CP/271M+

Mainframe Refresher Part-1 Page:45

P&' for &1I-I7-21!&.
&1I is a scheduler product 0e $rief a$out the product in the ne5t section
!his P&' is used to 3uery &1I in $atch
%%6&&II2!I PR/& I-C>8P//'CY1-JY8-S7PF4C8/P!C8PBCS1SS2S!R
%%2!+RM +4+& PBMCS11S2S!R8
%% P1RMCY>8P//'C(1-J) Y
%%S!+P'I2 -- -ISPCS.R8-S7C&1I&1I'/1-'I2
%%6&&I&M-S -- -ISPCS.R8-S7C&1I&1I&/MM-S
%%S,SPRI7! -- S,S/6!C?8-&2C2'*SIU+C1==
%%+RR/RS -- S,S/6!C?8-&2C2'*SIU+C1==
%%S,S6-6MP -- S,S/6!C?
%%S,SI7 --?
&ode the &1I commands
%?
P&' F/R 4-&-I7-21!&.
!here may $e a need to read the run details of a Qo$ log inside the R+44
!his can $e done using the /6!P6! command of !S/ !he follo"ing P&' captures the
complete log information of the Qo$ &+771+F- "ith I- P/2>J>IO into
!ISPM6!.6(!+S!1)
%%R67!S/ +4+& PBMCI*P+F!>1
%%S,S!SPR! -- S,S/6!C?
%%S,S!SI7 -- ?
/6!P6! &+771+F-(P/2>J>IO) PRI7!(Y!ISPM6!.6(!+S!1)Y)
%?
%%?

Mainframe Refresher Part-1 Page:46

&ommon 2usiness /riented 'anguage
&/2/'

Mainframe Refresher Part-1 Page:47

&/2/' (COmmon %usiness Oriented Language)
.istory
-eveloped in 1OAO $y a group called &/nference on -1ta Systems 'anguage
(&/-1S,') First &/2/' compiler "as released in 1OM>
First 17SI approved version N 1OMJ
Modified 17SI approved version N 1OIK (/S%:S &/2/')
Modified 17SI approved version N 1OJA (:S &/2/' ()
!his $oo# is "ritten $ased on I2M &/2/' for /S%=O> :(R(
Speciality
1 First language developed for commercial application development8 "hich can
efficiently handle millions of data
( Procedure /riented 'anguage - Pro$lem is segmented into several tas#s
+ach tas# is "ritten as a Paragraph in Procedure -ivision and e5ecuted in a
logical se3uence as mentioned
= +nglish 'i#e language N +asy to learn8 code and maintain
&oding Sheet
1 I 1( I( J>
&/'-1 &/'6M7-2
1M Se3uence num$er N Should $e in se3uence $ut need not $e consecutive-
6sually (1-=) columns identify page num$er and (K-M) columns identify line
num$er
I &ontinuity (-)8 &omment (?)8 Starting a ne" page (%) and -e$ugging lines (-)
J-11 &olumn 1 N-ivision8 Section8 Paragraph8 >18 II declarations must $egin here
1(I( &olumn 2 N1ll the other declarations%statements must $egin here
I=-J> Identification field It "ill $e ignored $y the compiler $ut visi$le in the source
listing
'anguage Structure
&haracter -igits (>-O)8 1lpha$ets (1-U)8 Space ($)8
Special &haracters (L - ? % ( ) C H @ [ G F 8)
0ord /ne or more characters - 6ser defined or Reserved
&lause /ne or more "ords It specifies an attri$ute for an entry
Statement /ne or more valid "ords and clauses
Sentence /ne or more statements terminated $y a period
Paragraph /ne or more sentences

Mainframe Refresher Part-1 Page:48

Section /ne or more paragraphs
-ivision /ne or more sections or paragraphs
Program Made up of four divisions
-ivisions in &/2/'
!here are four divisions in a &/2/' program and the data division is an optional one
1Identification -ivision
(+nvironment -ivision
=-ata -ivision
KProcedure -ivision
Identification -ivision
!his is the first division and the program is identified here Paragraph PR/BR1M-I-
follo"ed $y user-defined name is mandatory !hough => characters can $e entered
for the program I-8 compiler "ill consider only the first +IB.! characters and the
remaining characters "ill $e ignored 1ll other paragraphs are optional and used for
documentation
I-+7!IFI&1!I/7 -I:ISI/7
PR/BR1M-I- PR/BR1M 71M+
16!./R &/MM+7! +7!R,
I7S!1''1!I/7 &/MM+7! +7!R,
-1!+-0RI!!+7 &/MM+7! +7!R,
-1!+-&/MPI'+- &/MM+7! +7!R,
S+&6RI!, &/MM+7! +7!R,
Security does not pertain to the operating system security8 $ut the
information that is passed to the user of the program a$out the security features of
the program
+nvironment -ivision
!his is the only machine dependant division of &/2/' program It supplies
information a$out the hard"are or computer e3uipment to $e used on the program
0hen a program is moved from one computer to another computer8 the only section
that may need to $e changed is +7:IR/7M+7! division
&onfiguration Section
It supplies information a$out the computer on "hich the program "ill $e compiled
(S/6R&+-&/MP6!+R) and e5ecuted (/2P+&!-&/MP6!+R) It consists of three
paragraphs N S/6R&+ &/MP6!+R8 /2P+&!-&/MP6!+R and SP+&I1'-71M+S
!his is /P!I/71' section from &/2/' JA
S/6R&+-&/MP6!+R I2M-K=J1 (&omputer and model D supplied $y manufacturer)
0I!. -+26BBI7B M/-+ clause specifies that the de$ugging lines
in the program (statements coded "ith <-; in column I) should also $e compiled and
included in load module
/2P+&!-&/MP6!+R I2M-K=J1 (6sually same as source computer)

Mainframe Refresher Part-1 Page:49

SP+&I1'-71M+S !his paragraph is used to relate hard"are names to user-specified
mnemonic names
1 Su$stitute character for currency sign (&6RR+7&, SIB7 IS litearal-1)
( &omma can $e used as decimal point (-+&IM1'-P/I7! IS &/MM1)
= -efault collating se3uence can $e changed It "ill $e e5plained later
K 7e" class can $e defined using &'1SS #ey"ord (&'1SS DI1I is [>\ thru [O\)

Input-/utput Section
It contains information regarding the files to $e used in the program and
consists of t"o paragraphs FI'+-&/7!R/' 9 I-/ &/7!R/'
FI'+ &/7!R/' Files used in the program are identified in this paragraph
I-/ &/7!R/' It specifies "hen chec# points to $e ta#en and storage areas that are
shared $y different files
-ata -ivision
-ata division is used to define the data that need to $e accessed $y the program
It has three sections
FI'+ S+&!I/7 descri$es the record structure of the files
0/R*I7B-S!/R1B+ S+&!I/7 is used to for define intermediate varia$les
'I7*1B+ S+&!I/7 is used to access the e5ternal data
+5: -ata passed from other programs or from
P1RM of P&'
'iterals8 &onstants8 Identifier8
1 'iteral is a constant and it can $e numeric or non-numeric
( 7umeric literal can hold 1J digits and non-numeric literal can hold 1M> characters
in it (&/2/'IK supports 1(> characters only)
= 'iteral stored in a named memory location is called as varia$le or identifier
K Figurative &onstant is a &/2/' reserved "ord representing fre3uently used
constants !hey are U+R/%U+R/S%U+R/+S8 V6/!+%V6/!+S8 SP1&+%SP1&+S8
1''8 .IB.-:1'6+%.IB.-:1'6+S8 '/0-:1'6+%'/0-:1'6+S
+5ample: >1 0S-71M+ PI& 4(>K) :1'6+ <-+:I;
In this declaration <-+:I; is non-numeric literal and 0S-71M+ is an identifier or a
varia$le
-eclaration of varia$le

'evelD H :aria$le H Picture clause H 6sage &lause H Sync clause H :alue clause
FI''+R
'evelD
It specifies the hierarchy of data "ithin a record It can ta#e a value from the
set of integers $et"een >1-KO or from one of the special level-num$ers MM II JJ
>1 level Specifies the record itself It may $e either a group item or an
+lementary item It must $egin in 1rea 1
>(-KO levels Specify group or elementary items "ithin a record Broup level items
must not have picture clause

Mainframe Refresher Part-1 Page:50

MM level Identify the items that contain the R+71M+S clause
II level Identify independent data item
JJ level &ondition names
:aria$le name and Vualifier
:aria$le name can have 1-=> characters "ith at least one alpha$et in it
.yphen is the only allo"ed special character $ut it cannot $e first or last letter of the
name 7ame should $e uni3ue "ithin the record If t"o varia$les "ith same name
are there8 then use /F 3ualifier of high level grouping to refer a varia$le uni3uely
+5: M/:+ $alance $F record-1 !/ $alance $F record-(
FI''+R
0hen the program is not intended to use selected fields in a record structure8 define
them as FI''+R FI''+R items cannot $e initiali)ed or used in any operation of the
procedure division
PI&!6R+ &lause
-escri$es the attri$utes of varia$le
7umeric O (-igit)8 : (Implied decimal point)8 S (Sign)8 P(1ssumed
decimal point "hen the point lies outside the data item)
7umeric +dited L (Plus Sign)8 - (Minus Sign)8 &R -2 (&redit -e$it Sign)
(Period)8 $ (2lan#)8 <8;(comma)8 > (Uero)8 % (Slash)
2'17* 0.+7 U+R/ (Insert $lan# "hen data value is >)8
U (U+R/ suppression)8 ? (1S!+RIS*)8 H(&urrency Sign)
7on 7umeric 1 (alpha$et)8 2 (2lan# insertion &haracter)8 4(1lpha numeric)8
B(-2&S)
+5clusive sets 1 L - &R -2
( : <;
= H L - U ? (2ut H &an appear as first place and ? as
floating H?????)
-2&S (-ou$le 2yte &haracter Set) is used in the applications that support large
character sets 1M $its are used for one character +5: Papanese language
applications
:1'6+ &lause
It is used for initiali)ing data items in the "or#ing storage section :alue of item
must not e5ceed picture si)e It cannot $e specified for the items "hose si)e is
varia$le
Synta5: :1'6+ IS literal
:1'6+S 1R+ literal-1 !.R6 T !.R/6B. literal-(
:1'6+S 1R+ literal-18 literal-(
'iteral can $e numeric "ithout 3uotes /R non-numeric "ithin 3uotes /R figurative
constant
SIB7 &lause
Synta5 SIB7 IS ('+1-I7B) S+P1R1!+ &.1R1&!+R (!R1I'I7B)
It is applica$le "hen the picture string contain <S; -efault is !R1I'I7B 0I!. 7/
S+P1R1!+ &.1R1&!+R So <S; doesn;t ta#e any space It is stored along "ith last
digit

Mainframe Refresher Part-1 Page:51

L1C1 L(C2 L=C& LKC- LAC+ LMCF LICB LJC. LOCI
->CX8 -1C P8 -(C *8 -=C'8 -KCM8 -AC78 -MC/8 -ICP8 -JCV8 -OCR
7um$er !R1I'I7B SIB7
(-efault)
'+1-I7B SIB7 '+1-I7B
S+P1R1!+
-1(A 1(7 P(A -1(A
L1(A 1(+ 1(A L1(A

Mainframe Refresher Part-1 Page:52

Refreshing 2asics
7i$$le >K 2its is one ni$$le In pac#ed decimal8 each ni$$le stores one digit
2yte >J 2its is one $yte 2y default8 every character is stored in one $yte
.alf "ord 1M 2its or ( $ytes is one half "ord (M:S)
Full "ord =( 2its or K $ytes is one full "ord (M:S)
-ou$le "ord MK 2its or J $ytes is one dou$le "ord (M:S)
6sage &lause
-ISP'1, -efault 7um$er of $ytes re3uired e3uals to the si)e of the data item
&/MP 2inary representation of data item
PI& clause can contain S and O only
SO(>1) N SO(>K) .alf "ord
SO(>A) N SO(>O) Full "ord
SO(1>) - SO(1J) -ou$le "ord
Most significant $it is /7 if the num$er is negative
&/MP-1: Single "ord floating point item PI& &lause should not $e specified
!he sign is contained in the first $it of the of the leftmost $yte and the
e5ponent is contained in the remaining I $its of the first $yte !he last
= $ytes contain the mantissa
&/MP-(: -ou$le "ord floating-point item PI& &lause should not $e specified
I $ytes are used for mantissa and hence used for high precision
calculation
&/MP-=: Pac#ed -ecimal representation /ne digit ta#es half $yte
PI& O (7) comp-= data item "ould re3uire (7 L 1)%( $ytes !he sign is
stored separately in the rightmost half-$yte regardless of "hether S is
specified in the PI&!6R+ or not
& N Signed Positive - N Signed 7egative F-6nsigned Positive
I7-+4 It is used for preserve the inde5 value of an array It ta#es K $ytes
PI& &lause should not $e specified 0hen the clause is specified for a
group item8 it applies to all elementary items contained in it .o"ever8
the group itself is not an inde5 data item
P/I7!+R K 2yte elementary item that can $e used to accomplish limited $ase
addressing It can $e used only in N S+! statement8 Relation condition8
6SI7B phrase of a &1'' statement8 an +7!R, statement or the
procedure division statement 1 value clause for a pointer data item
can contain only 76'' or 76''S
S+! identifier-1 !/ address of identifier-(
S+! 1--R+SS /F identifier-( !/ identifier-1
Identifier-1 is P/I7!+R data item and identifier-( is lin#age section
item

Mainframe Refresher Part-1 Page:53

S,7& &lause and Slac# 2ytes
S,7& clause is specified "ith &/MP8 &/MP-1 and &/MP-( items !hese items are
e5pected to start at half%full%dou$le "ord $oundaries for faster address resolution
S,7& clause does this $ut it may introduce slac# $ytes (unused $ytes) $efore the
$inary item
&onsider the follo"ing declaration in the 0/R*I7B-S!/R1B+ S+&!I/7:
>1 M,--1!1
>A -1!1-/7+ PI& 4(M)
>A -1!1-!0/ PI& O(M) &/MP S,7&
>A -1!1-!.R++ PI& SO(K):OO &/MP-=
!he Starting address of Full-"ord should end "ith >8K8J or & and that of half-"ord
should end "ith >8(8K8M8J818&8+ If -1!1-/7+ starts at >8 it "ill occupy >-A $ytes in
memory -1!1-!0/ - a sync item of full "ord cannot start at M So $y S,7& rule8 it
starts at J
th
position M
th
9 I
th
$ytes are unused So M,--1!1 occupies 1M $ytes
R+-+FI7+S
!he R+-+FI7+S clause allo"s you to use different data description entries to
descri$e the same computer storage area Redefining declaration should immediately
follo" the redefined item and should $e done at the same level Multiple redefinitions
are possi$le Si)e of redefined and redefining need not $e the same It cannot $e
done at MM and JJ levels
+5ample:
>1 0S--1!+ PI& O(>M)
>1 0S-R+-+F--1!+ R+-+FI7+S 0S--1!+
>A 0S-,+1R PI& O(>()
>A 0S-M/7 PI& O(>()
>A 0S--1, PI& O(>()
R+71M+S
It is used for regrouping of elementary data items in a record It should $e declared
at MM level It need not immediately follo"s the data item8 "hich is $eing renamed
2ut all R+71M+S entries associated "ith one logical record must immediately follo"
that recordYs last data description entry R+71M+S cannot $e done for a >18 II8 JJ
or another MM entry It cannot $e done for occurrences of an array
>1 0S-R+PS/7S+
>A 0S-&.1R1K= PI& 4(>=)
>A 0S-&.1RK PI& 4(>K)
MM 1---R+PS/7S+ R+71M+S 0S-&.1R1K=
&/7-I!I/7 name
It is identified "ith special level <JJ; 1 condition name specifies the value that a field
can contain and used as a$$reviation in condition chec#ing
>1 S+4 PI& 4
JJ M1'+ :1'6+ <1;
JJ F+M1'+ :1'6+ <(; <=;
IF S+4C1 can also $e verified as IF M1'+ in Procedure division
<S+! F+M1'+ !/ !R6+ < moves value ( to S+4 If multiple values are coded on
:1'6+ clause8 the first value "ill $e moved "hen it is set to true

Mainframe Refresher Part-1 Page:54

P6S!IFI+- RIB.!
!his clause can $e specified "ith alphanumeric and alpha$etic items for right
Qustification It cannot $e used "ith MM and JJ level items
/&&6RS &lause
/&&6RS &lause is used to allocate physically contiguous memory locations to
store the ta$le values and access them "ith su$script or inde5 -etail e5planation is
given in !a$le .andling section
'I7*1B+ S+&!I/7
It is used to access the data that are e5ternal to the program P&' can send
ma5imum 1>> characters to a program thru P1RM 'in#age section M6S! $e coded
"ith a half "ord $inary field8 prior to actual field If length field is not coded8 the first
t"o $ytes of the field coded in the lin#age section "ill $e filled "ith length and so
there "ill $e last ( $ytes data truncation in the actual field
>1 '*--1!1
>A '*-'+7B!. PI& SO(>K) &/MP
>A '*-:1RI12'+ PI& 4(>J)
'I7*1B+ section of su$-programs "ill $e e5plained later

Mainframe Refresher Part-1 Page:55

Procedure -ivision
!his is the last division and $usiness logic is coded here It has user-defined sections
and paragraphs Section name should $e uni3ue "ithin the program and paragraph
name should $e uni3ue "ithin the section
Procedure division statements are $roadly classified into follo"ing categories
Statement !ype Meaning
Imperative -irect the program to ta#e a specific action
+5: M/:+ 1-- +4I! B/ !/
&onditional -ecide the truth or false of relational condition and $ased on
it8 e5ecute different paths
+5: IF8 +:1'61!+
&ompiler -irective -irects the compiler to ta#e specific action during compilation
+5: &/P, S*IP +P+&!
+5plicit Scope
terminator
!erminate the scope of conditional and imperative statements
+5: +7--1-- +7--IF +7--+:1'61!+
Implicit Scope
terminator
!he period at the end of any sentence8 terminates the scope of
all previous statements not yet terminated
M/:+ Statement
It is used to transfer data $et"een internal storage areas defined in either file section
or "or#ing storage section
Synta5:
M/:+ identifier1%literal1%figurative-constant !/ identifier( (identifier=)
Multiple move statements can $e separated using comma8 semicolons8 $lan#s or the
#ey"ord !.+7
Numeric mo2e rules:
1 numeric or numeric-edited item receives data in such a "ay that the
decimal point is aligned first and then filling of the receiving field ta#es place
6nfilled positions are filled "ith )ero Uero suppression or insertion of editing
sym$ols ta#es places according to the rules of editing pictures
If the receiving field "idth is smaller than sending field then e5cess digits8 to
the left and%or to the right of the decimal point are truncated
Al3.anumeric Mo2e %ules:
1lpha$etic8 alphanumeric or alphanumeric-edited data field receives the data
from left to right 1ny unfilled field of the receiving filed is filled "ith spaces
0hen the length of receiving field is shorter than that of sending field8 then
receiving field accepts characters from left to right until it is filled !he
unaccomodated characters on the right of the sending field are truncated
0hen an alphanumeric field is moved to a numeric or numeric-edited field8
the item is moved as if it "ere in an unsigned numeric integer mode
&/RR+SP/7-I7B can $e used to transfer data $et"een items of the same
names $elonging to different group-items $y specifying the names of group-items to
"hich they $elong

Mainframe Refresher Part-1 Page:56

M/:+ &/RR+SP/7-I7B group-1 !/ group-(
1rou3 Mo2e rule
0hen M/:+ statement is used to move information at group level8 the
movement of data ta#es place as if $oth sending and receiving fields are specified as
alphanumeric items !his is regardless of the description of the elementary items
constituting the group item
Samples for understanding M/:+ statement (M/:+ 1 !/ 2)

Picture of 1 :alue of 1 Picture of 2 :alue of 2 after
Move
PI& OO:OO 1(=A PI& OOO:OO >1(=A
PI& OO:OO 1(=A PI& OOOO:OOOO >>1(=A>>
PI& OO:OOO 1(=KA PI& O:OO (=K
PI&O(>A):O(>=) AK=(1AK= PI& O(>=):O(>=) =(1AK=
PI& O(>K):O(>() (=(K PI& UUUOOO (=(
PI& OO:OO >>=K PI& HHHOO H=K
PI& 4(>K) M6S1 424242 M 6 S
1RI!.M+!I& :+R2S
1ll the possi$le arithmetic operations in &/2/' using 1--8 S62!R1&!8
M6'!IP', and -I:I-+ are given $elo":
1rithmetic /peration 1 2 & -
1-- 1 !/ 2 1 1L2
1-- 1 2 & !/ - 1 2 & 1L2L&L-
1-- 1 2 & BI:I7B - 1 2 & 1L2L&
1-- 1 !/ 2 & 1 1L2 1L&
S62!R1&! 1 FR/M 2 1 2-1
S62!R1&! 1 2 FR/M
&
1 2 &-(1L2)
S62!R1&! 1 2 FR/M
& BI:I7B -
1 2 & &-(1L2)
M6'!IP', 1 2, 2 1 1?2
M6'!IP', 1 2, 2
BI:I7B &
1 2 1?2
-I:I-+ 1 I7!/ 2 1 2%1
-I:I-+ 1 I7!/ 2
BI:I7B &
1 2 2%1
-I:I-+ 1 2, 2
BI:I7B &
1 2 1%2
-I:I-+ 1 I7!/ 2
BI:I7B &
R+M1I7-+R -
1 2 Integer (2%1) Integer
remainder
BI:I7B is used in the follo"ing cases:
1!o retain the values of operands participating in the operation

Mainframe Refresher Part-1 Page:57

(!he resultant value of operation e5ceeds any of the operand si)e
R/67-+- option
0ith R/67-+- option8 the computer "ill al"ays round the result to the
PI&!6R+ clause specification of the receiving field It is usually coded after the field
to $e rounded It is prefi5ed "ith R+M1I7-+R #ey"ord /7', in -I:I-+ operation
1-- 1 2 BI:I7B & R/67-+-
-I:I-+R/67-+- R+M1I7-+R
&aution: -on;t use for intermediate computation
/7 SIU+ +RR/R
If 1C(> (PI& O(>()) and 2CO> (PI& O(>())8 1-- 1 !/ 2 "ill result 1> in 2
"here the e5pected value in 2 is 11> /7 SIU+ +RR/R clause is coded to trap such
si)e errors in arithmetic operation
If this is coded "ith arithmetic statement8 any operation that ended "ith SIU+
error "ill not $e carried out $ut the statement follo"s /7 SIU+ +RR/R "ill $e
e5ecuted
1-- 1 !/ 2 /7 SIU+ +RR/R -ISP'1, <+RR/R^;
&/MP6!+
&/MP6!+ statement assigns the value of an arithmetic operation (on the right
hand side) to a data item (on the left hand side)
Rule: 'eft to right N 1Parentheses (<(< <);)
(+5ponentiation (??)
=Multiplication and -ivision (? and %)
K1ddition and Su$traction (L and -)
&aution: 0hen R/67-+- is coded "ith &/MP6!+8 some compiler "ill do rounding
for every arithmetic operation and so the final result "ould not $e precise
1ll arithmetic operators have their o"n e5plicit scope terminators (+7--1--8
+7--S62!R1&!8 +7--M6'!IP',8 +7---I:I-+8 +7--&/MP6!+) It is suggested to use
them
&/RR+SP/7-I7B is availa$le for 1-- and S62!R1&! only
I7I!I1'IU+
:1'6+ clause is used to initiali)e the data items in the "or#ing storage
section "hereas I7I!I1'IU+ is used to initiali)e the data items in the procedure
division
I7I!I1'IU+ sets the alpha$etic8 alphanumeric and alphanumeric-edited items
to SP1&+S and numeric and numeric-edited items to U+R/ !his can $e overridden
$y R+P'1&I7B option of I7I!I1'IU+ FI''+R8 /&&6RS -+P+7-I7B /7 items are not
affected
Synta5: I7I!I1'IU+ identifier-1
R+P'1&I7B (1'P.12+!I&%1'P.176M+RI&%1'P.1-76M+RI&-+-I!+-
76M+RI&%76M+RI&-+-I!+-)
-1!1 2, (identifier-( %'iteral-()
+5ample: >1 1

Mainframe Refresher Part-1 Page:58

>A 11 PI& O(A)
>A 1( PI& 4(K)
I7I!I1'IU+ 1 R+P'1&I7B 76M+RI& -1!1 2, A> "ill initiali)e only 11 $y A>
1&&+P!
1&&+P! can transfer data from input device or system information contain in
the reserved data items li#e -1!+8 !IM+8 -1,
1&&+P! 0S-:1R1 (FR/M -1!+%!IM+%-1,%/!.+R S,S!+M :1RS)
If FR/M &lause is not coded8 then the data is read from terminal 1t the time
of e5ecution8 $atch program "ill 12+7- if there is no in-stream data from P&' and
there is no FR/M clause in the 1&&+P! clause
-1!+ option returns si5 digit current date in ,,MM--
-1, returns A digit current date in ,,---
!IM+ returns J digit R67 !IM+ in ..MMSS!!
-1,-/F-0++* returns single digit "hose value can $e 1-I (Monday-Sunday
respectively)
-ISP'1,
It is used to display data 2y default display messages are routed to S,S/6!
Synta5: -ISP'1, identifier1T literal1 (6P/7 mnemonic name)
S!/P R678 +4I! PR/BR1M 9 B/ 21&*
S!/P R67 is the last e5ecuta$le statement of the main program It returns
control $ac# to /S
+4I! PR/BR1M is the last e5ecuta$le statement of su$-program It returns
control $ac# to main program
B/21&* can $e coded in main program as "ell as su$-program as the last
statement It Qust gives the control $ac# from "here it received the control
1'!+R statement
!he alter statement is used to modify the targets of B/ !/ statements
"ritten else"here in the procedure division
1'!+R PR/&+-6R+-71M+-1 !/ RPR/&++- !/S PR/&+-6R+-71M+-(
RPR/&+-6R+-71M+-= !/ WPR/&++- !/X PR/&+-6R+-71M+-K S
+ach of the PR/&+-6R+-71M+-18 PR/&+-6R+-71M+-= is the name of the
paragraph that contains only one sentence !his sentence must consist of a single
B/ !/ statement "ithout the depending clause
-uring the e5ecution each of the PR/&+-6R+-71M+-18 PR/&+-6R+-71M+-=8
"ill $e replaced $y PR/&+-6R+-71M+-(8 PR/&+-6R+-71M+-K respectively
&ollating Se3uence
!here are t"o famous &ollating Se3uence availa$le in computers I2M and
I2M &ompati$le machine use +2&-I& collating se3uence "hereas most micro and
many mainframe systems use 1S&II collating se3uence !he result of arithmetic and
alpha$etic comparison "ould $e same in $oth collating se3uences "hereas the same
is not true for alphanumeric comparison
+2&-I& (1scending /rder) 1S&II (1scending /rder)

Mainframe Refresher Part-1 Page:59

Special &haracters Special &haracters
a-) >-O
1-U 1-U
>-O a-)
-efault collating se3uence can $e overridden $y an entry in /2P+&!-&/MP6!+R and
SP+&I1' 71M+S paragraphs
1 &ode the PR/BR1M &/''1!I7B S+V6+7&+ &lause in the /$Qect computer
paragraph PR/BR1M &/''1!I7B S+V6+7&+ IS alpha$et-name
( Map the alpha$et-name in the SP+&I1'-71M+S paragraph as follo"s:
1'P.12+! alpha$et-name is S!17-1R--1 T 71!I:+
71!I:+ stands for computer;s o"n collating se3uence "hereas S!17-1R--1 stands
for 1S&II collating se3uence
IF%!.+7%+'S+%+7--IF
!he most famous decision ma#ing statement in all language is <IF; !he synta5
of IF statement is given $elo": IF can $e coded "ithout any +'S+ statement !.+7
is a noise "ord and it is optional
If /Rs 9 17-s are used in the same sentence8 17-s are evaluated first from
left to right8 follo"ed $y /Rs !his rule can $e overridden $y using parentheses
!he permitted relation conditions are C8 F8 G8 FC8 GC8 FG
&/7!I76+ is no operation statement !he control is Qust passed to ne5t
S!1!+M+7! 7+4! S+7!+7&+ passes the control to the ne5t S+7!+7&+ Referring to
first page8 Sentence is defined as statement(s) ended "ith full-stop
It is advised to use +7--IF8 e5plicit scope terminator for the IF statements
than period8 implicit scope terminator
IF condition1 17- condition( !.+7
Statement-2loc#-1
+'S+
IF condition= !.+7
&/7!I76+
+'S+
IF conditionK !.+7
Statement-2loc#-(
+'S+
7+4! S+7!+7&+
+7--IF
+7--IF
+7--IF
Statement-2loc#-( "ill $e e5ecuted only "hen condition 18 ( and K are !R6+
and condition = is F1'S+
Implied operand: In compound conditions8 it is not al"ays necessary to
specify $oth operands for each condition IF !/!1'CI or J is accepta$le .ere
!/!1'CJ is implied operation
SIB7 test and &'1SS test
SIB7 test is used to chec# the sign of a data item It can $e done as follo"s N

Mainframe Refresher Part-1 Page:60

IF identifier is P/SI!I:+%7+B1!I:+%U+R/
&'1SS test is used to chec# the content of data item against pre-defined range of
values It can $e done as follo"s -
IF identifier is 76M+RI&%1'P.12+!I&%1'P.12+!I&-.IB.+R%
1'P.12+!I&-'/0+R
0e can define our o"n classes in the special names paragraph 0e have defined a
class -IBI! in our special names paragraph It can $e used in the follo"ing "ay
IF identifier is -IBI!
7egated conditions
1ny simple8 relational8 class8 sign test can $e negated using 7/!
2ut it is not al"ays true that 7/! 7+B1!I:+ is e3ual to P/SI!I:+ (+5ample U+R/)
+:1'61!+
0ith &/2/'JA8 "e use the +:1'61!+ ver$ to implement the case structure of
other languages Multiple IF statements can $e efficiently and effectively replaced
"ith +:1'61!+ statement 1fter the e5ecution of one of the "hen clauses8 the
control automatically comes to the statement follo"ing +7--+:1'61!+ 1ny comple5
condition can $e given in the 0.+7 clause 2rea# statement is not needed8 as it is so
in other languages
1eneral S/ntaA
+:1'61!+ su$Qect-1 (1'S/ su$Qect()
0.+7 o$Qect-1 (1'S/ o$Qect()
0.+7 o$Qect-= (1'S/ o$QectK)
0.+7 /!.+R imperative statement
+7--+:1'61!+
17um$er of Su$Qects in +:1'61!+ clause should $e e3ual to num$er of
o$Qects in every 0.+7 clause
(Su$Qect can $e varia$le8 e5pression or the #ey"ord !R6+% F'1S+ and
respectively o$Qects can $e values8 !R6+%F1'S+ or any condition
=If none of the 0.+7 condition is satisfied8 then 0.+7 /!.+R path "ill $e
e5ecuted
Sam3le
+:1'61!+ SV'&/-+ 1'S/ !R6+
0.+7 1>> 1'S/ 1C2
0.+7 -=>A 1'S/ (1%&CK)
-ISP'1, <1''/0+- SV'&/-+PR/&++-I7B;
0.+7 /!.+R imperative statement
+7--+:1'61!+
In the a$ove e5ample8 display "ill $e thro"n "hen one of the first t"o 0.+7 clauses
are true

Mainframe Refresher Part-1 Page:61

P+RF/RM S!1!+M+7!S
P+RF/RM "ill $e useful "hen you "ant to e5ecute a set of statements in
multiple places of the program 0rite all the statements in one paragraph and invo#e
it using P+RF/RM "herever needed /nce the paragraph is e5ecuted8 the control
comes $ac# to ne5t statement follo"ing the P+RF/RM
1SIMP'+ P+RF/RM
P+RF/RM P1R1-1
-ISP'1, <P1R1-1 e5ecuted;
S!/P R67
P1R1-1
Statement1
Statement(
It e5ecutes all the instructions coded in P1R1-1 and then transfers the control
to the ne5t instruction in se3uence
(I7'I7+ P+RF/RM
0hen sets of statements are used only in one place then "e can group all of
them "ithin P+RF/RM +7--P+RF/RM structure !his is called I7'I7+ P+RF/RM
!his is e3ual to -/+7- structure of other languages
P+RF/RM
1-- 1 !/ 2
M6'!IP'+ 2 2, &
-ISP'1, <:1'6+ /F 1L2?& < &
+7--P+RF/RM
= P+RF/RM P1R1-1 !.R6 P1R1-7
1ll the paragraphs $et"een P1R1-1 and P1R1-7 are e5ecuted once
K P+RF/RM P1R1-1 !.R6 P1R1-7 67!I' condition(s)
!he identifiers used in the 67!I' condition(s) must $e altered "ithin the
paragraph(s) $eing performed@ other"ise the paragraphs "ill $e performed
indefinitely If the condition in the 67!I' clause is met at first time of e5ecution8 then
named paragraph(s) "ill not $e e5ecuted at all
A P+RF/RM P1R1-1 !.R6 P1R1-7 7 !IM+S
7 can $e literal defined as numeric item in "or#ing storage or hard coded
constant
M P+RF/RM P1R1-1 !.R6 P1R1-7 :1R,I7B identifier1
FR/M identifier ( 2, identifier= 67!I' condition(s)
Initiali)e identifier1 "ith identifier( and test the condition(s) If the condition
is false e5ecute the statements in P1R1-1 thru P1R1-7 and increment identifier1 2,

Mainframe Refresher Part-1 Page:62

identifier= and chec# the condition(s) again If the condition is again false8 repeat
this process till the condition is satisfied
IP+RF/RM P1R1-1 0I!. !+S! 2+F/R+%1F!+R 67!I' condition(s)
0ith !+S! 2+F/R+8 &ondition is chec#ed first and if it found false8 then P1R1-
1 is e5ecuted and this is the default (Functions li#e -/- 0.I'+)
0ith !+S! 1F!+R8 P1R1-1 is e5ecuted once and then the condition is chec#ed
(Functions li#e -/-67!I')
Refer !a$le session for eighth type of P+RF/RM
+4I! statement
&/2/' reserved "ord that performs 7/!.I7B It is used as a single
statement in a paragraph that indicate the end of paragraph(s) e5ecution
+4I! must $e the only statement in a paragraph in &/2/'IK "hereas it can $e used
"ith other statements in &/2/'JA
B/ !/ 6sage:
In a structured top-do"n programming B/ !/ is not prefera$le It offers
permanent control transfer to another paragraph and the chances of logic errors is
much greater "ith B/ !/ than P+RF/RM !he reada$ility of the program "ill also $e
$adly affected
2ut still B/ !/ can $e used "ithin the paragraphs $eing performed ie 0hen
using the !.R6 option of P+RF/RM statement8 $ranches or B/ !/ statements8 are
permitted as long as they are "ithin the range of named paragraphs
P+RF/RM 1>>-S!+P1 !.R6 S!+P-K

1>>-S!+P-1
1-- 1 !/ 2 BI:I7B &
IF - C U+R/ -ISP'1, <M6'!IP'I&1!I/7 7/! -/7+;
B/ !/ =>>-S!+P=
+7--IF
(>>-S!+P-(
M6'!IP', & 2, -
=>>-S!+P-=
-ISP'1, <:1'6+ /F &:; &
.ere B/ !/ used "ithin the range of P+RF/RM !his #ind of &ontrolled B/ !/ is fine
"ith structured programming also^

Mainframe Refresher Part-1 Page:63

!12'+S
1n /&&6RS clause is used to indicate the repeated occurrences of items of
the same format in a structure /&&6RS clause is not valid for >18 II8 JJ levels
It can $e defined as elementary or group item Initiali)ation of large ta$le
occurrences "ith specific values are usually done using perform loops in procedure
division Simple ta$les can $e initiali)ed in the follo"ing "ay
>1 0++*-1RR1, :1'6+ <M/7!6+0+-!.6FRIS1!S67;
>A 0S-0++*--1,S /&&6RS I !IM+S PI& 4(>=)

-ynamic array is the array "hose si)e is decided during runtime Qust $efore the
access of first element of the array
>1 0S-M/7!.--1,-&1'
>A 0S--1,S /&&6RS =1 !IM+S -+P+7-I7B /7 0S-/&&6R+7&+
IF M/7!. C <F+2; M/:+ <(J; to 0S-/&&6RR+7&+
1rray Items can $e accessed using I7-+4 or su$script and the difference
$et"een them are listed in the ta$le Relative su$scripts and relative inde5es are
supported only in &/2/'JA 'iterals used in relative su$scripting%inde5ing must $e
an unsigned integer
1-- 0S-S1'(S62) 0S-S1'(S62 L 1) !/ 0S-S1'(S62 L ()
Sl D Su$script Inde5
1 0or#ing Storage item Internal Item N 7o need to declare it
( It means occurrence It means displacement
= /ccurrence8 in turn translated to
displacement to access elements
and so slo"er than I7-+4 access
Faster and efficient
K It can $e used in any arithmetic
operations or for display
It cannot $e used for arithmetic
operation or for display purpose
A Su$scripts can $e modified $y any
arithmetic statement
I7-+4 can only $e modified "ith S+!8
S+1R&. and P+RF/RM statements

Mainframe Refresher Part-1 Page:64

S+1R&.
0hen the re3uirement is to randomly access se3uential information8 the only
possi$le "ay is to load the information in an array and loo# up in the array for
the information re3uested
!his ta$le loo# up can $e done in t"o "ays: 1 Se3uential Search (S+1R&.)
( 2inary Search (S+1R&. 1'')
!o use S+1R&.%S+1R&. 1''8 ta$le should have an inde5 !o use S+1R&. 1'' the
ta$le should $e in a sorted order

Mainframe Refresher Part-1 Page:65

-ifference $et"een S+1R&. and S+1R&. 1''
Sl D Se3uential S+1R&. 2inary S+1R&.
1 S+1R&. S+1R&. 1''
( !a$le should have I7-+4 !a$le should have I7-+4
= !a$le need not $e in S/R!+-
order
!a$le should $e in sorted order of the
searching argument !here should $e
1S&+7-I7B%-+S&+7-I7B &lause
K Multiple 0.+7 conditions can $e
coded
/nly one 0.+7 condition can $e coded
A 1ny logical comparison is possi$le /nly C is possi$le /nly 17- is possi$le
in compound conditions
M !o start the search from first
element8 inde5 should $e set to 1
!he logic is search one after other
from the current inde5 till the
search is successful or end of
ta$le
Inde5 need not $e set to 1 !he logic is
compare the item to $e searched "ith
the item at the mid of the ta$le If it
matches fine8 else repeat the process
"ith left or right half depending on "here
the item lies For this logic to "or# fine8
the array should $e sorted on the item
$eing searched
I Preferred in the follo"ing cases:
1 !a$le Si)e is small
( !a$le contains duplicates and
re3uired to retrieve all the
duplicates
=!a$le can $e loaded in such a
"ay that the most fre3uently
accessing elements can $e loaded
in the first fe" occurrences
Preferred in the follo"ing cases:
0hen the si)e of the ta$le is large and all
the elements in the ta$le "ill $e
fre3uently accessed and ta$le does not
contain any duplicates and contain a
uni3ue #ey
J Synta5:
S+! inde5name-1 !/ 1
S+1R&. identifier-1 1! +7-
-isplay <7o Match:;
0.+7 condition-1
Statements %7+4! S+7!+7&+
0.+7 condition-(
Statements %7+4! S+7!+7&+
+7--S+1R&.
Identifier-1 should $e /&&6RS item
and not >1 item
Synta5:
S+1R&. 1'' Identifier-1 1! +7-
-isplay <7o Match:;
0.+7 condition-1
Statements %7+4! S+7!+7&+
+7--S+1R&.
1! +7- &lause and S+! command:
!hough 1! +7- &lause is optional8 it is highly recommended to code that 2ecause if
it is not coded and element loo#ing for is not found8 then the control simply comes to
the ne5t statement after S+1R&. "here an invalid ta$le item can $e referred and
that may lead to incorrect results % a$normal ends
S+! statement Synta5:
S+! inde5-name-1 !/%6P 2,%-/07 2, integer-1

Mainframe Refresher Part-1 Page:66

Multi -imensional 1rrays
&/2/'IK supports array of ma5imum of three dimensions "hereas &/2/'JA
supports up to seven dimensions !he lo"est- level /&&6RS data-name or an item
su$ordinate to it is used to access an entry in the array or the ta$le
If "e use S+1R&. for accessing multi-dimension ta$le8 then I7-+4+- 2,
must $e used on all /&&6RS levels +5panded nested perform is availa$le for
processing multi level ta$les !he synta5 of this perform is given $elo":
P+RF/RM para-1 thru para-n
:1R,I7B inde5-1 from 1 2, 1 67!I' inde5-1 G si)e- of- outer-occurs
1F!+R :1R,I7B inde5-( from 1 $y 1 until inde5-( G si)e of inner occurs
S+1R&. e5ample for multi level ta$les:
>1 +MP-!12'+
>A -+P!76M2+R /&&6RS 1> !IM+S I7-+4+- 2, I1
1> +MP--+!1I' /&&6RS A> !IM+S I7-+4+- 2, I(
1A +MP-76M2+R PI& O(>K)
1A +MP-S1'1R, PI& O(>A)
II +MP76M2+R-I7 PI& O(>K) :1'6+ <(>A(;
P+RF/RM 1>>-S+1R&.-+MP-S1' :1R,I7B I1 FR/M 1 2, 1
67!I' I1 G 1> /R 0S-F/67-
1>>-S+1R&.-+MP-S1'
S+! I( !/ 1
S+1R&. +MP--+!1I' 1! +7- -ISP'1, <7/! F/67-; CC G 'o"est /ccurs
0.+7 +MP76M2+R-I7 C +MP-76M2+R(I18I()
-ISP'1, <S1'1R, IS:; +MP-S1'1R,(I18I()
S+! 0S-F/67- !/ !R6+ CC G Search ends
+7--S+1R&.
7+S!+- PR/BR1MS8 B'/21'8 +4!+R71'
/ne program may contain other program(s) !he contained program(s) may
themselves contain yet other program(s) 1ll the contained and containing programs
should end "ith +7- PR/BR1M statement PBM2 is nested a program in the
e5ample $elo":
+5ample: I-+7!IFI&1!I/7 -I:ISI/7
PR/BR1M-I- PBM1
Z
I-+7!IFI&1!I/7 -I:ISI/7
PR/BR1M-I- PBM2
Z
+7- PR/BR1M PBM2
Z
+7- PR/BR1M PBM1
If you "ant access any "or#ing storage varia$le of PBM1 in PBM28 then
declare them "ith the clause <IS B'/21'; in PBM1 If you "ant to access any
"or#ing storage varia$le of PBM2 in PBM18 declare them "ith the clause <IS
+4!+R71'; in PBM2 7ested Programs are supported only in &/2/'JA
If there is a program PBM& inside PBM28 it cannot $e called from PBM1
unless it;s program id is 3ualified "ith #ey"ord &/MM/7

Mainframe Refresher Part-1 Page:67

S/R! and M+RB+
!he programming S/R! is called as internal sort "hereas the sort in P&' is
called e5ternal sort If you "ant to manipulate the data $efore feeding to sort8 prefer
internal sort In all other cases8 e5ternal sort is the good choice Internal sort8 in turn
invo#es the S/R! product of your installation (-FS/R!) In the run P&'8 allocate at
least three sort "or# files (S/R!-0*nn CG nn can $e >>-OO)
F1S!SR! compiler option ma#es the -FS/R! to do all file I-/ operation than
your &/2/' program It "ould significantly improve the performance !he result of
the S/R! can $e chec#ed in S/R!-R+!6R7 register If the sort is successful8 the
value "ill $e > else 1M
Synta5:
S/R! S/R!FI'+ /7 1S&+7-I7B %-+S&+7-I7B *+, sd-#ey-1 sd-#ey(
6SI7B file1 file( % I7P6! PR/&+-6R+ IS section-1
BI:I7B file= % /6!P6! PR/&+-6R+ is section-(
+7--S/R!
File18 File( are to-$e-sorted input files and File= is sorted-output file and all
of them are defined in F-S/R!FI'+ is -is# S/R! 0or# file that is defined at S- It
should not $e e5plicitly opened or closed
I7P6! PR/&+-6R+ and 6SI7B are mutually e5clusive If 6SI7B is used8 then
file1 and file( should not $e opened or R+1- e5plicitly If I7P6! PR/&+-6R+ is used
then File1 and file( need to $e /P+7ed and R+1- the records one $y one until end of
the file and pass the re3uired records to sort-"or#-file using the command R+'+1S+
Synta5: R+'+1S+ sort-"or#-record from input-file-record
/6!P6! PR/&+-6R+ and BI:I7B are mutually e5clusive If BI:I7B is used8
then file= should not $e opened or 0RI!+ e5plicitly If /6!P6! procedure is used8
then File= should $e /P+7ed and the re3uired records from sort "or# file should $e
R+!6R7ed to it /nce 1! +7- is reached for sort-"or#-file8 close the output file
Synta5: R+!6R7 sort-"or#-file-name 1! +7- imperative statement
I7P6! PR/&+-6R+ :s /6!P6! PR/&+-6R+:
Sometimes it "ould $e more efficient to process data $efore it is sorted8
"hereas other times it is more efficient to process after it is sorted If "e intend to
eliminate more records8 then it "ould $e $etter preprocess them $efore feeding to
S/R! If "e "ant to eliminate all the records having spaces in the #ey field then it
"ould $e efficient if "e eliminate them after sorting 2ecause the records "ith $lan#
#ey comes first after sorting
M+RB+
It is same as sort 6SI7B is mandatory !here should $e minimum t"o files in
6SI7B
M+RB+ Sort-"or#-file /7 1S&+7-I7B *+, dataname1 dataname(
6SI7B file1 file(
BI:I7B file= % /6!P6! PR/&+-6R+ is section-1
+7--M+RB+
Program sort registers (and its e3uivalent -FS/R! parameter%meaning)
S/R!-FI'+-SIU+ (FI'SU)8 S/R!-&/R+-SIU+ (R+SI7:)8 S/R!-MSB(MSB--7)

Mainframe Refresher Part-1 Page:68

S/R!-M/-+-SIU+ (SMSCnnnnn)
S/R!-R+!6R7(return-code of sort) and
S/R!-&/7!R/' (7ames the file of control card N default is IBUSR!&-)


Mainframe Refresher Part-1 Page:69

S!RI7B M17IP6'1!I/7
1 string refers to a se3uence of characters String manipulation operations
include finding a particular character%su$-string in a string8 replacing particular
character%su$-string in a string8 concatenating strings and segmenting strings
1ll these functions are handled $y three ver$s I7SP+&!8 S!RI7B and 67S!RI7B in
&/2/' +41MI7+ is the o$solete version of I7SP+&! supported in &/2/'IK
I7SP+&!- F/R &/67!I7B
It is used to tally the occurrence of a single character or groups of characters in a
data field
I7SP+&! identifier-1 !1'',I7B identifier-( F/R
1''T'+1-I7B literal-1Tidentifier-=
R2+F/R+T1F!+R I7I!I1' identifier-KTliteral-(S - /ptional
I7SP+&! identifier-1 !1'',I7B identifier-( F/R
&.1R1&!+RS
R2+F/R+T1F!+R I7I!I1' identifier-KTliteral-(S - /ptional
Main String is identifier-1 and count is stored in identifier-( 'iteral-1 or
Identifier-= is a character or group-of-characters you are loo#ing in the main-string
I7SP+&! further 3ualifies the search "ith 2+F/R+ and 1F!+R of the initial occurrence
of identifier-K or literal-(
+5ample:
0S-71M+ N <M6!.6 S1R1:171 S6R,1 &.17-R1 -+:I;
I7SP+&! 0S-71M+ !1'',I7B 0S-&/67! 1'' <S;
2+F/R+ I7I!I1' <&.17-R1; 1F!+R I7I!I1' <S1R1:171;
+7--I7SP+&!
Result: 0S-&/67! contains N 1
I7SP+&!- F/R R+P'1&I7B
It is used to replace the occurrence of a single character or groups of
characters in a data field
I7SP+&! identifier-1 R+P'1&I7B
1''T'+1-I7B literal-1Tidentifier-( 2, identifier-=Tliteral-(
R2+F/R+T1F!+R I7I!I1' identifier-KTliteral-(S - /ptional
I7SP+&! identifier-1 R+P'1&I7B &.1R1&!+RS
2, identifier-( 2+F/R+T1F!+R I7I!I1' identifier-=Tliteral-1
I7SP+&!-F/R &/67!I7B 17- R+P'1&I7B
It is a com$ination of the a$ove t"o methods
I7SP+&! identifier-1 !1'',I7B Ftallying part G R+P'1&I7B Freplacing partG

Mainframe Refresher Part-1 Page:70

S!RI7B
S!RI7B command is used to concatenate one or more strings
Synta5:
S!RI7B identifier-1 % literal-18 identifier-(% literal-(
-+'IMI!+- 2, (identifier-=%literal-=%SIU+)
I7!/ identifier-K
+7--S!RI7B
>1 :1R1 PI& 4(1>) :1'6+ <M6!.6 <
>1 :1R( PI& 4(1>) :1'6+ <S1R1 <
>1 :1R( PI& 4((>)
!o get display <M6!.68S1R1;
S!RI7B :1R1 -+'IMI!+- 2, < <
<8; -+'IMI!+- 2, SIU+
:1R( -+'IMI!+- 2, < <
I7!/ :1R=
+7--S!RI7B
!he receiving field must $e an elementary data item "ith no editing sym$ols
and P6S! RIB.! clause
0ith S!RI7B statement8 specific characters of a string can $e replaced
"hereas M/:+ replaces the full string
>1 1B+-/6! PI& 4(1() :1'6+ ;1( ,+1RS /'-;
S!RI7B <1J; -+'IMI!+- 2, SIU+ I7!/ 1B+-/6! CG 1J ,+1RS /'-
Reference Modification N e3uivalent of S62S!R
<Reference modification; is used to retrieve or over"rite a su$-string of a
string <&; is #no"n as reference modification operator
Synta5: String(Starting-Position&'ength)
M/:+ <1J; !/ 1B+-/6!(1:() does the same as "hat "e did "ith S!RI7B command
0hen it is used in array elements8 the synta5 is
1rray-element (occurrence) (Starting-Position:'ength)

67S!RI7B
67S!RI7B command is used to split one string to many strings
Synta5:
67S!RI7B identifier-1
R-+'IMI!+- 2, (1''%) identifier(%literal1 R8/R (1''%) (identifier-=%literal-()8SS
I7!/ identifier-K R8-+'IMI!+R I7 identifier-A8 &/67! I7 identifier-MS
R8identifier-I R8-+'IMI!+R I7 identifier-J8 &/67! I7 identifier-OS
>1 0S--1!1 PI& 4(1() :1'6+ <1>%(>>%=>>%1;
67S!RI7B 0S--1!1 -+'IMI!+- 2, <%;
I7!/ 0S-F'-1 -+'IMI!+R I7 0S--1 &/67! I7 0S-&1
0S-F'-( -+'IMI!+R I7 0S--( &/67! I7 0S-&(
0S-F'-= -+'IMI!+R I7 0S--= &/67! I7 0S-&=
+7--67S!RI7B
Result:
0S-F'-1 C 1> 0S-F'-( C(>> 0S-F'-=C=>>

Mainframe Refresher Part-1 Page:71

0S-&1 C ( 0S-&(C= 0S-&=C= 0S--1 C <%; 0S--(C;%; 0S--= <%;
/7 /:+RF'/0 can $e coded "ith S!RI7B and 67S!RI7B If there is S!RI7B
truncation then the imperative statements follo"ed /7 /:+RF'/0 "ill $e e5ecuted
&/P, Statement
1 &/P, statement is used to $ring a series of pre"ritten &/2/' entries that
have $een stored in li$rary8 into a program
1&ommon routines li#e error routine8 date validation routine are coded in a li$rary
and $ring into the program $y &/P,
( Master files are used in multiple programs !heir layout can $e placed in one
copy$oo# and $e placed "herever the files are used It promotes program
standardi)ation since all the programs share the same layout and the same data
names
!his reduces coding and de$ugging time &hange in layout needs change in
copy$oo# only It is enough if "e Qust recompile the program for ma#ing the ne"
copy effective
Synta5:
&/P, copy$oo#-name R(/F%I7) li$rary nameS
RR+P'1&I7B string-to-$e-replaced 2, replacing-stringS
&opy$oo#s are stored as mem$ers in P-S li$rary and during compilation time8 they
are included into the program 2y default8 the copy$oo# li$rary is S,S'I2 and it can
$e changed using I7 or /F of &/P, statement
&opy$oo#s can $e used in the follo"ing paragraphs
S/6R&+-&/MP6!+R8 /2P+&!-&/MP6!+R8 SP+&I1'-71M+S8 FI'+-&/7!R/'8
I/-&/7!R/'8 F- S+&!I/78 P1R1BR1P.S I7 PR/&+-6R+ -I:ISI/7

If the same copy$oo# is used more than once in the program8 then there "ill
$e [duplicate data declaration\ error during compilation8 as all the fields are declared
t"ice In this case8 one copy$oo# can $e used "ith R+P'1&I7B ver$ to replace high-
level 3ualifier of the all the varia$les "ith another 3ualifier
+5ample: &/P, &6S!/M+R R+P'1&I7B <&6S!1-< 2, <&6S!(-<
-elimiter <C C; should $e used for replacing pseudo te5ts !he replacing
option does not alter the pre"ritten entries in the li$rary@ the changes are made to
the user;s source program only
&1'' statement (Su$-Programs)
0hen a specific functionality need to $e performed in more than one
program8 it is $est to "rite them separately and call them into each program Su$
Programs can $e "ritten in any programming language !hey are typically "ritten in
a language $est suited to the specific tas# re3uired and thus provide greater
fle5i$ility
Main Program &hanges:
&1'' statement is used for e5ecuting the su$-program from the main
program 1 sample of &1'' statement is given $elo":

Mainframe Refresher Part-1 Page:72

&1'' <PBM(; 6SI7B 2, R+F+R+7&+ 0S-:1R18 2, &/7!+7! 0S-:1R(
PBM( is called here 0S-:1R1 and 0S-:1R( are "or#ing storage items
0S-:1R1 is passed $y reference 0S-:1R( is passed $y &ontent 2, R+F+R+7&+ is
default in &/2/' and need not $e coded 2, &/7!+7! '+7B!. phrase permits the
length of data item to $e passed to a called program
Su$-Program &hanges:
0S-:1R1 and 0S-:1R( are "or#ing storage items of main program
1s "e have already mentioned8 the lin#age section is used for accessing e5ternal
elements 1s these "or#ing storage items are o"ned $y main program8 to access
them in the su$-program8 "e need to define them in the lin#age section
'I7*1B+ S+&!I/7
>1 '7*-I!+MS
>A '*-:1R1 PI& O(>K)
>A '*-:1R( PI& O(>K)
In addition to define them in lin#age section8 the procedure division should $e coded
"ith these data items for address-a$ility
PR/&+-6R+ -I:ISI/7 6SI7B '*-:1R18'*-:1R(
!he name of the identifiers in the called and calling program need not $e the
same (0S-:1R1 9 '*-:1R1)
!he last statement of your su$-program should $e +4I! PR/BR1M !his
returns the control $ac# to main program B/21&* can also $e coded instead of
+4I! PR/BR1M $ut not S!/P R67 +4I! PR/BR1M should $e the only statement in a
paragraph in &/2/'IK "hereas it can $e coded along "ith other statements in a
paragraph in &/2/'JA
PR/BR1M-I- FProgram-nameG IS I7I!I1' PR/BR1M
If IS I7I!I1' PR/BR1M is coded along "ith program-id of su$ program8 then
the program "ill $e in initial stage every time it is called (&/2/'JA feature)
1lternatively &17&+' issued after &1''8 "ill set the su$-program to initial state
If the su$ program is modified then it needs to $e recompiled !he need for
main program recompilation is decided $y the compiler option used for the main
program If the -,71M compiler is used8 then there is no need to recompile the main
program !he modified su$routine "ill $e in effect during the run 7/-,71M is
default that e5pects the main program recompilation
-ifference $et"een Pass-$y-reference and Pass-$y-content
Sl D Passl 2y Reference Pass 2y &ontent
1 &1'' <su$1; 6SI7B 2,
R+F+R+7&+ 0S-:1R1
&1'' <su$1; 6SI7B 2, &/7!+7! 0S-:1R1
(2, &/7!+7! #ey"ord is needed)
( It is default in &/2/' 2,
R+F+R+7&+ is not needed
2, &/7!+7! #ey "ord is mandatory to
pass an element $y value
= 1ddress of 0S-:1R1 is passed :alue of 0S-:1R1 is passed
K !he su$-program modifications !he su$-program modifications on the

Mainframe Refresher Part-1 Page:73

on the passed elements are
visi$le in the main program
passed elements are local to that
su$-program and not visi$le in the main
program
-ifference $et"een Static &all and -ynamic &all
Sl D S!1!I& &all -,71MI& &all
1 Identified $y &all literal
+5: &1'' <PBM1;
Identified $y &all varia$le and the
varia$le should $e populated at run time
>1 0S-PBM PI& 4(>J)
Move <PBM1; to 0S-PBM
&1'' 0S-PBM
( -efault &ompiler option is
7/-,71M and so all the literal
calls are considered as static calls
If you "ant convert the literal calls into
-,71MI&8 the program should $e
compiled "ith -,71M option
2y default8 call varia$les and any un-
resolved calls are considered as dynamic
= If the su$program undergoes
change8 su$ program and main
program need to $e recompiled
If the su$program undergoes change8
recompilation of su$program is enough
K Su$ modules are lin# edited "ith
main module
Su$ modules are pic#ed up during run
time from the load li$rary
A Si)e of load module "ill $e large Si)e of load module "ill $e less
M Fast Slo" compared to Static call
I 'ess fle5i$le More fle5i$le
I7!RI7SI& F67&!I/7S:
'+7B!. Returns the length of the PI& clause 6sed for finding length of group
item that spanned across multiple levels
M14 Returns the content of the argument that contains the ma5imum value
MI7 Returns the content of the argument that contains the minimum value
76M:1' Returns the numeric value represented $y an alphanumeric character
string specified in the argument
76M:1'-& Same as 76M:1' $ut currency and decimal points are ignored during
conversion
&6RR+7! Returns (1 &hars alphanumeric value N ,,,,MM--..MMSSnnnnnn
-1!+
I7!+B+R /F -1!+ Returns I7!+B+R e3uivalent of Bregorian date passed
I7!+B+R /F -1, Returns I7!+B+R e3uivalent of Pulian date passed
-1!+ /F I7!+B+R Returns Bregorian date for the integer passed
-1, /F I7!+B+R Returns Pulian date for the integer passed
7ote: F67&!I/7 I7!+B+R /F -1!+ (>1->1-1M>1) returns 1

Mainframe Refresher Part-1 Page:74


Mainframe Refresher Part-1 Page:75

FI'+ .17-'I7B
1 data file is collection of relevant records and a record is collection of
relevant fields !he file handling in &/2/' program involves five steps
Steps in file-handing
11llocation: !he files used in the program should $e declared in FI'+-
&/7!R/' paragraph of environment division !he mapping "ith P&' --71M+ is done
here !he file is allocated to your program $y this statement
(-efinition !he layout of the file and its attri$utes are defined in the FI'+
S+&!I/7 of -1!1 -I:ISI/7
=/pen: -ataset is connected%readied to your program using /P+7
statement !he mode of /P+7 decides the operation allo"ed and the initial pointer in
the dataset For e5ample8 +4!+7- mode allo"s only "rite access and the pointer is
#ept on the end of file to append
KProcess: Process the file as per re3uirement8 using the I-/ statements
provided $y &/2/' (R+1-8 0RI!+8 R+0RI!+ and -+'+!+)
A &lose: 1fter the processing8 close the file to disconnect it from the
program
1llocation of file - S+'+&! Statement
(+7:IR/7M+7!-G I7P6!-/6!P6!-G FI'+-&/7!R/')
S+'+&! R/P!I/71'S FILENAME 1SSIB7 to DDNAME CG1'' Files
/RB17IU1!I/7 IS S+V6+7!I1'%I7-+4+-%R+'1!I:+ CG1'' Files
1&&+SS IS S+V67+!I1'%R17-/M%-,71MI& CG1'' Files
R+&/R- *+, IS FILE-)E*9 CG*S-S
R+'1!I:+ *+, IS WS-%%N CGRR-S
1'!+R71R+ R+&/R- *+, IS FILE-)E*5 0I!. -6P'I&1!+S CG*S-S "ith
1'!+R71R+ R+&/R- *+, IS FILE-)E*B 0I!./6! -6P'I&1!+S CG1I4
FI'+ S!1!6S IS WS-FILE-SA9 CG1'' Files
R8WS-FILE-SA5S CG:S1M Files
S+'+&! Statement- /P!I/71' &lause
!his can $e coded only for input files If /P!I/71' is not coded8 then the
input file is e5pected to present in P&' If not8 an e5ecution error "ill occur
If /P!I/71' is coded8 then if the file is not mapped in P&'8 it is considered as
empty file and the first read results end of file
!he file can also $e dynamically allocated instead of static allocation in P&'
S+'+&! Statement- 1SSIB7 !/
FILENAME is the logical name used inside the program and DDNAME is the
logical name in the P&'8 mapped "ith physical dataset DDNAME can $e prefi5ed "ith
<6!-S-< to indicate VS1M file8 <6!-1S-; to indicate +S-S file and "ith no prefi5 to
indicate *S-S%RR-S file
P&' Step e5ecuting the program should have a dataset "ith DDNAME as la$el

Mainframe Refresher Part-1 Page:76

%%DDNAME -- -S7C2PM1I7+MP'/,++-1!18-ISPCS.R
S+'+&! Statement-/RB17IU1!I/7
It can $e S+V6+7!I1' (PS or :S1M +S-S)8 I7-+4+- (:S1M *S-S)8
R+'1!I:+ (:S1M RR-S) -efault is Se3uential
S+'+&! Statement-1&&+SS M/-+
S+V6+7!I1'
It is default access mode and it is used to access the records /7', in
se3uential order !o read 1>>
th
record8 first OO records need to $e read and s#ipped
R17-/M
Records can $e randomly accessed in the program using the
primary%alternate #ey of inde5ed file organi)ation or relative record num$er of
relative organi)ation1>>
th
record can directly $e read after getting the address of the
record from the I7-+4 part for I7-+4+- files1>>
th
record can directly $e read for
R+'1!I:+ files even "ithout any inde5
-,71MI&
It is mi5ed access mode "here the file can $e accessed in random as "ell as
se3uential mode in the program
+5ample: Reading the details of all the employees $et"een 1>>>-(>>> First
randomly access 1>>>
th
employee record8 then read se3uentially till (>>>
th
employee
record S!1R! and R+1- 7+4! commands are used for this purpose in the procedure
division
S+'+&! Statement-R+&/R- *+, IS
It is primary #ey of :S1M *S-S file It should $e uni3ue and part of inde5ed
record structure
S+'+&! Statement-1'!+R71!+ R+&/R- *+, IS
!his phrase is used for *S-S files defined "ith 1I4 1dd the clause 0I!.
-6P'I&1!+S if the 1I4 is defined "ith duplicates
Referring to :S1M $asics8 every alternate inde5 record has an associated
P1!. and the path should $e allocated in the P&' that invo#es this program
!he --71M+ of the path should $e --71M+ of the $ase cluster suffi5ed "ith
1 for the first alternate record clause8 suffi5ed "ith n for nth 1'!+R71!+ R+&/R-
*+, clause in S+'+&! clause
S+'+&! Statement-FI'+ S!1!6S IS WS-FILE-SA9,WS-FILE-SA5
WS-FILE-SA9 should $e defined as PI& 4(>() in "or#ing storage section
1fter every file operation8 the file status should $e chec#ed for allo"a$le values
WS-FILE-SA5 can $e coded for :S1M files to get the :S1M return code ((
$ytes)8 :S1M function-code (1 $yte) and :S1M feed$ac# code (= $ytes)
!his is a M- $yte field in "or#ing storage
R+S+R:+ &lause
R+S+R:+ clause RR+S+R:+ integer 1R+1 S can $e coded in the S+'+&!
statement !he num$er of $uffers to $e allocated for the file is coded here
2y default t"o $uffers "ill $e allocated if the clause is not coded Since similar option
is availa$le in P&'8 this is not coded in program

Mainframe Refresher Part-1 Page:77

R+S+R:+ 1 1R+1 allocates one $uffer8 for the file in the S+'+&! statement
-efining the file in FI'+ S+&!I/7 - F-
F- FILENAME
R+&/R-I7B M/-+ IS :%:2%F%F2
R+&/R- &/7!1I7S M &.1R1&!+RS (!/ 7 &.1R1&!+RS)
2'/&* &/7!1I7S 4 &.1R1&!+RS%R+&/R-S (!/ , &.1R1&!+RS%R+&/R-S)
'12+' R+&/R-S 1R+ /MI!!+-%S!17-1R-
-1!1 R+&/R- IS FILE-%EC$%D
>1 FILE-%EC$%D PI& 4(nnn)
F--R+&/R- &/7!1I7S
It specifies the length of the record in terms of $ytes (It "ill $e R+&/R-
contains m to n &.1R1&!+RS for varia$le format files)
F--2'/&* &/7!1I7S
It specifies the physical record si)e It can $e mentioned as num$er of logical
records /R num$er of characters8 that is multiple of logical record length It is
suggested to code 2'/&* &/7!1I7S > R+&/R-S so that system "ill decide the
optimum si)e for the file $ased on the device used for storing the file 2'/&*
&/7!1I7S clause is treated as comments for :S1M files
1dvantage of 2loc#ing:
1I-/ time is reduced as n num$ers of records are read into main memory $uffer
during an I-/
(Inter record gap is removed and the gap e5ist only $et"een $loc#s So memory
"astage due to IRB is avoided
F--R+&/R-I7B M/-+ IS
It can $e F (FI4+-) :(:1RI12'+) F2(FI4+- 2'/&*) :2(:1RI12'+ 2'/&*+-)
:aria$le record file identification:
If there is no recording mode%record contains clause8 it is still possi$le to
identify varia$le length records If there is an /&&6RS depending on clause or there
are multiple >1 levels and every >1 level is of different si)e8 then the file "ould $e of
varia$le length Multiple >1 levels in File section is an e5ample for implicit
redefinition
F--'12+' R+&/R-S &lause
1s a general rule8 '12+' R+&/R-S are S!17-1R- is coded for -is# and !ape
files8 '12+' R+&/R-S 1R+ /MI!!+- is coded for printer files In &/2/'IK8 this
clause is a mandatory clause "hereas &/2/'JA made this as optional
F---1!1 R+&/R- IS &lause
It is used to name the data record(s) of the file More than one record can $e
coded here

Mainframe Refresher Part-1 Page:78

/P+7 S!1!+M+7!
Synta5: /P+7 /P+7M/-+ FILENAME
/P+7M/-+ can $e I7P6! /6!P6! I-/ +4!+7-
I7P6! - File can $e used /7',-F/R-R+1- purpose
/6!P6! - File can $e used /7',-F/R-0RI!+ purpose
I-/ - File can $e used F/R R+1-8 0RI!+ and R+0RI!+ purpose
+4!+7- - File can $e used F/R appending records using 0RI!+
&'/S+ statement
!he used files are closed using &'/S+ statement If you don;t close the files8
the completion of the program closes all the files used in the program
Synta5: &'/S+ FILENAME
/P+7 and &'/S+ for !1P+ files - 1dvanced
If more than one file is stored in a reel of tape8 it is called as multi-file
volume 0hen one file is stored in more than one reel of tape8 it is called as
multi-volume la$el /ne reel is #no"n as one volume 0hen the end of one volume is
reached8 automatically the ne5t volume opens So there is no special control is
needed for multi volume files
/P+7 I7P6! file-1 R0I!. 7/ R+0I7- T R+:+RS+-S
/P+7 /6!P6! file-( R0I!. 7/ R+0I7-S
&'/S+ file-= RWR++'T67I!X R0I!. 7/ R+0I7-T F/R R+M/:1'S
&'/S+ file-= R0I!. 7/ R+0I7-T'/&*S
67I! and R++' are synonyms
1fter opening a !1P+ file8 the file is positioned at its $eginning 0hen opening
the file if the clause R+:+RS+- is coded8 then the file can $e read in the R+:+R+S+
direction (Provided hard"are supports this feature)
0hen you close the file8 the tape is normally re"ound !he 7/ R+0I7-
clause specifies that the !1P+ should $e left in its current position
&'/S+ statement "ith R++' option closes the current reel alone So the ne5t
R+1- "ill get the first record of ne5t R++' !his "ill $e useful "hen you "ant s#ip all
the records in the first reel after n num$er of records processing
Since !1P+ is se3uential device8 if you create multiple files in the same !1P+8
then $efore opening the second file8 first file should $e closed 1t any point of time8
you can have only one file is active in the program In addition to this8 you have to
code M6'!IP'+ FI'+ clause in the I-/ control paragraph of environment division
M6'!IP'+ FI'+ !1P+ &/7!1I7S /6!-FI'+1 P/SI!I/7 1
/6!-FI'+= P/SI!I/7 =
!he files /6!-FI'+1 and /6!-FI'+= used in the program are part of a same
!1P+ and they e5ist in first and third position in the tape 1lternatively8 this
information can $e passed from P&' using '12+' parameter

Mainframe Refresher Part-1 Page:79

R+1- statement
R+1- statement is used to read the record from the file
Synta5: R+1- FILENAME RI7!/ "s-recordS R*+, IS FILE-)E*9S
R1! +7-%I7:1'I- *+, imperative statement1S
R7/! 1! +7-%7/! I7:1'I- *+, imperative statement(S
+7--R+1-
If I7!/ clause is coded8 then the file is directly read into "or#ing storage
section record It is preferred as it avoids another move of file-section-record to
"or#ing-storage-record follo"ed $y simple R+1- R+1--I7!/ is not preferred for
varia$le si)e records "here the length of the record $eing read is not #no"n
*+, IS clause is used "hile accessing a record randomly using
primary%alternate record #ey
1! +7- and 7/! 1! +7- are used during se3uential R+1- of the file
I7:1'I- *+, and 7/! I7:1'I- *+, are used during random read of the file
2efore accessing the file randomly8 the #ey field should have a value $efore R+1-
0RI!+ Statement
0rite statement is used to "rite a ne" record in the file If the file is opened
in +4!+7- mode8 the record "ill $e appended If the file is opened in /6!P6! mode8
the record "ill $e added at the current position
Synta5: 0RI!+ FILE-%EC$%D RFR/M "s-recordS
RI7:1'I- *+, imperative statement1S
+7--0RI!+
FR/M clause avoids the e5plicit move of "or#ing storage record to file section record
$efore 0RI!+

R+0RI!+ Statement
R+0RI!+ is used to update an already read record !o update a record in a
file8 the file should $e opened in I-/ mode
Synta5: R+0RI!+ FILE-%EC$%D RFR/M "s-recordS
RI7:1'I- *+, imperative statement1S
+7--R+0RI!+
S!1R! Statement
S!1R! is used "ith dynamic access mode of inde5ed files It esta$lishes the
current location in the cluster for R+1- 7+4! statement S!1R! itself does not
retrieve any record
Synta5: S!1R! FILENAME
*+, is +V61' !/%7/! '+SS !.17%BR+1!+R !.17 #ey-name
RI7:1'I- *+, imperative statement1S

Mainframe Refresher Part-1 Page:80

+7--S!1R!
-+'+!+ Statement
-+'+!+ is used to delete the most recently read record in the file !o delete a
record8 the file should $e opened in I-/ mode
Synta5: -+'+!+ FILENAME R+&/R-
RI7:1'I- *+, imperative statement1S
+7---+'+!+
Reports N F21:
Reports contain the printing control character in the first $yte !he record format
"ill $e F21 and the 'R+&' "ill $e 1== in the P&' !he program can define
printing control character and populate it manually or can define the layout "ith
1=( $ytes and $y means of program supported 0RI!+ ver$s li#e
1F!+R%2+F/R+%1-:17&I7B In the second case printing control character "ill
$e automatically added at the time of compilation $y the default 1-: compiler
option
Printing control character +3lt &/2/' statement
< < ($lan#) 1fter advancing 1 line
> 1fter advancing ( lines
- 1fter advancing = lines
L 1fter advancing > lines
1 1fter ne" page

File +rror N .andling
!here are chances for failure of any file I-/ processing !he failure of an I-/
operation can $e accepted or cannot $e tolerated !he severity of failure has to $e
defined in the program design stage
'et us assume that "e don;t have any error handling in our program In this
case8 for e5ample8 if you don;t have a specific record in the file8 the random read of
that record "ould immediately terminate the program "ith error <record not found;
+rror .andling &lauses Provided $y &/2/'
!he sudden termination can $e avoided $y handling this error8 "ith I7:1'I-
*+, clause of R+1- 2ased on the importance of the record and $usiness rule8 "e
can continue our program "ith ne5t record or terminate the program properly
1! +7- is another error handling clause provided $y &/2/' 2ut there is no "ay to
handle all such errors in this "ay
1ssign file-status and ta#e the responsi$ility
!he second method is8 assigning file-status to the file in the S+'+&! clause
and chec#s the file status after each and every I-/ and ensures that the value of
status code is one of the allo"a$le values If it is not an allo"a$le return code8 then
a$normally end the program "ith error statements that "ould $e easier to de$ug
2ut "e have to do this chec#ing after each and every I-/ operation
!his is M/S! PR+F+RR+- +RR/R .17-'I7B M+!./- in structured programming
-+&'1R1!I:+S N 6S+ statement

Mainframe Refresher Part-1 Page:81

&/2/' provides an option to group all the possi$le errors of specific
operation(s) in a place and that "ill $e automatically invo#ed during the respective
operation(s) of any file !his avoids redundant code
!his is done in -+&'1R1!I:+ section of the procedure division -+&'1R1!I:+
should $e the first section in the procedure division if coded
PR/&+-6R+ -I:ISI/7
-+&'1R1!I:+S
6S+-PR/&+-6R+ S+&!I/7
6S+ 1F!+R +4&+P!I/7 PR/&+-6R+ /7 I7P6!
+RR/R-PR/&+-6R+
&hec# the file-status code for validity
+7---+&'1R1!I:+S
0henever there is an error in the processing of 17, FI'+ opened in I7P6!
mode8 then the control comes to +RR/R-PR/&+-6R+ !he validity of error should $e
chec#ed in this paragraph and allo" or restrict the process do"n8 $ased on severity
of error code
!he complete synta5 of 6S+ statements is:
6S+ 1F!+R S!17-1R- +RR/RT+4&+P!I/7 PR/&+-6R+ /7
I7P6!T/6!P6!TI-/T+4!+7-T file-1
If I7P6! is coded8 the follo"ing procedure "ill $e e5ecuted for every
operation involved in any file that is opened in I7P6! mode /6!P6!8 I-/ and
+4!+7- have the same meaning $ut the mode is different
If file name (file-1) is coded in the 6S+ statement8 then all the input-output
operation of that specific file "ill $e chec#ed
+RR/R and +4&+P!I/7 are synonyms
!he Procedure "ritten in a -+&'1R1!I:+ section should not refer to any non-
declarative procedure "ritten after the end procedure and vice-versa
6S+ F/R -+26BBI7B 1'' PR/&+-6R+
-+26B --+&'1R1!I:+S -P1R1
-ISP'1, [ !R1&I7B [ -+26B-71M+
+7- -+&'1R1!I:+S
!his declarative section of the program "ill $e e5ecuted $efore the start of e5ecution
of each paragraph defined in the program ie _!R1&I7B paraname_ "ill $e
displayed $efore the e5ecution of each paragraph -+26B-71M+ is the special
register that contains the name of the paragraph $eing e5ecuted
I-/-&/7!R/' - S1M+ 1R+1 17- S1M+ R+&/R- 1R+1
R+S+R:+ clause of S+'+&! statement specifies the num$er of $uffers to $e
allocated for a file S1M+ 1R+1 allo"s more than one file to use the same $uffer
area !his "ill $e very useful "hen the program must "or# "ith a limited memory
space 2ut the pro$lem is only one file should $e open at a time if S1M+ 1R+1 is
coded
Synta5: S1M+ 1R+1 F/R file-1 file-( file-=
If S1M+ R+&/R- 1R+1 is coded8 then the $uffer is not shared $ut only the
record area is shared So more than one file can $e in open state 0e should $e

Mainframe Refresher Part-1 Page:82

careful "hile filling in the record area of the output file !his may destroy the record
read most recently
Synta5: S1M+ R+&/R- 1R+1 F/R file-1 file-( file-=
S1M+ S/R! 1R+1 allo"s more than one sort%merge "or# files to use the
same area !he sort "or# files are automatically allocated "hen file is opened and
de-allocated "hen file is closed 1s the sort file is automatically opened and closed
during a S/R! and t"o sort files cannot $e opened at a time8 this clause may not $e
useful
Synta5: S1M+ S/R!TS/R!-M+RB+ 1R+1 for file-1 file-(
File-1 or file-( should $e a S- file
I-/ &/7!R/'- R+R67 &lause
R+R67 /7 rescue F/R +:+R, integer R+&/R-S on file-1
!his "ill cause chec#point to $e ta#en for every integer-1 records processing of
file-1 If the program 12+7-+- $efore the complete processing of the file-18 then
the program "ill restart from integerL1
S!
record instead of first record !he rescue
file details should $e mentioned outside the program and it varies from installation to
installation
+7!R, statement
+7!R, statement esta$lishes an alternate +7!R, point in a &/2/' called
su$-program 0hen a &1'' statement naming the alternate entry point is e5ecuted
in a calling program8 control is transferred to the ne5t e5ecuta$le statement follo"ing
the entry statement +5cept "hen a &1'' statement refers to an entry name8 the
+7!R, statements are ignored at run-time

Mainframe Refresher Part-1 Page:83

FI'+ S!1!6S &/-+S
It is a t"o-$yte "or#ing storage item !he first $yte denotes the general
category "hereas second $yte denotes the particular type of error message under
that category
6 Success=ul $PEN'%EAD'W%IE $3eration
> Successful completion
( -uplicate #ey "as detected "hich is allo"ed as per definition of 1I4
K 'ength of record Qust R+1- didn;t conform to the fi5ed length attri$utes for
the file
A Referenced /ptional file is not present during /P+7 If open mode is I-/ or
+4!+7-8 then file "ill $e created
I /pen or &lose statement is e5ecuted "ith a phrase that implies a tape file (e5
7/ R+0I7-) "hereas the file is not in !1P+
9 W.en A END con0ition =ails
> Se3uential R+1- is attempted on
1after the end of file is reached
(optional file that is not present
K Se3uential R+1- "as attempted for a relative file and RR7 is larger than the
ma5imum that can $e stored in the relative #ey data item
5 W.en INDE( )e/ =ails
1 Se3uence error e5ists for se3uentially accessed inde5 file
( 1ttempt "as made to "rite a record that "ould create a duplicate #ey
= Record not found(for #eyed random access)
K Space not found for 0RI!+
B Permanent $3en error
A /pening a non-optional file that "as not present
I /pen mode is not permitted
J /pen issued for a file that "as closed previously "ith loc#
O File attri$ute mismatch-/pen failed
; Lo-ic error in o3enin-'closin-'0eletin-
1 /P+7 a opened file
( &'/S+ attempted for not opened file
= I/ statement $efore the current R+0RI!+%-+'+!+ is not successful
K R+0RI!+ attempt "ith invalid length
I R+1- file "hich is not opened in I7P6! or I-/ mode
J 0RI!+ file "hich is not opened in I-/ /6P6! or +4!+7- mode
O -+'+!+ or R+0RI!+ file "hich is not opened in I-/ mode
: Im3lementation 0e=ine0
1 :S1M pass"ord error
( 'ogic error
= :S1M resource unavaila$le
M 7o -- statement specified for :S1M file
I File integrity verified for :S1M file

Mainframe Refresher Part-1 Page:84

&/2/' &/MPI'1!I/7
S,SPRI7!
P1RM (&ompiler listing)
(&ompiler
/ptions)
S,SI7 S,S'I7(/$Qect Module)
(Source)
S,S'I2 P1RM
(&opy$oo# 'i$rary) ('in#
edit /ptions)
S,S'M/-
('oad Module)
S,SPRI7! S,S'I2
('in# edit messages) (Su$routine 'i$rary)
&/MPI'1!I/7 P&':
%%SMS4'JM2 P/2 8Y&/MPI'1!I/7 P&'Y8 MSB&'1SSCV8MSB'+:+'C(181)8&'1SSC&
%%&/MPI'+1 +4+& PBMCIB,&R&!'8 P1RMC;4R+F81P/81-:8M1P8'IS!)8R+BI/7C>M
%%S!+P'I2 -- -S7CS,S1&/2('I28-ISPCS.R
%%S,SI7 -- -S7CSMS4'JM!+S!&/2/'(S1MPBM>1)8-ISPCS.R
%%S,S'I2 -- -S7CSMS4'JM&/P,'I28-ISPCS.R
%%S,SPRI7! -- S,S/6!C?
%%S,S'I7 -- -S7C99'/1-S+!8 -&2C(R+&FMCF28'R+&'CJ>82'*SIU+C=(>>)8
%% -ISPC(7+08P1SS)867I!CS,S-18SP1&+C(&,'8(A81>)8R'S+)8
%%S,S6!1 -- 67I!C9S,S-18SP1&+C(&,'8(181>)) CG Co0e S*S&5 to &C
%%'I7*+-!1 +4+& PBMCI+0'8&/7-C(K8'!)
%%S,S'I7 -- -S7C99'/1-S+!8 -ISPC(/'-8-+'+!+)
%%S,S'M/- -- -S7C99B/S+!(S1MPBM>1)8-ISPC(7+08P1SS)867I!CS,S-1
%% SP1&+C(&,'818181))
%%S,S'I2 -- -S7CSMS4'JM'/1-'I28-ISPCS.R
%%S,S6!1 -- 67I!CS,S-18SP1&+C(&,'8(181>))
%%S,SPRI7! -- S,S/6!C?
%%??? +4+&6!+ !.+ PR/BR1M ???
%%+4+&6!+1 +4+& PBMC?'I7*+-!1S,S'M/-8&/7-C(K8'!)8R+BI/7C>M
%%S!+P'I2 -- -S7CSMS4'JM'/1-'I28-ISPCS.R
%% -- -S7CS,S1S&++R678-ISPCS.R
%%S,S/6! -- S,S/6!C?

IB,&R&!'
(&/2/' &/MPI'+R)
I+0'
('in# +ditor)
Mainframe Refresher Part-1 Page:85

%%S,SPRI7! -- S,S/6!C?

&ompiler /ptions
!he default options that "ere set up "hen your compiler "as installed are in
effect for your program unless you override them "ith other options !o chec# the
default compiler options of your installation8 do a compile and chec# in the
compilation listing
0ays of overriding the default options
1&ompiler options can $e passed to &/2/' &ompiler Program (IB,&R&!') through
the P1RM in P&'
(PR/&+SS or &2' statement "ith compiler options8 can $e placed $efore the
identification division
=If the organi)ation uses any third party product or its o"n utility then these options
can $e coded in the pre-defined line of the utility panel
Precedence of &ompiler /ptions
1 (.ighest precedence) Installation defaults8 fi5ed $y the installation
( /ptions coded on PR/&+SS %&2' statement
= /ptions coded on P&' P1RM parameters
K ('o"est Precedence) Installation defaults8 $ut not fi5ed
!he complete list of compiler option is in the ta$le:
1spect &ompiler /ption
Source 'anguage 1P/S!8 &MPR(8 &6RR+7&,8 -2&S8 'I28 76M2+R8
V6/!+8 S+V6+7&+8 0/R-
-ate Processing -1!+PR/&8 I7!-1!+8 ,+1R0I7-/0
Maps and 'isting '17B61B+8 'I7+&/67!8 'IS!8 M1P8 /FFS+!8 S/6R&+8 SP1&+8
!+RMI71'8 :2R+F8 4R+F
/$Qect -ec#
generation
&/MPI'+8 -+&*8 71M+8 /2P+&!8 PBM71M+
/$Qect &ode
&ontrol
1-:8 10/8 -''8 +4P/R!1''8 F1S!SR!8 /P!IMIU+8 76MPR/&8
/6!--8 !R67&8 U02
-e$ugging -6MP8 F'1B8 F'1BMIB8 F'1BS!-8 SSR17B+8 !,P+&.*
/ther 1-1!18 171',U+8 +4I!8 I-'B+7
1-:: It is meaningful if your program has any printer files "ith 0RI!+1-:17&I7B
#ey"ord !he compiler adds one $yte prefi5 to the original 'R+&' of printer files for
printing control purpose If you are manually populating printing control character in
the program8 then you can compile your program "ith 7/1-:
-,71M: 6se -,71M to cause separately compiled programs invo#ed through the
&1'' literal statement to $e loaded dynamically at run time -,71M causes dynamic
loads (for &1'') and deletes (for &17&+') of separately compiled programs at o$Qect
time 1ny &1'' i0enti=ier statements that cannot $e resolved in your program are
also treated as dynamic calls 0hen you specify -,71M8 R+SI-+7! is also put into
effect

Mainframe Refresher Part-1 Page:86

'IS!%/FFS+!: 'IS! and /FFS+! are mutually e5clusive If you use $oth8 'IS! "ill $e
ignored 'IS! is used to produce listing a listing of the assem$ler language e5pansion
of your code /FFS+! is used to produce a condensed Procedure -ivision listing
0ith /FFS+!8 the procedure portion of the listing "ill contain line num$ers8
statement references8 and the location of the first instruction generated for each
statement !hese options are useful for solving system 12+7-S Refer P&' session
for more details
M1P: 6se M1P to produce a listing of the items you defined in the -ata -ivision
SSR17B+: If the program is compiled "ith SSR17B+ option8 then any attempt to
refer an area outside the region of the ta$le "ill a$normally terminate "ith
protection e5ception8 usually S>&KIt also avoids any meaningless operation on
reference modification li#e negative num$er in the starting position of reference
modification e5pression If the program is compiled "ith 7/SSR17B+8 then the
program may proceed further "ith Qun# or irrelevant data So usually the programs
are compiled "ith SSR17B+ during development and testing
R+7!: 1 program compiled as R+7! is generated as a reentrant o$Qect module &I&S
programs should $e compiled "ith R+7! option to share the same copy of the
program $y multiple transactions (Multithreading)
R+SI-+7!: 6se the R+SI-+7! option to re3uest the &/2/' 'i$rary Management
Feature (!he &/2/' 'i$rary Management Feature causes most &/2/' li$rary
routines to $e located dynamically at run time8 instead of $eing lin#-edited "ith the
&/2/' program)&I&S Programs should $e compiled "ith R+SI+7! option
4R+F: 6se 4R+F to get a sorted cross-reference listing +2&-I& data-names and
procedure-names "ill $e listed in alphanumeric order It also includes listing8 "here
all the data-names that are referenced "ithin your program and the line num$er
"here they are defined !his is useful for identifying the fields that are defined $ut
not used any"here after the development of ne" program


Mainframe Refresher Part-1 Page:87

-ifference $et"een /S%:S &/2/' and :S &/2/' (]
/S :S &/2/' (&/2/'IK) :S &/2/'( (&/2/'JA)
(K 2it addressing 1llo"s =1 $it addressing and ma#es
easier to develop large applications
7ested Programs are not allo"ed 7ested Program are allo"ed N Improves
productivity $ecause different
programmers can develop them at the
same time N Promote data sharing and
data protection
Report "rite feature is dropped (R0)
7/!+S8 </7; statement8 R+M1R*S are
removed
+5plicit scope terminators are introduced
P/I7!+R clause is added
I7SP+&! replaces +41MI7+ "ith advance
capa$ilities

Mainframe Refresher Part-1 Page:88

'(rt!al Stora" A))"** +"t,o-
'SA+

Mainframe Refresher Part-1 Page:89

:S1M ('irtual Storage Access +ethod)
.istory
1ccess Method is an interface $et"een the application program and physical
operation of storage devices It is a component of operating system :S1M is the first
access method that efficiently uses the virtual storage of M:S It can manipulate only
the data that resides on a -1S- (-irect access storage device)
I2M introduced :S1M in 1OI= as a replacement for several e5isting access
methods designed $y it earlier
*S-S (*ey Se3uenced -ata Set) replaced IS1M (Inde5ed Se3uential 1ccess Method)
RR-S (Relative Record -ata Set) replaced 2-1M (2asic -irect 1ccess Method)
+S-S (+ntry Se3uence -ata Set) provide same function as normal se3uential VS1M
(Vueued Se3uential 1ccess Method)
Initially :S1M had only +S-S and *S-S RR-S and 1lternate Inde5 to *S-S
are introduced in 1OIO -F% +F (-ata Facility e5tended Function) :S1M "as
introduced in 1OIO "ith Integrated &atalog Facility (I&F) to replace the old :S1M
catalog of the previous versions
!he latest version of -FP% :S1M released in 1OO1 called -FP%:S1M ==
contains enhancements li#e varia$le record length support for RR-S and added
-FSMS facilities
1dvantages of :S1M over other access methods
1-ata retrieval "ill $e faster $ecause of an efficiently organi)ed inde5 !he inde5 is
small $ecause it uses a #ey compression algorithm
(Insertion of records is easy due to em$edded free space in the cluster
=Records can $e physically deleted and the spaces used $y them can $e used for
storing other records "ithout reorgani)ation
K:S1M datasets can $e shared across the regions and systems
A-atasets can $e physically distri$uted over various volumes $ased on #ey ranges
M:S1M is independent of storage device types
IInformation a$out :S1M datasets is centrally stored in :S1M catalog
So referencing of any :S1M dataset need not $e detailed in P&'
-isadvantages of :S1M
1!o allo" easy manipulation of records8 free space should $e left in the dataset and
this increases the spaces re3uired
(Integrity of the dataset across the region and system need to $e controlled $y
user

Mainframe Refresher Part-1 Page:90

&'6S!+R
1 cluster can $e thought of as a logical dataset consisting of t"o separate
physical datasets:
1 !he data component (contains the actual data)
( !he inde5 component (contains the actual inde5)
1ll types of :S1M datasets are called clusters even though *S-S is the only
type that fulfills the cluster concept +S-S and RR-S don;t have Inde5 component
-ata &omponent
&ontrol Intervals and &ontrol 1reas
:S1M stores records in the data component of the &luster in units called
control intervals
!he control interval is the :S1M e3uivalent for a $loc# and it is the unit of
data that is actually transmitted "hen records are read or "ritten !hus many logical
records form a control interval and many control intervals form a control area
!he &ontrol 1rea (&1) is a fi5ed length unit of contiguous -1S- storage
containing a num$er of &I s !he control area is :S1M internal unit for allocating
space "ithin a cluster !he primary and secondary allocations consist of some
num$er of &1 Minimum si)e of control area is 1 trac# and ma5imum si)e is 1
cylinder
Format of &ontrol Interval
!here are four separate areas "ithin a control Interval
1 'ogical Record 1rea ('R1) that contains the records
( Free Space (FSP&) !his area can $e used for adding ne" records
= 6nused Space 1s FSP& may not $e a multiple of record length8 there "ill $e
al"ays some unused space in every &I !his can $e minimi)ed for fi5ed length
records $y selecting proper control interval si)e
K &ontrol Fields
&I-F N &ontrol Interval -efinition Field - K $ytes field containing information
on free space availa$ility in the control interval /ne per control interval
R-F N Record -efinition Field N = $ytes field For fi5ed length records8 there
"ill $e ( R-F8 first contains the num$er of records in the control interval and
the second contains record length For varia$le length records8 the num$er of
R-F can vary depending on ho" many adQacent records have the same length
in the &I If no t"o adQacent records are of the same length8 then one R-F is
needed to descri$e each record
Inde5 &omponent (Se3uence Set and Inde5 Set)
2esides the data component8 :S1M creates an inde5 component Inde5
component consists of inde5 set and se3uence set !he se3uence set is the lo"est
level of the inde5 is called the se3uence set and it contains primary #eys and
pointers to the control intervals of the data component
!here is one se3uence set for one control area !he highest record #ey of
every control interval is stored in se3uence set !he highest record #ey of the
se3uence set is stored in first level of inde5 set 2ased on the si)e of control interval
of inde5 component8 there "ill $e 1-= levels of inde5 sets in the inde5 component of
the dataset

Mainframe Refresher Part-1 Page:91

&ontrol Interval and &ontrol 1rea Split
0hen a :S1M dataset is created8 the free space parameter defined can
specify a percentage of control intervals to $e left free during the load of :S1M file
'ater8 "hen you add a record to the :S1M file8 according to the #ey se3uence8 it is
placed in a specific control interval
2ut if the specific control interval is already full8 then this cannot $e placed in
the se3uence !he result is &ontrol Interval split It moves half of the records in the
filled control interval to any other free control interval availa$le in the control area
and ma#es room for the ne" record in the right place
If there is no free control interval e5ist in the control area8 then half the
control intervals are moved to ne" control area and this is called control area split
+5ample
1 In the e5ample $elo"8 there are four control areas and every control area contains
t"o control intervals &ontrol fields are not sho"n in the diagram !here should $e
one se3uence for every control area So there are four se3uence sets !here are t"o
levels of inde5 set !he second level of inde5 set contains pointers to se3uence set
( &ontrol Interval Split: 0hen a record "ith #ey (( is added in the program8 it
should physically $e stored $et"een the e5isting records (1 and (= (1 and (= are in
the first control interval of control area-= !here is no more space availa$le to store
this record So control split "ill occurs Record (> and (1 continue to e5ist in the
current control interval Records (( and (= "ill $e moved to any of the free control
intervals In our case control interval ( is free So they are moved there and inde5
set is accordingly updated
= &ontrol 1rea Split: 0hen a record "ith #ey = in the program8 it should $e placed
$et"een ( and K !hese records are in first control interval of first control area and
there is no free space So control interval split is e5pected 2ut there is no free
control interval in the control area-1 So control area split occur 7e" control area is
allocated and half the records of control area-1 "ill $e moved there and inde5es are
properly updated
.o" inde5 could ma#e the access faster]
I faced an interesting 3uestion in an intervie" !he 3uestion follo"s:
My se3uential file has A> records !o get the A>
th
record8 I have to read KO
data records and $ypass Inde5es store primary #eys "ith actual location So to read
A>
th
record using inde5ed organi)ation8 I have to get the location of A>
th
record from
inde5 So I have to read and $ypass the location of KO records !he only difference is
in the second case is I am doing se3uential read in inde5 set instead of dataset .o"
do you say my inde5 access "ould $e faster]
!o ans"er this 3uestion8 you should #no" ho" inde5es are organi)ed and
read 0e have already seen ho" they are organi)ed In the e5ample $elo"8 to read
the A>
th
record8 first root inde5 is read and identified that the record should $e in the
right hand side In the second I-/8 I "ill get the se3uence and in third I-/8 I "ill get
the location of the record I "ill get my record in the fourth I-/ instead A1 I-/ (A>
I/ in inde5 and 1 I-/ for getting the data)

Mainframe Refresher Part-1 Page:92

If I am accessing the first record8 then se3uential read needs only one I-/ $ut
o$viously my random read needs more So "e prefer inde5ed organi)ation only "hen
the num$er of records is significant
Root Inde5

First 'evel
Inde5
Se3uence set



-ata &omponent
&1-1 &1-( &1-= &1-K
Properties of :S1M datasets
Properties of +S-S8 *S-S and RR-S are listed a ta$ular format in the ne5t
page !hough the ta$le says RR-S records should $e of fi5ed length8 M:S%-FP :S1M
:ersion == allo"s varia$le length RR-S :S1M internally implements it using *S-S
:S1M '-S Properties: 'inear datasets have no records !hey are Qust long strings of
$ytes Since it is a long string of $ytes an '-S has no FSP&8 6S8 &I-F and R-F !he
&ISU is al"ays K# $ytes !he main use of '-S is to implement other data access
organi)ations especially a relational data$ase system li#e -2(
1s the data in an '-S is manipulated the operating system automatically
pages in and out the portions of the dataset $eing "or#ed on !he dataset is
addressed $y the R21 as if it "ere in memory and the system pages the needed
pages in and out !hus the process is very simple and fast
+S-S differs from VS1M file in the follo"ing "ays:
1 VS1M can $e created over !1P+ "hereas +S-S cannot reside on !1P+
( 1lternate Inde5 can $e created over +S-S !his alternate inde5 has alternate
#ey mapped "ith R21 So Inde5ed and Random access are possi$le using the
alternate Inde5 in +S-S "hereas it is not possi$le "ith VS1M

?J ?1I
?K ?J ?1K ?1I ?(=
1 ( K
A I J 1I
(> (1 (= 1( 1K
? (= ?A>
?=A ?A>
? 1I ?A>
== =A
A>
Mainframe Refresher Part-1 Page:93

&omparison of +S-S8 *S-S and RR-S
&haracteristics +S-S *S-S RR-S
+ntry Se3uence 2ased on entry
se3uence
2ased on collating
se3uence $y #ey
field
2ased on relative
record num$er
order
1ccess /nly Se3uential
access is possi$le
Se3uential and
random access is
possi$le Random
access is thru
primary%alternate
#ey
&an $e accessed
directly using
relative record
num$er8 "hich
serves as address
1lternate I7-+4 May have one or more
alternate inde5es 2ut
cannot $e used in
21!&. &/2/' &an $e
used in &I&S &/2/'
May have one or
more alternate
inde5es
7ot applica$le
'ocation of the
record
1 record R21 cannot
$e changed
1 record R21 can
$e changed
1 relative record
num$er can $e
changed
Free Space +5ist at the end of the
dataset to add
records
-istri$uted free
space for inserting
records in $et"een
or change the
length of e5isting
record
Free slots are
availa$le for adding
records at their
location
-eletion &annot $e deleted
R+0RI!+ of same
length is possi$le
-+'+!+ is possi$le -+'+!+ is possi$le
Record Si)e Fi5ed or :aria$le Fi5ed or :aria$le Fi5ed
SP177+-
records
Possi$le Possi$le 7ot possi$le
Speciality /ccupies less Space +asy R17-/M
access and most
popular method
Fastest access
method
Preference 1pplication that
re3uire se3uential
access only
+5: P1,R/''
PR/&+SSI7B
1pplications that
re3uire each record
to have a #ey field
and re3uire $oth
direct and
se3uential access
+5: 2an#ing
application
1pplications that
re3uire only direct
access !here
should $e a field in
the record that can
$e easily mapped
to RR7

Mainframe Refresher Part-1 Page:94

I$C A ccess + ethod S ervices (I-&1MS)
1MS is used to perform various functions on :S1M datasets and catalogs
1MS has got a utility program called I-&1MS !he functions of 1MS are performed
using the different functional commands of I-&1MS It can $e invo#ed in the
follo"ing three "ays:
1 2atch mode "ith P&' statements
( Interactively "ith !S/ commands
= &alls from an application program
Important functional commands of I-&1MS are:
1 -+FI7+ N !o create o$Qects N *S-S%+S-S%RR-S%B-B%:S1MSP1&+ etc
( 1'!+R - !o alter the parameters of the o$Qect already e5ists
= PRI7! - !o print and vie" the selected records of dataset
K -+'+!+ N -elete the o$Qects
A 'IS!&1! N :ie" the complete information a$out any o$Qect
M R+PR/ - &opy%Restore%Merge 6tility for :S1M and 7/7-:S1M files
I +4P/R! and IMP/R!
N &opy and restore datasets across the system
J :+RIF, N !o properly close the unclosed%12+7-+- :S1M dataset

Sample I-&1MS P&'
%%PS1> +4+& PBMCI-&1MS8R+BI/7C1>(K*8 P1RMCparameters
%%S!+P&1! -- -S7C8-ISPCS.R /ptional S!+P&1!
%%S,SPRI7! -- S,S/6!C? I-&1MS Messages
%%S,SI7 -- ?
&ontrol statements
%?
%%
Buidelines for coding commands
1 1t least one $lan# space must $e there $et"een the command and the o$Qect and
$et"een su$ parameter values
( 1 space is optional $et"een a parameter and the parenthesis enclosing its values
= Su$-parameter values can $e separated using a space or a comma
K Multiple parameters can $e coded on a line $ut it is $etter to place each on a line
$y itself for $etter reada$ility
A 1 parameter and a su$-parameter cannot $e separated "ith a hyphen 1 plus sign
should $e used for this purpose

Mainframe Refresher Part-1 Page:95

Meaning of FI'+ and -1!1S+! in 1MS commands
1 *ey"ord FI'+ should point to --71M+ and it is logical !here should $e mapping
of the --71M+ "ith actual dataset P+S allocates the datasets associated "ith the
file Qust $efore the e5ecution of step

( *ey"ord <-1!1S+!; should directly point to the physical dataset and I-&1MS
allocates this file dynamically for operation
-+FI7+ &'6S!+R
!his command is used to create and name a :S1M &luster
2asic Parameters for -efine &luster
-+FI7+ &'6S!+R-71M+
!his parameter specifies name to the :S1M cluster !he cluster name
$ecomes the dataset name in any P&' that invo#es the cluster
%% I7P6! -- -S7C SMS4'JM!+S!:S1M8 -ISPCS.R
!he name for a :S1M dataset can include up to KK alphanumeric characters
0hen the data and inde5 parameters are coded to create the data and inde5
components8 the name parameter is coded for them as "ell If the name parameter
is omitted for the data and inde5 :S1M tries to append part of -1!1 or I7-+4 as
appropriate as the lo" level 3ualifier depending on ho" many characters the dataset
name contains already and still staying "ithin the KK character limit
If data and inde5 components are named8 parameter values can $e applied
separately !his gives performance advantages for large datasets
-+FI7+ &'6S!+R--1!1 &/MP/7+7!
!he data parameter instructs I-&1MS that a separate data component is to
$e created -ata is optional $ut if coded must follo" all parameters that apply to the
cluster as a "hole !here are several options for the data parameter $ut name is the
most common
-+FI7+ &'6S!+R-I7-+4 &/MP/7+7!
!he inde5 parameter creates a separate inde5 component Inde5 is optional
$ut if coded must follo" all of the parameters that apply only to the data component
+S-S and RR-S must not have I7-+4 part
-+FI7+ &'6S!+R-SP1&+ 1llocation
1 :S1M dataset can have 1(= e5tents in a :/'6M+ Primary space is
allocated initially "hen the dataset is created and $ased on re3uest secondary space
"ill $e allocated In the $est case8 you "ill get (primary L1(( ? secondary)
Refer the P&' section-SP1&+ parameter section for more details on +4!+7!S
:S1M calculates the control area si)e internally &ontrol area can of one
cylinder8 the largest permitted $y :S1M8 usually yields the $est performance So it is
al"ays $etter to allocate space in cylinders $ecause this ensures a &1 si)e of one
cylinder

Mainframe Refresher Part-1 Page:96

!he R+&/R-S parameter is used to allocate space in units of records for small
datasets 0hen this is done the R+&/R-SIU+ parameter must $e specified
If allocation is specified in units of *I'/2,!+S or M+B12,!+S :S1M reserves space
on the minimum num$er of trac#s it needs to satisfy the re3uest
Synta5: 67I!(primary secondary)
67I! can $e &,'%&,'I7-+RS !R*%!R1&*S R+&%R+&/R-S-
*2%*I'/2,!+S M2%M+B12,!+S
-+FI7+ &'6S!+R-:/'6M+S Parameter
!he volumes parameter assigns one or more storage volumes to the dataset
Multiple volumes can $e specified and if so8 they must $e of the same device type
!he data and inde5 components can $e stored in separate volumes to provide a
performance advantage for large datasets
:/'6M+S(volser) /R :/'6M+S(volser1 volser()

-+FI7+ &'6S!+R-R+&/R-SIU+ Parameter (R+&SU)
!he record si)e parameters specify :S1M "hat records to e5pect !he 1:B
and M14 are the average and ma5imum values for varia$le length records If records
are of fi5ed length 1:B and M14 can $e the same Record si)e can $e assigned at
the cluster or data level
Synta5: R+&/R-SIU+(1:B M14)
-+FI7+ &'6S!+R- *+,S Parameter
!he #eys parameter defines the length and offset of the primary #ey in a
*S-S record !he offset is the primary #ey;s displacement in $ytes from the
$eginning of the record !his parameter is defined for a *S-S only -efault is
*+,S(MK >)
Synta5: *+,S(length offset)

-+FI7+ &'6S!+R- -ataset !ype Parameter
!he dataset type parameter specifies "hether the dataset is
I7-+4+-(*S-S) 8 7/7I7-+4+-(+S-S)8 76M2+R+-(RR-S) /R 'I7+1R ('-S)
I7-+4+- (I4-) specifies a *S-S and it is the -+F16'! 0hen this parameter
is specified :S1M automatically creates and catalogs an inde5 (if other parameters
li#e #eys are valid) Inde5ed is also used for a varia$le length RR-S
7/7I7-+4+-(7I4-) "hen specified denotes an +S-S 7o inde5 is created
and records are accessed se3uentially or $y their relative $yte address (R21)
76M2+R+- (76M-) specifies an RR-S and 'I7+1R specifies an '-S
Performance Parameters For -+FI7+ &'6S!+R
!he performance parameters are coded in the -+FI7+ &'6S!+R command to
1 Reduce the amount of physical I-/
( Ma#e necessary I-/ faster
= /ptimi)e dis# utili)ation
-+FI7+ &'6S!+R- &/7!R/' I7!+R:1' SIU+ Parameter

Mainframe Refresher Part-1 Page:97

!he si)e of the &I is specified $y the &ISU parameter !he si)e of the &I is
specified in $ytes and it should $e a multiple of A1( or (>KJ depending on the type
of catalog (I&F or :S1M) and the length of the record
For datasets cataloged in I&F catalogs the control interval should $e a
multiple of A1( $ytes "ith a range of A1( to =(IMJ $ytes
For datasets cataloged in :S1M catalogs8 the data &ISU must $e a multiple of
A1( if records are of J1O( $ytes or less8 and a multiple of (>KJ if records are of
more than J1O( $ytes If a &ISU8 "hich is not a multiple of the a$ove t"o is
assigned :S1M rounds the &ISU value up to the ne5t highest multiple if necessary
2est control interval si)e selection
For se3uential processing of a *S-S8 a relatively large &ISU "ill reduce
physical I%/ $y #eeping more records accessi$le in the $uffers /n the other hand8
for random processing of a *S-S a smaller &ISU "ould re3uire lesser data transfer
time and fe"er $uffers8 thus ma#ing I%/ faster
For an +S-S (since it is processed se3uentially) the &ISU should $e relatively large
depending on the si)e of the record
Since an RR-S is processed randomly the &ISU should $e relatively small

!he FR++SP1&+ Parameter (FSP&)
!he FR++SP1&+ parameter is applica$le to the *S-S and the varia$le-length
RR-S only FR++SP1&+ cannot $e assigned to an +S-S $ecause all ne" records are
added to the end of the dataset
!his parameter allocates some percentage of $oth the &I and &1 for planned
free space8 "hich can $e used for adding ne" records or e5panding e5isting varia$le
records !he parameter is coded as follo"s
FR++SP1&+(ci` ca`)
FR++SP1&+(ci` ) control interval only
FR++SP1&+(> ca`) control area only
FR++SP1&+(> >) is the default
FR++SP1&+(1>> 1>>) means only one record "ill $e loaded in every control interval
and only one control interval "ill $e loaded in every control area
In order to effectively allocate FR++SP1&+ the follo"ing factors have to $e ta#en into
consideration
1 !he e5pected rate of gro"th: If even gro"th is e5pected apply FR++SP1&+ to $oth
&I and &1 If uneven gro"th is e5pected apply FR++SP1&+ only to the &1
( !he e5pected num$er of records to $e deleted
= .o" often the dataset "ill $e reorgani)ed "ith R+PR/
K !he performance re3uirements

Mainframe Refresher Part-1 Page:98

!he &I FR++SP1&+ allocation should $e enough to cover the length of one
record plus any additional R-Fs that may result from a varia$le record length
-+FI7+ &'6S!+R- SP++- 1nd R+&/:+R, Parameters
R+&/:+R, pre formats a :S1M dataset at the time of initial load or resume
load It ta#es longer time to load the dataset through R+&/:+R, than through
SP++- "hich does not pre format the dataset .o"ever if the load operation is
a$orted in the middle8 R+&/:+R, ena$les resumption immediately after the last
record loaded
If SP++- is specified load "ill have to $e restarted from the $eginning SP++-
is highly recommended $ecause it "ill speed up the initial data load

!he 26FF+RSP1&+ Parameter (26FSP)
2y default8 :S1M allocates t"o data $uffers for all types of datasets /ne data
$uffer for processing and reserves the second for potential split activity In addition
to this8 it "ould allocate one inde5 $uffer for a *S-S
!his parameter is used to override the default values !he 26FF+RSP1&+
parameter represents the amount of storage in $ytes re3uired to process the
contents of a minimum of one &I "orth of data
Synta5: 26FF+RSP1&+($ytes)
For se3uential processing more num$er of data $uffers need to $e allocated
For random processing more inde5 $uffers may $e re3uired8 at least one for each
level of the inde5 For dynamic processing additional data and inde5 $uffers are
re3uired in proportion to the ratio of se3uential and random processing planned
!he 26FSP value provided gets translated into data $uffers for an +S-S or
RR-S 2ut for a *S-S8 :S1M decides on the num$er of data and inde5 $uffers $ased
on the access method specified in the application program
If 26FSP is specified in the -+FI7+ &'6S!+R command8 all applications that
use the dataset can use only this allocation unless they override it in the 26FSP su$
parameter of the 1ccess Method Parameter of P&'
-+FI7+ &'6S!+R-SP177+- Parameter (SP7-)
!he SP177+- parameter allo"s large records to span more than one &I
If ma5imum record length is more than the &I si)e specified8 allocation "ill fail unless
the SP177+- parameter is specified .o"ever records cannot span across control
areas !he resulting free space in the spanned &I is unusa$le $y other records even
if they fit logically in the unused $ytes 7/7SP177+- is the default
It can $e specified for +S-S and *S-S only
-+FI7+ &'6S!+R-!he *+,R17B+S Parameter (*,R7B)
!he *+,R17B+S parameter divides a large dataset among several volumes
!he volumes in "hich the records are to $e placed are specified using the :/'6M+S
parameter 6nless the *+,R17B+S parameter is specified "ith the /R-+R+-
parameter8 the records are assigned randomly to the volumes !hese parameters are
illustrated $y the follo"ing e5ample

Mainframe Refresher Part-1 Page:99

-+FI7+ &'6S!+R -
(71M+(7!&I:6+K0(>>>>!=>1:-0(>>>>M) -
&,'(A 1) -
*+,S(J >) -
R+&SU(J> J>) -
*+,R17B+S ((>>>>>>>1 (OOOOOO) -
(=>>>>>>> KI>>>>>) -
(KI>>>>>1 OOOOOOO)) -
:/'6M+S (7!!S/2 -
7!!S/P -
7!!S/A) -
/R-+R+- -
7/R+6S+ -
I7-+4+-
a a a more parameters
0hen the /R-+R+- parameter is coded the num$er of :/'6M+S and *+,R17B+S
must $e the same
-+FI7+ &'6S!+R- R+6S+ Parameter (R6S)
!his specifies that a cluster can $e opened again and again as a reusa$le
cluster It means8 "henever you open the dataset in /6!P6! mode8 all the records
that are already e5ist in the dataset are logically deleted 7/R+6S+ (67R6S) is the
default and specifies the cluster as non-reusa$le
1 cluster cannot $e reused if
1 *+,R17B+S parameter is coded for it
( 1n alternate inde5 is $uilt for it
= !he cluster has its o"n data space in $oth the :S1M and I&F catalog
environments

-+FI7+ &'6S!+R-IM2+- 1nd R+P'I&1!+ Parameters (IM2-% R+P')
!hese parameters are applica$le to a *S-S only !he IM2+- parameter
implies that the se3uence set (lo"ermost level) of the inde5 component of a *S-S
"ill $e placed on the first trac# of a data component &1 and "ill $e duplicated as
many times as possi$le on that trac#
0hat IM2+- does for a se3uence set R+P'I&1!+ does for an inde5 set !he
R+P'I&1!+ parameter forces each &I of the inde5 set of the inde5 component to $e
"ritten on a separate trac# and replicated as many times as possi$le !his parameter
reduces rotational delay "hen :S1M is accessing high-level inde5 &I
!he IM2+- option reduces the see# time it ta#es for the read-"rite head to
move from the inde5 to the data component and the replication factor reduces the
rotational delay of the revolving dis#
7/IM2+-(7IM2-) and 7/R+P'I&1!+(7R+P') are the defaults
-+FI7+ &'6S!+R-0RI!+&.+&* Parameter (0&*)
!his parameter instructs :S1M to invo#e a -1S- verify facility "henever a
record is "ritten 7/0RI!+&.+&* (70&*) is the default and provides no -1S-
verification Since contemporary -1S- devices are very relia$le and $ecause of the
high performance overhead associated "ith this parameter it is $etter to accept the
7/0RI!+&.+&* option

Mainframe Refresher Part-1 Page:100

-+FI7+ &'6S!+R-S.1R+/P!I/7S Parameter
!his parameter specifies ho" a :S1M dataset can $e shared across the
regions and across the system -efault value is (1 =)
Synta5: S.1R+/P!I/7S(cross-region cross-system)
!ype :alue Meaning
&R 1 R+1- and 0RI!+ Integrity 1ny num$er of Qo$s can read the
dataset /R only one Qo$ can "rite to the dataset
&R ( /7', 0RI!+ Integrity 1ny num$er of Qo$s can read the dataset
17- one Qo$ can "rite to the dataset
&R
&S
= 7/ Integrity File is fully shared It is programmer responsi$ility to
ta#e proper loc# over the file $efore use -efault value for &S
&S K Same as = $ut additionally forces a $uffer refresh for each random
access
-+FI7+ &'6S!+R-+R1S+ Parameter
!he +R1S+ parameter instructs :S1M to over"rite sensitive data "ith $inary
)eroes "hen the cluster is deleted 7/+R1S+ is the default and it means that the
deleted cluster is not to $e over"ritten "ith $inary )eroes +R1S+ can $e coded at
the cluster or data level
0hen applied to the cluster level it refers only to the data component since
the inde5 component contains only #eys and not data +R1S+ can $e specified "ith
the 1'!+R and -+'+!+ commands +R1S+ provided "ith -+'+!+ overrides $oth
-+FI7+ and 1'!+R specifications
Pass"ord Protection
:S1M datasets can $e pass"ord protected at four different levels +ach level
gives a different access capa$ility to the dataset !he levels are
1 R+1-P0- provides read only capa$ility
( 6P-1!+P0- records may $e read8 updated 8 added or deleted at this level
= &/7!R/'P0- provides the programmer "ith the access capa$ilities of
R+1-P0 and 6P-1!+P0
K M1S!+RP0- all the a$ove operations plus the authority to delete the dataset
is provided
Pass"ords provided at the cluster level protect only if access re3uires using
the cluster;s name as dataset name !herefore it is advisa$le to protect the data and
inde5 components using pass"ords $ecause someone could other"ise access them
$y name 1nother feature of M:S called Resource 1ccess &ontrol Facility (R1&F)
ignores :S1M pass"ords and imposes its o"n security and for most :S1M datasets
R1&F security is sufficient
!he 1!!+MP!S parameter coded "ith the pass"ord parameters specifies the
num$er of attempts permitted for the operator to enter the pass"ord $efore
a$ending the step

Mainframe Refresher Part-1 Page:101

!he &/-+ parameter allo"s for the specification of a code to display to the
operator in place of the entry name prompt
!he 16!./RIU1!I/7 parameter provides for additional security $y naming an
assem$ler 6ser Security :erification Routine (6S:R) !he su$ parameter for this
enclosed in parenthesis is the entry point of the routine
!/ 1nd F/R Parameters
0hen a dataset is allocated $y 1ccess Method Services the !/ and F/R
parameters are t"o mutually e5clusive parameters given to specify the retention
period of the cluster $eing defined
!/(,,---) or F/R(nnnn)
,,--- is Pulian date 9 nnnn can $e 1-OOOO

1$out &1!1'/B parameter
Most of the 1MS commands provide &1!1'/B option If the command is
-+FI7+8 then the dataset $eing defined "ill $e placed in the catalog8 mentioned in
the &1!1'/B parameter Similarly "hile accessing the dataset8
1 !he dataset is first searched in the catalog mentioned in &1!1'/B parameter
( If &1!1'/B is not coded8 then the dataset is searched into the catalog coded in
S!+P&1! or P/2&1! catalog
= If there is no S!+P&1! and P/2&1!8 then the dataset is searched in the user
catalog corresponding to the high level 3ualifier of the dataset
K If there is no user catalog found8 then the dataset is loo#ed into system catalog
A If the dataset is not listed in system catalog also8 then you "ill get the error
message of dataset not found
!here "ill $e one master catalog and n num$er of user catalogs in the
system +very user catalog should have an entry in master catalog
*S-S-+S-S-RR-S-'-S Sample -efinitions

9SDS D!*)n))on
119SDS"A9E E0E% #$"5'D%A"S
11S,S#R'N+ DD S,SO.+5A
11S,S'N DD8
DE/'NE %&.S+ER 3
(NA"E(E"#&O,EEC9SDSC%&.S+ER) 3
-O&."ES(-SA"02) 3
%,&'NDERS(2G1) 3
%ON+RO& 'N+ER-A& S'HE(4096) 3
FREESPACE(10,20) 3
KEYS(9,0) 3
RE%ORDS'HE(50G50)) 3
DA+A 3
(NA"E(E"#&O,EEC9SDSCDA+A)) 3
INDEX 3
(NA"E(E"#&O,EEC9SDSC'NDE0)) 3
%ON+RO& 'N+ER-A& S'HE(1024) 3
%A+A&O$(-SA"C.SER%A+C+?O)
18
ESDS D!*)n))on
11ESDS"A9E E0E% #$"5'D%A"S
11S,S#R'N+ DD S,SO.+5A
11S,S'N DD8
DE/'NE %&.S+ER 3
(NA"E (E"#&O,EECESDSC%&.S+ER) 3
-O&."ES (-SA"02) 3
%,&'NDERS (2G1) 3
%ON+RO&'N+ER-A&S'HE (4096) 3
RE%ORDS'HE (50G50) 3
NONINDEXED) 3
DA+A 3
(NA"E (E"#&O,EEC9SDSCDA+A)) 3
%A+A&O$ (-SA"C.SER%A+C+?O)
18
Mainframe Refresher Part-1 Page:102

I-&1MS - R+PR/ command
It is the general-purpose command that can operate on $oth :S1M and non-
:S1M datasets It performs three $asic functions:
1 It loads an empty :S1M cluster "ith records !he data and inde5 components for
*S-S are $uilt automatically
( It creates a $ac#up of a :S1M dataset on a physical se3uential dataset and later
it can $e used for restore%re$uild the :S1M dataset
= It merges data from t"o :S1M datasets
&ommand Synta5
R+PR/ -
I7FI'+(--71M+) T I7-1!1S+!(-1!1S+!-71M+) -
/6!FI'+(--71M+) T /6!-1!1S+!(-1!1S+!-71M+) -
optional parameters
I7FI'+%I7-1!1S+! and /6!FI'+%/6!-1!1S+! point to input and output datasets
0hen loading a *S-S using R+PR/8 the input data should $e first sorted in
ascending se3uence $y the field that "ill $ecome the primary #ey in the output
dataset 0hen loading an +S-S the sort step can $e eliminated since the records are
loaded in entry se3uence For an RR-S8 the records are loaded in relative record
se3uence starting "ith 1 !he dataset should $e sorted on the field that correlates to
the relative record num$er
R+PR/ Record Selection

RRDS D!*)n))on
11RRDS"A9E E0E% #$"5'D%A"S
11S,S#R'N+ DD S,SO.+5A
11S,S'N DD8
DE/'NE %&.S+ER 3
(NA"E(E"#&O,EECRRDSC%&.S+ER) 3
-O&."ES(-SA"02) 3
%,&'NDERS(2G1) 3
%ON+RO& 'N+ER-A& S'HE(4096) 3
RE%ORDS'HE(50G50) 3
NUMBERED) 3
DA+A 3
(NA"E(E"#&O,EEC9SDSCDA+A)) 3
%A+A&O$(-SA"C.SER%A+C+?O)
18
&DS D!*)n))on
11&DS"A9E E0E% #$"5'D%A"S
11S,S#R'N+ DD S,SO.+5A
11S,S'N DD8
DE/'NE %&.S+ER 3
(NA"E(E"#&O,EECRRDSC%&.S+ER) 3
-O&."ES(-SA"02) 3
%,&'NDERS(2G1) 3
LINEAR) 3
DA+A 3
(NA"E(E"#&O,EEC9SDSCDA+A)) 3
%A+A&O$(-SA"C.SER%A+C+?O)
18
Mainframe Refresher Part-1 Page:103

R+PR/ can $e used for selective copying
0here to start R+PR/ 0here to stop R+PR/ :alid For
FR/M*+,(R+&-*+,) !/*+,(R+&-*+,) *S-S8 IS1M
FR/M1--R+SS(R12) !/1--R+SS(R21) *S-S8 +S-S
FR/M76M2+R(RR7) !/76M2+R(RR7) RR-S
S*IP(num$er) &/67!(num$er) *S-S 8 +S-S8 RR-S
S*IP refers to the num$er of input records to s#ip $efore $eginning to copy
and &/67! specifies the num$er of output records to copy
!he R+6S+ Parameter 0ith R+PR/
!he R+6S+ option of R+PR/ "ill logically delete the e5isting records of a
target *S-S8 +S-S or RR-S and add ne" records from the source dataset as if the
target dataset "ere empty In other "ords R+6S+ sets the value of the ending R21
of the .ighest 6sed control area in the data component (.6R21) to )ero
In order to use R+6S+ "ith R+PR/ it is a prere3uisite that the target dataset
must have $een defined "ith the R+6S+ option in the -+FI7+ &'6S!+R command
Merging -1!1S+!S 6sing R+PR/ and R+P'1&+ option
!he R+PR/ command can $e used for merging t"o datasets into one !he
target dataset can $e a non-empty *S-S8 +S-S or RR-S
!he input dataset can $e any organi)ation if the target dataset is a *S-S or
+S-S .o"ever if the target dataset is an RR-S the source dataset has to $e an
RR-S *S-S to *S-S is the most common application of this merge techni3ue
If the R+P'1&+ option is specified as part of the R+PR/ command then
records "ith duplicate primary #eys (for a *S-S) and duplicate relative record
num$ers (in the case of an RR-S) "ill $e replaced
I-&1MS - PRI7! &ommand
It is used to print the contents of a dataset !he output can $e made availa$le
in various formats !his section deals "ith the PRI7! command and its various
mutually e5clusive options
PRI7! I7-1!1S+!(data set-name) T I7FI'+(dd-name)
options
PRI7! - &.1R% .+4%-6MP
!his specifies the format in "hich to print
&.1R1&!+R(&.1R) prints as +2&-I&8 1(> characters per line !his format is
mostly used for alphanumeric data 1ny com$ination of $its that does not correspond
to a printa$le character "ill $e printed as a period If length of the record is greater
than 1(> characters8 it is printed in $loc#s of 1(> characters per line
.+4 format prints each character in the dataset as t"o he5adecimal digits
1 ma5imum of 1(> he5adecimal digits are printed on each line8 an e3uivalent of M>
characters
-6MP format is a com$ination of the character and he5 formats +ach
character is printed $oth as a character and as the corresponding he5 representation
+ach print line consists of MK he5 digits and the =( related characters If the record

Mainframe Refresher Part-1 Page:104

length is greater than =( characters the rest of the record is printed in $loc#s of MK
he5 digits and =( corresponding characters per line
PRI7! N S*IP8 &/67!8 FR/M and !/
!he records to $e printed can $e selected in the same "ay records are
selected in R+PR/ to &/P,

0here to start Printing 0here to stop Printing 0here 6sed
S*IP(num$er) &/67!(num$er) *S-S8 +S-S8 RR-S8
non-:S1M
FR/M*+,(#ey-value) !/*+,(#ey-value) *S-S8 1'!+R71!+ I7-+4
FR/M1--R+SS(r$a) !/1--R+SS(r$a) *S-S8 +S-S
FR/M76M2+R(rrn) !/76M2+R(rrn) RR-S
1 command that prints records (O8 =>8 and =1 in character format
PRI7! I7-1!1S+!(MM>1&6S!/M+RM1S!+R) -
&.1R1&!+R -
S*IP((J) -
&/67!(=)
+mpty file- chec#
If the file is empty8 PRI7! &/67!(1) ends "ith return-code as K
PRI7! I7-1!1S+!(/6!P6!-S7) &.1R1&!+R &/67!(1)
I-&1MS - -+'+!+ &ommand
!he -+'+!+ command can $e used to delete $oth :S1M and non-:S1M
o$Qects
Synta5: -+'+!+ +7!R, 71M+ /2P+&! optional-parameters
/2P+&!- &'6S!+R B-B P1!. 1I4 1'I1S &1!1'/B 7/7:S1M SP1&+
6S+R&1!1'/B
/ptions N +R1S+%7/+R1S+ P6RB+%7/P6RB+ S&R1!&.%7/S&R1!&.
FI'+ F/R&+%7/F/R&+
-+'+!+- +7!R, 71M+
!he name of the entry to delete is coded B+7+RI& 71M+S can $e also given
-+'+!+ - +R1S+ (+R1S) % 7/+R1S+ (7+R1S)
0hen the -+'+!+ command is e5ecuted it does not physically delete a
dataset /nly its I&F or :S1M catalog entry is removed ma#ing this space availa$le
for future use !he data component remains on the dis# until another dataset is
allocated on the same spot
If the -+'+!+ command is e5ecuted "ith the +R1S+ option8 not only "ill the
entry $e removed from the catalog $ut also the data component "ill immediately $e
over"ritten "ith $inary )eroes !his option is coded for sensitive data files

Mainframe Refresher Part-1 Page:105

-+'+!+ - P6RB+(PRB) % 7/P6RB+ (7PRB)
7/P6RB+ specifies that the entry not to $e deleted if the retention period has
not e5pired (-efault) So -+'+!+ command don;t delete the dataset $efore e5piry
date P6RB+ parameter must $e coded to delete the dataset $efore retention period
-+'+!+ - S&R1!&.(S&R) % 7/S&R1!&.(7S&R)
0hen a dataset is created8 it "ill $e listed in the catalog as "ell as the :!/&
of the -1S- S&R1!&. specifies that the dataset to $e removed from :!/& as "ell
as catalog 7/S&R1!&. specifies that the dataset to $e removed from the catalog
alone
-+'+!+ - F/R&+(FR&)%7/F/R&+(7FR&)
It specifies "hether o$Qects that are not empty should $e deleted
F/R&+ allo"s you to delete data spaces8 generation data groups8 and user
catalogs "ithout first ensuring that these o$Qects are empty
7/F/R&+ causes the -+'+!+ command to terminate "hen you re3uest the
deletion of a data space8 generation data group8 or catalog that is not empty
-+'!+ - FI'+(--71M+)
It specifies the name of the -- statement that identifies:
1 !he volume that contains a uni3ue data set to $e deleted
( !he partitioned data set from "hich a mem$er (or mem$ers) is to $e deleted
= !he data set to $e deleted if +R1S+ is specified
K !he volume that contains the data space to $e deleted
A !he catalog recovery volume(s) "hen the entry $eing deleted is in a recovera$le
catalog If the volumes are of a different device type8 concatenated -- statements
must $e used !he catalog recovery volume is the volume "hose recovery space
contains a copy of the entry $eing deleted
I-&1MS - 'IS!&1! &ommand
!he output of this command gives an insight into the inner functioning of
:S1M 'IS!&1! is used to vie" dataset attri$utes8 pass"ord 9 security information8
usage statistics8 space allocation information8 creation and e5piration dates and
much more
'IS!&1! stands for 'IS!ing a &1!alog entry It is useful for listing attri$utes
and characteristics of all :S1M and non-:S1M o$Qects cataloged in a :S1M or I&F
catalog Such o$Qects can $e the catalog itself8 its aliases8 the volumes it o"ns8
clusters8 alternate inde5es8 paths8 B-B;s8 non-:S1M files etc !he listing also
provides statistics a$out a :S1M o$Qect from the time of its allocation8 namely the
num$er of &I and &1 splits8 the num$er of I%/ on inde5 and data components8 the
num$er of records added8 deleted and retrieved $esides other useful information
Synta5:
'IS!&1! +7!RI+S(/2P+&!-71M+) 1''T1''/&1!I/7T:/'6M+T.IS!/R,T71M+
Parameter Meaning

Mainframe Refresher Part-1 Page:106

71M+ 'ist the name and type of entry
.IS!/R, 'ists reference information for the o$Qect including name8 type of
entry8 creation and e5piration date and the release of :S1M under
"hich it "as created
:/'6M+ 'ists the device type and one or more volume serial num$er of the
storage volumes "here the dataset resides .IS!/R, information
is also listed
1''/&1!I/7 'ists information that has $een specified for space allocation
including the unit(cylinders8 trac#s etc)8 num$er of allocated units
of primary and secondary space and actual e5tents !his is
displayed only for data and inde5 component entries If
1''/&1!I/7 is specified :/'6M+ and .IS!/R, are included
1'' 1ll the a$ove details are listed
'+:+' Parameter in 'IS!&1!
'IS!&1! +7!RI+S(SMS4'JM?) 1''
!his "ill return complete information a$out all o$Qects having t"o levels of
3ualification and having the first 3ualifier SMS4'JM 2ut if "e re3uire information
a$out all o$Qects having the high level 3ualifier SMS4'JM8 "e have to use the '+:+'
parameter 'IS!&1! '+:+'(SMS4'JM?) 1''
+5ample
%%SMS4'JM1 P/2 (=MA1()8YM6!.6Y87/!IF,C9S,S6I-
%% 'IS!&1! +4+& PBMCI-&1MS
%%S,SPRI7! -- S,S/6!C?
%%S,SI7 -- ?
'IS!&1! +7!RI+S(SMS4'JMP1,R/''M1S!+R) -
B-B -
1''
%?
I-&1MS - +4P/R! and IMP/R! commands
!he +4P/R! % IMP/R! commands can $e used for
1 2ac#up and recovery
( +5porting a dataset8 an alternate inde5 or a catalog to a different ($ut
compati$le) system
1dvantages over R+PR/
1 &atalog information is e5ported along "ith the data
( &luster deletion and redefinition are not necessary during the import step
$ecause input dataset already contains catalog information
= 1lso since the dataset contains catalog information it can $e easily ported
to other systems 1n e5ported dataset has cross-system porta$ility
2ut +4P/R! % IMP/R! can $e used "ith :S1M datasets only and the dataset
created $y +4P/R! can have only a se3uential organi)ation !he dataset created $y
the +4P/R! step is not process-a$le until it has gone through a corresponding
IMP/R! step !hus performing an +4P/R!%IMP/R! ta#es up more time

Mainframe Refresher Part-1 Page:107

Synta5: +4P/R! entry-name /6!FI'+(ddname) % /6!-1!1S+!(dsname) -
optional parameters
+ntry-name is the name of the o$Qect that need to $e e5ported /6!FI'+ mention
e5ported into "hat name
+4P/R! - I7.I2I!S/6R&+T7/I7.I2I!S/6R&+
It specifies "hether the original data records (the data records of the source
cluster or alternate inde5) can $e accessed for any operation other than retrieval
after a copy is e5ported !his specification can later $e altered through the 1'!+R
command
I7.I2I!S/6R&+ (I7.S) - cannot $e accessed for any operation other than retrieval
7/I7.I2I!S/6R&+ - original data records in the original system can $e accessed for
any #ind of operation
+4P/R! - I7.I2I!!1RB+!(I7.!)%7/I7.I2I!!1RB+! (7I7.!)
It specifies ho" the data records copied into the target alternate inde5 or
cluster can $e accessed after they have $een imported to another system !he 1'!+R
command is used to alter this parameter
I7.I2I!!1RB+! - cannot $e accessed for any operation other than retrieval
7/I7.I2I!!1RB+! - !arget o$Qect can $e accessed for any type of operation after it
has $een imported into another system

+4P/R! - !+MP/R1R,TP+RM17+7!
It specifies "hether the cluster or alternate inde5 to $e e5ported is to
$e deleted from the original system
!+MP/R1R, specifies that the cluster or alternate inde5 is not to $e deleted
from the original system !he o$Qect in the original system is mar#ed as temporary
to indicate that another copy e5ists and that the original copy can $e replaced
P+RM17+7! specifies that the cluster or alternate inde5 is to $e deleted from
the original system Its storage space is freed If its retention period has not yet
e5pired8 you must also code P6RB+ P+RM17+7! is the default
+4P/R! - +R1S+T7/+R1S+
!his specifies "hether the data component of the cluster or alternate inde5 to
$e e5ported is to $e erased or not (over"ritten "ith $inary )eros)
0ith +R1S+ specification8 the data component is over"ritten "ith $inary )eros
"hen the cluster or alternate inde5 is deleted
0ith 7/+R1S+ specification8 the data component is not over"ritten "ith
$inary )eros "hen the cluster or alternate inde5 is deleted
+5ample:
%%+4P/R! +4+& PBMCI-&1MS
%%--( -- -S7CSMS4'JM'I2*S-S21&*6P(L^)8
%% -ISPC(7+08&1!'B8-+'+!+)867I!C!1P+8
%% :/'CS+RC1(1(1(8'12+'C(18S')8
%% -&2C(R+&FMCF28'R+&'CJ>)

Mainframe Refresher Part-1 Page:108

%%S,SI7 -- ?
+4P/R! 1(>>>'I2*S-S&'6S!+R -
/6!FI'+ (--()
%?
I-&1MS - IMP/R! command
!he IMP/R! command restores the dataset from a $ac#up copy created $y
the +4P/R! command !he I7FI'+ parameter specifies the --71M+ that refers to
the $ac#up copy created $y the +4P/R! command
IMP/R! I7FI'+(ddname)% I7-1!1S+!(dsname) -
/6!FI'+(ddname) % /6!-1!1S+!(dsname) -
optional parameters
IMP/R! - I7!/+MP!, (I+MP!,)
0hen this parameter is specified8 a previously e5ported dataset can $e
imported into an empty previously defined cluster If this parameter is not specified
an attempt to import into an empty dataset "ill fail
IMP/R! - /2P+&!S
0hen the /2P+&!S parameter is coded the attri$utes of the ne" target
dataset can $e changed !hese attri$utes include :/'6M+S and *+,R17B+S
I-&1MS-:+RIF, &ommand
If a Qo$ terminates a$normally and a :S1M dataset is not closed8 the catalog
entry for the dataset is flagged to indicate that the dataset may $e corrupt(as the
end of file or last #ey is not updated in the inde5 properly) In such case you "ould
get :S1M status code of <OI; in the open of the file in the program 2efore the
dataset can $e opened again8 the :+RIF, command must $e used to correctly
identify the end of the dataset and reset the catalog entry 1lternate solution is open
the file in File-aid in edit mode and Qust save it It "ould update the inde5 "ith end of
file
Model synta5 for the :+RIF, command:
:+RIF, WFI'+(ddnameR%pass"ordS) T -1!1S+!(entrynameR%pass"ordS)X
2ase cluster and alternate inde5 can $e verified !he verification of $ase cluster does
not verify its alternate inde5es so each one of them must $e treated separately
I-&1MS - 1'!+R &ommand
!he 1'!+R command is used to change many of the attri$utes of an e5isting
:S1M dataset It is easier doing it this "ay than to delete the old dataset and to
redefine it "ith the ne" attri$utes If the latter method is used the data "ill have to
$e $ac#ed up $efore deletion to preserve the records in it and restored after
reallocation
It is important to note that all the attri$utes cannot $e changed "ith 1'!+R
Fe" parameters that can;t $e altered are: &ISU8 !ype of &luster8
IM2+-%R+P'I&1!+8 R+6S+%7/R+6S+
Synta5: 1'!+R entry-name parameters

Mainframe Refresher Part-1 Page:109

Fre3uently 1'!+R is used for renaming (7+071M+)8 altering free space
(FR++SP1&+)8 temporarily disa$ling updates over dataset (I7.I2I!) and e5tend the
generation limit of B-B ('IMI!)
+5ample
P&' for an 1MS Qo$ "ith comments that runs an 1'!+R command
%%SMS4'JM1 P/2 (=MA1()8YMuthuY87/!IF,C9S,S6I-
%%7+071M+ +4+& PBMCI-&1MS
%%S,SPRI7! -- S,S/6!C?
%%S,SI7 -- ?
1'!+R MM>1&6S!/M+RM1S!+R N
7+071M+(MM>1&6S!M1S!) %? &.17B+ 71M+ ?% -
FR++SP1&+(1> 1>) %? &.17B+ FR++SP1&+ 1''/&1!I/7 ?%
%?
S,SI7 for 1dding candidate :olumes
1'!+R -
+MP'/,++*S-S-1!1 -
1--:/'6M+S (:S1M>=)
I-&1MS - M/-1' &/MM17-S
Functional commands are used to perform function Modal commands are
used to test and S+! the condition codes returned $y the functional commands
'1S!&& contains the return-code of the last e5ecuted functional command
and if more than one functional command is e5ecuted in single I-&1MS step8 then
M14&& contains the ma5imum value of condition codes from the previously
e5ecuted functional commands M14&& is returned as step return code in P&'
S+! command is used to reset the M14&& or '1S!&& "ithin 1MS
IF-!.+7-+'S+ statements are used to control the command e5ecution
se3uence
In the $elo" e5ample8 R+PR/ command loads data from a se3uential dataset
on to a *S-S /nly if the condition code of the R+PR/ step is )ero8 the ne5t 'IS!&1!
step "ill $e e5ecuted /ther"ise the *S-S "ill $e deleted M14&& is set to )ero at
the end to avoid non-)ero return code
%%S,SI7 -- ?
R+PR/ I7-1!1S+!(SMS4'JM-1!1!+S!) -

Mainframe Refresher Part-1 Page:110

/6!-1!1S+!(SMS4'JM!+S!*S-S) -
IF '1S!&& C > -
!.+7 -
'IS!&1! -
+7!RI+S(SMS4'JM!+S!*S-S) 1''
+'S+ -
-+'+!+ SMS4'JM!+S!*S-S
+7--IF
S+! M14&&C>
%?
I&1MS step Return codes and meaning
+rror
&ode
Severity
of +rror
Meaning
> 7o +rror Functional command completed its processing successfully
K Minor
+rror
Processing is a$le to continue8 $ut a minor error occurred8 causing
a "arming message to $e issued
J MaQor
+rror
Processing is a$le to continue8 $ut a more severe error occurred8
causing maQor command specifications to $e $ypassed
1( 'ogical
+rror
Benerally8 inconsistent parameters are specified8 causing the
entire command to $e $ypassed
1M Severe
+rror
1n error of such severity occurred that not only can the command
causing the error not $e completed8 the entire 1MS command
stream is flushed
1'!+R71!+ I7-+4
7eed for 1I4
1 *S-S dataset is currently accessed using a primary #ey 0e "ant to access
the dataset R17-/M', "ith another #ey
( 0e "ant to access +S-S file R17-/M', $ased on #ey
Steps Involved
Step1 -efine 1I4
-+FI7+ 1'!+R71!+I7-+4 command defines an alternate inde5 Important
parameters of this command are:
Parameter Meaning
R+'1!+ Relates 1I4 "ith $ase cluster

Mainframe Refresher Part-1 Page:111

7/767IV6+%
67IV6+
-uplicates are allo"ed % not allo"ed in alternate #ey
*+,S -efines the length and offset of alternate #ey in $ase cluster
6PBR1-+ 1dds the 1I4 cluster to the upgrade set of $ase cluster 0henever
$ase is modified8 its upgrade set is also modified 6PBR1-+ is
default 7/6PBR1-+ didn;t add the 1I4 to $ase cluster upgrade set
R+&/R-SIU+ Specifies the record si)e of alternate inde5 record It is calculated
using the formula in the ne5t ta$le
1I4 Record Si)e &alculation:
67IV6+ 1lternate *ey 7/767IV6+ 1lternate *ey "ith
ma5imum n duplicates
*S-S AL1lternate *ey length
LPrimary *ey 'ength
AL1lternate *ey length
L(n ? Primary *ey 'ength)
+S-S AL1lternate *ey length
LR21 si)e
(R21 si)e C K $ytes)
AL1lternate *ey length
L(n ? R21 si)e )
(R21 si)e C K $ytes)

Five 2yte control information of 1lternate Inde5 Record:
2yte-1 !ype of &luster@ 4;>>; indicates +S-S and 4;>1; indicates *S-S
2yte-( 'ength of $ase cluster pointers in alternate inde5@ Primary #ey
length for *S-S and 4;>K; for +S-S
2yte-=
2yte-K
.alf "ord $inary indicates num$er of occurrences of primary #ey pointers
in alternate inde5 record 4;>>>1; for uni3ue alternate #ey
2yte-A 'ength of alternate #ey

Step( 2'-I7-+4
1lternate inde5 should have all the alternate #eys "ith their corresponding
primary #ey pointers 1fter the 1I4 is defined8 this information should $e loaded from
$ase cluster !hen only "e can access the records using 1I4 2'-I7-+4 do this '/1-
operation
Important parameters of this command are:
1 I7FI'+ and /6!FI'+ points to 2ase &luster and 1lternate inde5 &luster
( I7!+R71'S/R!8 +4!+R71'S/R!8 0/R*FI'+S:
'oaded 1I4 should have sorted alternate record #eys "ith $ase cluster
#eys So an intermediate S/R! is re3uired in $et"een reading the $ase cluster and
loading the 1I4 0e should allocate "or# datasets I-&6!1 and I-&6!( for this
S/R!

Mainframe Refresher Part-1 Page:112

If I7!+R71'S/R! parameter is coded8 then 1MS tried to do internal sort if
enough memory is availa$le and it "ould $e fast If enough space is not availa$le8
then if you have coded I-&6!1 and I-&6!(8 it uses that space and does an e5ternal
sort
If you code +4!+R71'S/R! parameter8 then 1MS "ont try for internal sort
If you "ant to give your o"n --71M+ files for sorting instead I-&6!1 and
I-&6!(8 inform it to 1MS $y 0/R*FI'+(--71M+18 --71M+() parameter .ere8
--71M+1 and --71M+( are allocated instead of I-&6!1 and I-&6!(
Step= -efine Path
!he -+FI7+ P1!. command esta$lishes a $ridge $et"een the $ase cluster and an
alternate inde5 It does not occupy any space It is Qust a catalog entry8 "hich
esta$lishes a lin# $et"een an alternate inde5 and a $ase cluster Important
parameters of this command are:
1 P1!.+7!R, command relates P1!. "ith 1I4
( 0hen you open a P1!.8 respective $ase cluster "ill automatically $e opened
6P-1!+ opens the 6PBR1-+ set of the $ase cluster also and it is default
7/6P-1!+ opens only the $ase cluster and not its the 6PBR1-+ set
In 21!&.8 if you "ant to access $ase cluster "ith alternate #ey8 you should
allocate the P1!. in the P&' !he name of the --71M+ for the P1!. in P&' is
--71M+ of the $ase cluster suffi5ed "ith 1 for first alternate #ey and n for nth
alternate #ey Refer the &/2/' material for more information
In &I&S8 if you "ant access $ase cluster "ith alternate #ey8 then you should
register the P1!. as F&! entry
+5ample:
1&ommand that defines an alternate inde5
-+FI7+ 1I4 ( 71M+(MM1(+MPM1S!SS71I4) -
R+'1!+(MM1(+MPM1S!) -
*+,S(O 1() -
67IV6+*+, -
6PBR1-+ -
R+6S+ -
:/'6M+S(MPSJ>>) ) -
-1!1 ( 71M+(MM1(+MPM1S!SS71I4-1!1) -
&,'I7-+RS(1 1) ) -

Mainframe Refresher Part-1 Page:113

I7-+4 ( 71M+(MM1(+MPM1S!SS71I4I7-+4) )
(&ommand that defines P1!.
-+FI7+ P1!. ( 71M+(MM1(+MPM1S!SS7P1!.) -
P1!.+7!R,(MM1(+MPM1S!SS71I4) -
6P-1!+ )
=1 Qo$ that $uilds an alternate inde5
%%MM>1'&= P/2 (=MA1()8YM6!.6Y87/!IF,C9S,S6I-
%%2'-I7-4 +4+& PBMCI-&1MS
%%S,SPRI7! -- S,S/6!C?
%%I-&6!1 -- 67I!CS,S-18:/'CS+RCMPSJ>>8-ISPC/'-
%%I-&6!( -- 67I!CS,S-18:/'CS+RCMPSJ>>8-ISPC/'-
%%S,SI7 -- ?
2'-I7-+4 I7-1!1S+!(MM1(+MPM1S!) -
/6!-1!1S+!(MM1(+MPM1S!SS71I4) -
&1!1'/B(MM1()
%?
!he order of $uild inde5 and definition of P1!. does not matter
1MP Parameter in P&'
!he 1ccess Method Parameter (1MP) completes information in an 1ccess
method &ontrol 2loc# (1&2) for a :S1M data set
!he 1&2 can $e coded for a #ey-se3uenced (*S-S)8 entry-se3uenced (+S-S)8
or relative record (RR-S) :S1M data set 1MP is only supported for :S1M data sets
1MP is most often used to allocate I%/ $uffers for the inde5 and data components for
optimi)ing performance
Synta5: 1MPC(su$ parameter8 su$ parameter8)
or
1MPC(Ysu$ parameter8 su$ parameter8Y)

Mainframe Refresher Part-1 Page:114

Single apostrophes are re3uired if the su$ parameter(s) contain special characters
1M/RB
!his parameter8 "hich stands for 1ccess Method /RBani)ation8 indicates that
the particular -- statement refers to a :S1M dataset
26F7-
!his parameter gives the num$er of I%/ $uffers needed for the data
component of the cluster !he si)e of each $uffer is the si)e of the data &I
!he default value is t"o data $uffers one of "hich is used only during &I%&1 splits
!herefore the num$er of data $uffers left for normal processing is one
If more data $uffers are allocated8 then performance of se3uential processing "ill
improve significantly
26F7I
!his parameter gives the num$er of I%/ $uffers needed for the inde5
component of the cluster +ach $uffer is the si)e of the inde5 !his su$-parameter
may $e coded only for a *S-S $ecause +S-S and RR-S do not have inde5
components !he default value is one inde5 $uffer
If more inde5 $uffers are allocated8 then performance of random processing
"ill improve significantly
26FSP
!his parameter indicates the num$er of $ytes for data and inde5 component
$uffers If this value is more than the value given in the 26FF+RSP1&+ parameter of
the -+FI7+ &'6S!+R8 it overrides the 26FF+RSP1&+ /ther"ise 26FF+RSP1&+ ta#es
precedence !he value of 26FSP is calculated as
26FSP C -1!1 &ISIU+ 5 26F7- L I7-+4 &ISIU+ 5 26F7I
.o"ever it is recommended not to code this parameter and let :S1M perform the
calculations from the 26F7- and 26F7I values instead
/ther parameters are !R1&+8 S!R7/8 R+&FM8 /P!&-8 &R/PS
If SMS is active8 then :S1M datasets can $e created in P&' "ithout using I-&1MS as
$elo":
%%*S-SFI'+ -- -S7C-+:I&6S!M1S!+R8-ISPC(7+08&1!'B8-+'+!+)8
%% SP1&+C(&,'8(1>81>))8
%% 'R+&'C1>>8*+,/FFC1>8*+,'+7C1(8R+&/RBC*S
R+&/RB can also $e +S(for +ntry Se3uenced -atasets)8 RR(for Relative Record
datasets) and 'S(for 'inear -atasets) /ther parameters of -+FI7+ &'6S!+R "ill $e
assigned default values or you can additionally mention SMS parameter8 -1!1&'1SS
that is defined "ith predefined values

Mainframe Refresher Part-1 Page:115

-ata2ase (
-2(

Mainframe Refresher Part-1 Page:116

-2( (-ata$ase ()
.istory
I2M;s first data$ase is IMS !his is a hierarchical data$ase I2M introduces its second
$ase on relational concepts in 1OJ>s and it is called as -ata$ase ( (-2()
1dvantage of -2MS over File Management System
1Increased Independency
If a ne" field is added to a file8 the layout of the file should $e changed in all
the programs "ith ne" field8 though the programs do not use this field 2ut if a ne"
column is added to a ta$le8 it does not need any program change8 as long as the
programs do not need this field !hus programs using -ata$ases are developed
independent of physical structure
('ess Redundancy
In file system8 the same data is stored in multiple files to meet the
re3uirements of different applications In -2(8 "e can store the common information
in one ta$le and ma#e all the applications to share it 2y means of centrali)ed control
and storing the fact at the right place and only once8 data redundancy is reduced
=Increased &oncurrency and Integrity
&oncurrency allo"s more than one tas# to share a resource concurrently
Integrity is defined as validity or correctness of data In file system8 if a file is
allocated "ith /'- disposition8 then no other program can use it -2( allo"s more
than one tas# to use the same ta$le in update mode 1t the same time8 integrity of
data is ensured $y its sophisticated loc#ing strategy
KImproved Security
In file system8 all the records in the file are su$Qected to a specific access
right !he access cannot $e controlled at field level or set level 2ut in -2(8 "e can
restrict access on column level and set level
!ypes of -ata$ase
.ierarchical Relation $et"een entities is esta$lished using parent-child
relationship-Inverted !ree Structure-!his is the first logical model of -2MS -ata
stored in the form of S+BM+7!S +5ample: IMS
7et"or# 1ny entity can $e associated "ith any other entity So
distinguishing $et"een parent and child is not possi$le !his is a lin#ed structure
model -ata stored in R+&/R- and different record types are lin#ed $y S+!S
+5ample: I-MS
Relational In mathematical terms8 relation is !12'+ -ata is stored in the form of
ta$les consists of !uples (ro"s) and attri$utes (columns)
+5ample: -2(

Mainframe Refresher Part-1 Page:117

DB2 ObB!6(
!here are t"o types of elements or o$Qects in -2(
System /$Qects: o$Qects that are controlled and used $y -2(
+5ample: -2( -irectory8 -2( catalog8 1ctive 9 1rchive logs8 2oot Strap -ataset
(2S-S)8 2uffer Pools8 &atalog visi$ility -ata$ase and 'oc#s
-ata /$Qects: /$Qects that are created and used $y the users
+5ample: !a$les8 Inde5es8 :ie"s8 !a$le spaces8 -ata$ases8 Storage Broups
DB2 ObB!63Sora>! $ro<=
Storage group is a collection of direct access volumes8 all of the same type
-2( o$Qects are allocated in Storage group 1 storage group can have ma5imum 1==
volumes
Storage
Broup 1
-2( /$Qect-!a$le Space
!a$le Spaces are the physical space "here the ta$les are stored !here are
three types of ta$le spaces
Simple !a$le Space:
More than one ta$le is stored in the ta$le space and single page can contain
ro"s from all the ta$les
Segmented !a$le Space:
Segment is logically contiguous set of n pages "here n is defined $y S+BSIU+
parameter of !12'+SP1&+ definition !a$les are stored in one or more segments
Mass delete and se3uential access are faster in Segmented type ta$le space
Reorgani)ation "ill restore the ta$le in its clustered order 'oc# ta$le command loc#s
only the ta$le and not the ta$le space

Page 1 Page ( Page =
+abl!1 F Ro;1
+abl!2 F Ro;1
+abl!2 F Ro;2
+abl!1 F Ro;2
+abl!1 F Ro;3
+abl!3 F Ro;1
+abl!3 F Ro;2
+abl!1 F Ro;4
+abl!2 F Ro;3
Segment 1 Segment ( Segment =
+abl!1 F Ro;1
+abl!1 F Ro;2
+abl!1 F Ro;3
+abl!2 F Ro;1
+abl!2 F Ro;2
+abl!2 F Ro;3
+abl!1 F Ro;4
+abl!1 F Ro;5
+abl!1 F Ro;6

-1S->>1


-1S->>(


-1S->>=

Mainframe Refresher Part-1 Page:118

Partitioned !a$le Space:
/nly one ta$le can $e stored 1-MK partitions are possi$le in ta$le space
76MP1R! of !12'+SP1&+ definition decides the partitions It is partitioned "ith value
ranges for single or com$ination of columns and these columns cannot $e updated
Individual partitions can $e independently recovered and reorgani)ed -ifferent
partitions can $e stored in different groups
DB2 ObB!63Daaba(!
It is not a physical o$Qect It is a logical grouping consists of !a$le spaces8
Inde5 spaces8 :ie"s8 !a$les etc 0henever you create an o$Qect you have to
e5plicitly say "hich -ata$ase it $elongs to or -2( implicitly assigns the o$Qect to the
right data$ase
In the creation of ta$le8 "e should say in "hich data$ase and in "hich ta$le
Space "e are housing the ta$le (e5plicitly) In creating an inde58 "e mention only
the ta$le name -2( decides the data$ase from the $ase ta$le name
It can also $e defined as a unit of start and stop !here can $e a ma5imum of
MA8(IO data$ases in a -2( Su$system
DB2 ObB!6 3 +abl!
!a$le is a structure consists of num$er of columns and ro"s It is created
using the --' &R+1!+ !12'+
Physical hierarchy:
R/0I- is a pointer to data record in the page
It is a K$yte field (= $ytes for page and 1 $yte for line in the page)
Page consists of 1 to 1(I data records It is the unit of I-/
!a$le space consists of pages and it is stored in S!/BR/6P
-ata$ase consists of one or more ta$le space and other related o$Qects
DB2 ObB!63 'nd!4
Benerally8 Inde5 is used to access a record 3uic#ly !here are t"o types of
Inde5es: &lustering and 7on-&lustering If there is a &lustered inde5 is availa$le for
a ta$le8 then the data ro"s are stored on the same page "here the other records
"ith similar inde5 #eys are already stored on !here can $e only one cluster inde5 for
a ta$le Refer the diagram in the ne5t page for $etter understanding of clustered and
non-clustered inde5es
6nderstanding: Root Page8 'eaf Page and 7on-'eaf page
Referring to :S1M $asics8 se3uence set has direct pointers to control interval
and last level inde5es have pointers to se3uence set and higher-level inde5es have

Partition 1 Partition ( Partition =
+abl!1 F Ro;1
+abl!1 F Ro;2
+abl!1 F Ro;3
+abl!1 F Ro;4
+abl!1 F Ro;5
+abl!1 F Ro;6
+abl!1 F Ro;7
+abl!1 F Ro;8
+abl!1 F Ro;9
Mainframe Refresher Part-1 Page:119

pointers to lo"er level inde5es and there is one root inde5 from "here the 2-tree
starts
Similarly 'eaf-pages contain full #eys "ith ro"-ids that points to data page (Ro" id
has page num$er and line num$er) 7on-leaf pages have pointers to leaf pages or
lo"er level non-leaf pages and the root page has pointer to first level non-leaf pages
:ie" of clustered inde5 N -iagram
Root Page
7on-'eaf Pages
'eaf Pages
-ata Pages
:ie" of 7on-clustered inde5 N -iagram (non-leaf pages and data pages are sho"n)
DB2 ObB!63'nd!4 S=a6!
6nli#e ta$le spaces8 Inde5 spaces are automatically created "hen inde5es are
created Inde5es are stored in inde5 spaces
DB2 ObB!6 3 Al)a( & S:non:m
1lias and Synonym are alternate name for a ta$le !he main differences
$et"een them are listed $elo":
S,7/7,M 1'I1S
Private o$Qect /nly the user "ho
created it8 can access it
Blo$al o$Qect 1ccessi$le $y anyone
6sed in local environment to hide
the high level 3ualifier
6sed in distri$uted environment to hide the
location 3ualifier
0hen the $ase ta$le is dropped8
associated synonyms are
automatically dropped
0hen $ase ta$le is dropped8 aliases are not
dropped
S,S1-M authority is not needed !o create an alias8 "e need S,S1-M

?(A ?A>
?I ?1I ?(A
?=> ?K( ?A>
?1 ?= ?I

?11 ?1= ?1I ?1O ?(> ?(A
Records for
#eys 1 = I
Records for
#eys 11 1=
1I
Records for
#eys 1O (>
(A
?1 ?= ?I

?11 ?1= ?1I ?1O ?(> ?(A
Records for
#eys 1 =
(>
Records for
#ey I 11
1O
Records for
#eys 1= 1I
(A
Mainframe Refresher Part-1 Page:120

authority or &R+1!+1'I1S privilege
DB2 ObB!63-)!;
:ie"s provide an alternative "ay of loo#ing at the data in one or more ta$les
1 vie" is a named specification of a result ta$le For retrieval8 all vie"s can $e used
li#e $ase ta$les Ma5imum 1A $ase ta$les can $e used in a vie"
AdDana>!( o* D)!;
1-ata security: :ie"s allo"s to set-up different security levels for the same $ase
!a$le Sensitive columns can $e secured from the unauthori)ed Ids
(It can $e used to present additional information li#e derived columns
=It can $e used to hide comple5 3ueries -eveloper can create a vie" that results
from a comple5 Qoin on multiple ta$les 2ut the user can simply 3uery on this vie"
as if it is a separate $ase ta$le8 "ithout #no"ing the comple5ity $ehind the $uilding
KIt can $e used for domain support -omain identifies a valid range of values that a
column can contain !his is achieved in :I+0 using 0I!. &.+&* /P!I/7
R!ad Onl: -)!;(
:ie"s on "hich I7S+R!8 6P-1!+ and -+'+!+ operations cannot $e carried
out8 are called non-updatea$le vie"s or read only vie"s
%@ara6!r)()6( o* .=da!abl! D)!;(
1It should $e derived from one $ase ta$le and should not contain derived columns
(:ie"s should not contain BR/6P 2,8 .1:I7B and -IS!I7&! clauses at the
outermost level
=:ie"s should not $e defined over read-only vie"s
K:ie" should include all the 7/! 76'' columns of the $ase ta$le
DB2 ObB!63 %aalo>
It is a data dictionary for -2(8 supporting and maintaining data a$out the
-2( environment It consists of AK ta$les in the system data$ase -S7-2>M
!he data in -2(8 a$out the data in the ta$les are updated "hen R67S!1!S utility
runs !he information in the -2( catalog ta$le can $e accessed using SV'
DB2 ObB!63 D)r!6or:
!his is second data dictionary of -2( and used for storing detailed8 technical
information a$out the aspects of -2(;s operation It is for -2( internal use only
It cannot $e accessed using SV' statements It is stored in the system data$ase
-S7-2>1
DB2 ObB!63 A6)D! and Ar6@)D! &o>(
-2( records all the data changes and significant events in active logs as and
"hen they occur In case of failure8 it uses this data to recover the lost information
0hen active log is full8 -2( copies the content of active log to a -1S- or magnetic
tape data set called archive log
DB2 ObB!63 Boo Sra= Daa(!
It stores the inventory of all-active and all-archive logs -uring installation of

Mainframe Refresher Part-1 Page:121

-2(8 t"o 2S-S are created and #ept in different volumes 2S-S datasets are :S1M
*S-S
DB2 ObB!63B<**!r #ool(
2uffer Pools are virtual storage area8 "hich -2( uses for its temporary
purpose !here are fifty K* $uffer pools and ten =(* $uffer pools in -2(
-2( -efault $uffers are 2P>8 2P18 2P( and 2P=(
#ro>ram #r!=ara)on
SV' (Structured Vuery 'anguage) is the language that is used to
Retrieve % update % delete -2( data SV' statements are em$edded into &/2/'
Program "ithin the scope of <+4+& SV' and +7--+4+&;
-2( Program is first feed to -2( Pre compiler that e5tracts the -2(
statements into -2RM and replace the source program -2( statements "ith &/2/'
&1'' statements !his modified source is passed to &/2/' compiler and then lin#
editor to generate load module -uring pre compilation8 time stamp to#en is placed
on modified source and -2RM
/n the other side8 -2RM undergoes $inding process and -2( /ptimi)es
chooses the $est access path for the e5tracted SV' statements and store it in P'17
#lan and #a6Aa>!
2inding process can happen in t"o stages8 2I7- P1&*1B+ and 2I7- P'17
/ne -2RM is created for one program If the main program calls n num$er of
Su$-programs8 then there "ill $e n -2RMS in addition to main program -2RM
!hese n L 1 -2RM can $e directly feed to 2I7- P'17 to produce a single
P'17 or create m num$er of intermediate pac#ages each formed $y one or more
-2RM !his m num$ers of pac#ages are then feed to 2I7- P'17 step that produces
P'17 Pac#age is not e5ecuta$le $ut Plan is e5ecuta$le !o run a -2( Program8 Plan
is mandatory
1dvantages of Pac#age:
10hen there is a change in su$ program8 it is enough to recompile
the su$program and create the P1&*1B+ for that su$ program !here is no need
for 2I7- P'17
('c# options and various $ind options can $e controlled at su$-program
level
=It avoids the cost of large $ind
KIt reduces Re$ound time
A:ersioning: Same pac#age can $e $ounded "ith multiple programs "ith
different collection I-s
E4!6<)on o* DB2 #ro>ram
-2( Program is e5ecuted using terminal monitor program I*P+F!>1
It can $e e5ecuted using I*P+F!11 or I*P+F!12 also !hey are alternate entry points
of I*P+F!>1-2( region name8 program to run8 -2( plan and P1RM (if needed) are
provided in the S,S!SI7 card of I*P+F!>1
%%S!+P +4+& PBMCI*P+F!>1
%%S,SPR7! -- S,S/6!C?
%%S,S!SI7 -- ?
-S7 S,S!+M(-S!() CC G In -2( test region -S!(
R67 PR/BR1M(pgmname) P'17(planname) CC G +5ecute the program

Mainframe Refresher Part-1 Page:122

'I2(<loadli$rary) CC G "hose load module is here^
+7-
%?
Program Preparation in -etail
&/2/'--2( PR/BR1M
-&'B+7 'i$rary (S,SI7) Pre-compiler /ptions
(S,S'I2) (P1RM)
Modified Source (S,S&I7)? -ata$ase Re3uest
Modules (-2RM)?
&/P,2//* 'i$rary
(S,S'I2)
&/MPI'+R /ptions
(P1RM)
/$Qect Module
(S,S'I7) 2I7-
S62R/6!I7+ 'i$rary P1R1M+!+RS
(S,S'I2) (S,S!SI7)
'in# +dit /ptions
(P1RM) '17
'oad Module ? P'17 ?
(S,S'M/-)
? !ime Stamp to#en is passed from pre-compilation stage to 'oad module and Plan
0hen first time the plan is accessed8 the time stamp of plan is verified against
the time stamp of load module If they match8 then ta$le "ill $e accessed using the
access path in P'17 and proceed further If they don;t match8 then the program
a$normally ends "ith SV'&/-+ of NJ1J It means the load module and plan are out
of sync It usually occurs if "e modify the program and pre-compile8 compile and lin#
edit $ut did not $ind the plan "ith latest -2RM produced in pre-compilation stage

-S7.P&
-2( pre-compiler
IB,&R&!'
&/2/' &/MPI'+R
I*P+F!>1
(2I7- P1&*1B+)
I*P+F!>1
(2I7- P'17)
I+0'
'I7* +-I!/R
Mainframe Refresher Part-1 Page:123

!here is a modification in &/2/' part !here is no change in any of the -2(
statements in the program Is $inding necessary]
,es It is necessary For &/2/' changes8 "e have to compile and lin# edit
For compilation "e need pre-compiled source So ne" time stamp is transferred to
your load module from the pre-compilation stage If "e don;t 2I7- it8 timestamp
mismatch is o$vious and the program "ill a$normally end
&an this time stamp chec# $e avoided]
If the program pre-compiled "ith '+:+' option8 then there "on;t $e time stamp
verification 2ut this option is not generally recommended
2ind &ard
2I7- P1&*1B+ su$ command is used to $ind a -2RM to a pac#age and 2I7-
P'17 is used to $ind a -2RM to a plan or group of pac#ages to a P'17
Sample 2ind &ard:
%%2I7- +4+& PBMCI*P+F!>1
%%S,S!SPR! -- S,S/6!C?
%%S,S!SI7 -- ?
-S7
2I7- P'17(+MPP'17)
M+M2+R(+MP-2RM)
:1'I-1!+(2I7-)
IS/'1!I/7(&S)
R+'+1S+(&/MMI!)
/07+R(SMS4'JM)
'I2(<SMS4'JM-2(-2RM'I2;)
%?
2ind Parameter N M+M2+R and 'I2R1R,
-2RM to $e $ound is given in M+M2+R and the partitioned dataset containing
the -2RM is given in 'I2 -uring 2I7- Pac#age8 if an e5isting pac#age is used to
create the ne" pac#age then8 &/P, should $e mentioned instead of M+M2+R and
'I2R1R,
&/P,(collection-idpac#age-id)
&/P,:+R(version-id) N version of the copy to $e used -efault is empty if omitted
2ind Parameter N P*'IS!
P*'IS! is a 2I7- parameter of 2I7- P'17 Pac#ages to $e connected "ith
P'17 are named here P*'IS! (&/''1?) $ound all the pac#ages "ith collection I-
&/''1 to the P'17
Pac#age 7aming N &ollection-I- and :ersioning
Pac#ages have three 3ualifiers 'ocation I- is used in distri$uted
environment &ollection I- is used for grouping of pac#ages
7aming Synta5: 'ocation-id &ollection-id Pac#age-name
:+RSI/7 0ith pac#ages8 the pre-compiler option :+RSI/7 can $e used to $ind
multiple versions of the programs into pac#age
PR/B-------- G Pre-compile ----------- 2I7- Pac#age --------&/''1PR/B!+S!

Mainframe Refresher Part-1 Page:124

0ith :+RSI/7(!+S!)
-------- G Pre-compile ----------- 2I7- Pac#age --------&/''1PR/BPR/-
0ith :+RSI/7(PR/-)
2ind Parameter N 1&!I/7
Pac#age or Plan can $e an addition or replacement -efault is replacement
R+P'1&+ "ill replace an e5isting pac#age "ith the same name8 location and
collection R+P':+R(version-id) "ill replace a specific version of an e5isting pac#age
1-- N 1dd the ne" pac#age to S,SI2MS,SP1&*1B+
Synta5: 1&!I/7(1--TR+P'1&+)
2ind Parameter N Isolation 'evel
!he isolation level parameter of the 2I7- command descri$es to "hat e5tent a
program $ound to this pac#age can $e isolated from the effects of other programs
running !his determines the duration of the page loc#
&6RS/R S!12I'I!, (&S)N 1s the cursor moves from the record in one page to the
record in ne5t page8 the loc# over the first page is released (provided the record is
not updated) It avoids concurrent updates or deletion of ro" that is currently
processing It provides 0RI!+ integrity
R+P+1!12'+ R+1- (RR) N 1ll the loc#s ac3uired are retained until commit point
Prefer this option "hen your application has to retrieve the same ro"s several times
and cannot tolerate different data each time It provides R+1- and 0RI!+ integrity
67&/MMI!!+- R+1- (6R) N It is also #no"n as -IR!, R+1- It can $e applied only
for retrieval SV' !here are no loc#s during R+1- and so it may read the data that is
not committed .ighly dangerous and use it "hen concurrency is your only
re3uirement It finds its great use in statistical calculation of the large ta$le and
data-"arehousing environment
2ind Parameter N 1&V6IR+ and R+'+1S+
1&V6IR+(6S+) and R+'+1S+(&/MMI!) N -2( imposes ta$le or ta$le space
loc# "hen it e5ecutes an SV' statement that references a ta$le in the ta$le space
and it release the ac3uired loc# on &/MMI! or R/''21&* !his is the default option
and provides greater concurrency
1&V6IR+(6S+) and R+'+1S+(-+1''/&1!+) N 'oc#s ta$le and ta$le spaces on
use and releases "hen the plan terminates
1&V6IR+(1''/&1!+) and R+'+1S+(-+1''/&1!+) N 0hen -2( allocates the
program thread8 it imposes loc# over all the ta$les and ta$le spaces used $y the
program !his option avoids deadloc#s $y loc#ing your source at the $eginning $ut it
reduces concurrency
1&V6IR+(1''/&1!+) and R+'+1S+(&/MMI!) is 7/! 1''/0+- !his
increases the fre3uency of deadloc#s
2ind Parameter N SV'+RR/R

Mainframe Refresher Part-1 Page:125

It says "hether to create the pac#age in case of SV' errors
SV'+RR/R (7/P1&*1B+) N -efault - If there is any SV' error8 pac#age "ill not $e
created
SV'+RR/R (&/7!I76+) N &reate the Pac#age even if SV' errors are encountered
2ind Parameter N :1'I-1!+
It controls the handling of <o$Qect not found; and <not authori)ed; errors
-efault is :1'I-1!+ (R67) N If all o$Qects are found and all privileges are held8 then
don;t chec# once again at e5ecution time If there is any <privilege issue; or <o$Qect
not found; error8 then produce 01R7I7B messages8 $ind the pac#age and chec#
authori)ation and e5istence at e5ecution time
:1'I-1!+ (2I7-) N If there is any privilege or o$Qect-not-found issue8 then produce
+RR/R message and create the pac#age only if SV'+RR/R(&/7!I76+) is coded in
$ind card !he statement in error "ill not $e e5ecuta$le
2I7- Parameter N +4P'1I7
+4P'1I7(,+S) loads the access path selected $y the optimi)er in
P'17a!12'+ +4P'1I7(7/) is default and it "ont load any such details in
P'17a!12'+
2I7- Parameter N V61'IFI+R
Vualifiers are added at the $ind time to the o$Qects used in the program
It is suggested 7/! to use any 3ualifiers in the program and use this parameter
during 2I7- so that the program can $e easily promoted from one region to ne5t
region "ithout any change in program
R+2I7-I7B
0hen SV' statements are not changed $ut a ne" inde5 is added or
R67S!1!S is run8 then it is advisa$le to do a R+2I7- for the $est possi$le access
path R+2I7- P'17 is cheaper than 2I7- "ith 1&!I/7 (R+P'1&+)
S,S!SI7 &1R- should $e
R+2I7- P'17(P'17-71M+)
:1'I-1!+(2I7-)
Z

Mainframe Refresher Part-1 Page:126

.ost :aria$les
-2( is separate su$system 1s -2( data are stored in e5ternal address space8
you cannot directly modify or read from your program -uring read8 the -2( values
are retrieved into your "or#ing storage varia$les -uring update8 the -2( columns
are updated using your "or#ing storage varia$les !hese "or#ing storage varia$les
used for retrieving or updating -2( data should $e of same si)e of -2( columns
!hey are called as host varia$les as they are defined in the host language (&/2/')
.ost varia$les are prefi5ed "ith colon ( : ) in the em$edded SV'
-&'B+7 (-eclaration Benerator)
-&'B+7 is a -2( utility If "e provide ta$le details8 it "ill generate -2(
Structure and host varia$le structure of the ta$le It can also generate 76''
indicators for the 76'' columns !his output is stored in a P-S mem$er !hese
mem$ers are included in the program using the I7&'6-+ Fpds-mem$erG I7&'6-+
is a pre-compiler statement and so it should $e coded "ithin the scope of +4+& SV'
and +7--+4+&
-&' generated host varia$le names are same as -2( column names
1s underscore is not a valid character for varia$le names in &/2/'8 it is replaced $y
hyphen in host varia$le generation of -&'B+7 Prefi5 and suffi5 can $e added to all
the varia$les "hile creating the -&'B+7 copy$oo#
.ost varia$les can $e declared in "or#ing storage section 2ut they cannot $e
stored in copy$oo#s as other file layouts
I7&'6-+ is e5panded during pre-compilation time $ut &/P, is e5panded
during compilation and so declaration of host varia$le in copy$oo# "ill produce errors
during pre-compilation
-+&'1R+ !12'+8 that is ta$le structure of -&'B+7 is 7/! really needed for
pre-compilation 2ut if it is used8 then any misspelled ta$le name8 column names are
trapped in pre-compilation stage itself
-2( need not $e up during pre-compilation 1s pre-compiler Qust e5tracts the
-2( statements and produce -2RM8 it does not need -2( connection 2ut -2(
region should $e up for $inding as the optimi)er $uilds access path in this stage from
catalog information

Mainframe Refresher Part-1 Page:127

-&'B+7 Panel (/ption ( of -2(I)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
G G
G !S#E!P01 !C*GE# SSI!4 !S# G
G ===J G
G G
G E@teB t;EAe @;8e C?B K6>:6 9e:A;B;t>?@s ;Be BeLu>Be94 G
G 1 SO"RCE T+B*E #+ME ===J !S#,410'EMPT+B*E ("@Lu;A>C>e9 t;EAe @;8e) G
G & T+B*E O-#ER ===J (O=t>?@;A) G
G 3 +T *OC+TIO# ''''' ===J (O=t>?@;A) G
G G
G E@teB 9est>@;t>?@ 9;t; set4 (C;@ Ee seLue@t>;A ?B =;Bt>t>?@e9) G
G 4 !+T+ SET #+ME ''' ===J MSMSX*,2'!B&'I#C*"!E(EMPT+B*E) G
G / !+T+ SET P+SS-OR! ===J (IC =;ssK?B9 =B?te:te9) G
G G
G E@teB ?=t>?@s ;s 9es>Be94 G
G 2 +CTIO# '''''''''' ===J +!! (+!! @eK ?B REP*+CE ?A9 9e:A;B;t>?@) G
G 5 CO*"M# *+BE* '''' ===J #O (E@teB ES C?B :?Au8@ A;EeA) G
G , STR"CT"RE #+ME '' ===J (O=t>?@;A) G
G 0 FIE*! #+ME PREFIX ===J (O=t>?@;A) G
G 10 !E*IMIT !BCS '''' ===J ES (E@teB ES t? 9eA>8>t !BCS >9e@t>C>eBs) G
G 11 CO*"M# S"FFIX ''' ===J #O (E@teB ES t? ;==e@9 :?Au8@ @;8e) G
G 1& I#!IC+TOR V+RS '' ===J #O (E@teB ES C?B >@9>:;t?B I;B>;EAes) G
G G
G G
G PRESS4 E#TER t? =B?:ess E#! t? e<>t $E*P C?B 8?Be >@C?B8;t>?@ G
G G
GNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNG
-S7+O>AI +4+&6!I/7 &/MP'+!+8 M+M2+R +MP!12'+ 1--+-
-2( -ata !ypes and e3uivalent host varia$les
-2( &olumn 2ytes &/2/' PI& &lause 2ytes
SM1''I7! ( PI& SO(>K) &/MP (
I7!+B+R K PI& SO(>O) &/MP K
-+&IM1' (p8 3)
(P should $e less than =()
Int
(P%()
PI& SO(p-3):O(3) Integer
((PLV)%(
L1)
-1!+ K PI& 4(1>) J

Mainframe Refresher Part-1 Page:128

!IM+ = PI& 4(>J) M
!IM+S!1MP 1> PI& 4((M)
yyyy-mm-dd-hhmmssnnnnnn
(M
&.1R(n) (nC1 to (AK) 7 PI& 4(n) 7
:1R&.1R(n) (nC>-K>KM) 7 >1 0S-&/'6M7
KO 0S-&/'6M7-'+7B!. PI& SO(>K)
&/MP
KO 0S-&/'6M7 N!+4! PI& 4(n)
7L(
'imit of -ate: Pan 1
st
1 ad N -ec =1
st
OOOO 1-
'imit of !ime: >>>>>> N (K>>>>
'imit of !ime Stamp: >>>1>1>1>>>>>>>>>>>> N >>>>1(=1(K>>>>>>>>>>
SV'&1
SV'&1 is SV' &ommunication area It is a -2( copy$oo# that should $e
included in all the -2( programs !he fields declared in the copy$oo# are updated for
every -2( 3uery !he 'ength of SV'&1 is 1=M !he most important field in this
copy$oo# is SV'&/-+ !he success or failure of -2( 3uery can $e chec#ed in this
field
:alue of > in SV'&/-+ indicates the successful operation
Positive value in SV'&/-+ indicates the completed operation "ith some e5ception
7egative value in SV'&/-+ indicates the unsuccessful operation
So it is common programming practice that the SV'&/-+ of every 3uery
must $e verified for valid values after the e5ecution of the 3uery If the SV'&/-+
value is not accepta$le8 then the control is transferred to 12+7- routine that "ould
end the program "ith proper error messages
SV'+RR- (=) contains the num$er of ro"s affected $y a -2( I7S+R!%-+'+!+
operation If the operation is -+'+!+8 this contains num$er of ro"s deleted after the
e5ecution of the 3uery
0.+7+:+R statement
0.+7+:+R is a error-trapping statement that directs the processing to
continue or $ranch to an error handling routine $ased on the SV'&/-+ returned for
the statement 0hen it processed8 it applies to all the su$se3uent SV' statements
issued $y the application program

+4+& SV'
0.+7+:+R condition action
+7--+4+&

&onditions can $e 7/! F/67-8 SV'01R7I7B or SV'+RR/R
1ction can $e either &/7!I76+ or B/ !/
7/! F/67- is !R6+ if SV'&/-+ is 1>>
SV'01R7I7B is !R6+ if SV'&/-+ is greater than )ero $ut not e3ual to 1>>

Mainframe Refresher Part-1 Page:129

SV'+RR/R is !R6+ if SV'&/-+ is less than )ero
It is almost al"ays safe to code specific SV'&/-+ chec#s after each SV'
statement and process accordingly 1void using 0.+7+:+R
-S7!I1R N SV'&1 Formatter
-S7!I1R is an I2M supplied program8 "hich "ould display the error
messages in a formatted "ay Most of the installations call this program in their error
routine
&1'' <-S7!I1R; 6SI7B SV'&18 +RR/R-M+SS1B+8 +RR/R-!+4!-'+7
>1 +RR/R-M+SS1B+
>A +RR/R-'+7 PI& SO(>K) &/MP :1'6+ L1=(>
>A +RR/R-!+4! PI& 4(1=() /&&6RS 1> !IM+S
II +RR/R-!+4!-'+7 PI& SO(>O) &/MP :1'6+ LI(
&omponents of -2(
-2( internal structure is very comple5 and contains large num$er of
components 2ut from a high-level point of vie"8 -2( can $e considered to have four
maQor components
System Services component: Supports system operation8 operator communication8
logging and similar function
'oc#ing services component: Provides the necessary controls for managing
concurrent access to data
-ata$ase services component: Supports the definition8 retrieval and update of user
and system data
-istri$uted data facility component: Provides -2(;s distri$uted data$ase support
2efore get into SV'8 let us $riefly see the su$- components of -ata$ase services
component
-ata$ase services component
It has five su$-components in it 0e have already discussed the functions of
t"o components N Pre-compiler and /ptimi)er (2ind)
Runtime supervisor:
It is resident in the main memory "hen the application program is e5ecuting
Its Qo$ is to oversee that e5ecution 0hen the program re3uests some data$ase
operation to $e performed8 control first goes to the runtime supervisor8 "hich uses
the control information in the application plan to re3uest the appropriate on the part
of the -ata Manager
-ata Manager (-M):

Mainframe Refresher Part-1 Page:130

It performs all the normal access method functions N search8 retrieval8 update
etc It invo#es other system components in order to perform detail functions such as
loc#ing8 logging etc
2uffer Manager (2M):
It is responsi$le for transferring the data $et"een e5ternal storage and virtual
memory It uses sophisticated techni3ues such as <read-ahead-$uffering; and <loc#-
aside-$uffering; to get the $est performance out of the $uffer pools under its control
to minimi)e the amount of physical i%o actually performed
&atalog and -irectory are also part of -ata$ase services component only
SV'
SV' is fourth generation language !he definition of fourth language is <!ell
the need System "ill get it done for you < !here is no need to instruct the method
to get it
For e5ample8 I "ant list of employees "or#ing currently in Malaysia If the
data is in file8 then I have to declare8 define8 and /pen the file !hen I should read all
the records into my "or#ing storage one $y one and if their location is Malaysia8 I
display them Finally I close the file
If the data is in -2(8 I "ould simply "rite a 3uery (S+'+&! ? FR/M ta$le
"here locationC;Malaysia;;) and -2( optimi)er do everything for me in identifying the
$est access path 7o "orries of -+&'1R+8 -+FI7+8 /P+78 R+1- and /MI! stuffs
!hat;s the po"er of fourth generation language and that ma#es the programmer life
easy^^
SV' has three #inds of statements
--'N-ata -efinition 'anguage Statements &R+1!+ 1'!+R -R/P
-M'N-ata Manipulation 'anguage Statements S+'+&! I7S+R! 6P-1!+ -+'+!+
-&'N-ata &ontrol 'anguage Statements BR17! R+:/*+
--'-&R+1!+
!his statement is used to create -2( o$Qects
Beneral Synta5 &R+1!+ o$Qect o$Qect-name parameters
!a$le creation Sample &R+1!+ !12'+ ta$le-name
(&olumn definitions8
Primary *ey definition8

Mainframe Refresher Part-1 Page:131

Foreign *ey definition8
1lternate *ey definition8
'I*+ ta$le-name %:ie"-name8
I7 -1!121S+-71M+!12'+SP1&+-71M+)
--'-&olumn -efinition
-efine all the columns using the synta5:
&olumn-name -ata-type 'ength (76''%7/! 76''% 7/! 76'' 0I!. -+F16'!)
-ata-types are already e5plained in -&'B+7 section
&olumn-name can $e of ma5imum length => It should start "ith an alpha$et and
it can contain num$ers and underscore
76'' means 67*7/078 if the value is not supplied during an insertion of a ro"8
then 76'' "ill $e inserted into this column
7/! 76'' means8 value for this column should $e mentioned "hen inserting a
ro" in the ta$le 7/! 76'' "ith -+F16'! means8 if the value for this column is
not supplied during an insertion8 then $ased on type of the column default values
"ill $e moved into the ta$le -efault values are listed in the $elo" ta$le
-ata- !ype -efault :alue
&.1R Spaces
:1R&.1R +mpty String (String of length >)
-1!+8 !IM+8 !IM+S!1MP &urrent (-1!+%!IM+%!IM+S!1MP)
I7!+B+R SM1''I7! -+&IM1' Uero
--'-Primary *ey definition
&andidate #ey is defined as column(s) that uni3uely identifies each ro" in the
ta$le /ne of the candidate #eys is defined as primary during the ta$le creation !he
main entity8 a$out "hich the information is stored8 is selected as primary #ey
If the PRIM1R, *+, is single column8 then it can $e coded along "ith column
definition If the primary #ey is composite #ey (more than one column)8 then it can
$e defined after the column definition Primary #ey definition can $e added or
dropped later using 1'!+R ta$le
!he definition of primary #ey is complete only after uni3ue inde5 is created on
it 6ntil that time8 the ta$le is unavaila$le for use If the primary #ey is added using
1'!+R command8 then uni3ue inde5 on the #ey column(s) must already $e availa$le
Synta5: PRIM1R, *+, (column18 column()
--'-Foreign *ey definition
-efining a foreign #ey esta$lishes a referential constraint $et"een the foreign
#ey (&hild !a$le) and the primary #ey (Parent ta$le) !he parent ta$le of a referential
constraint must have a primary #ey and a primary inde5
!here must $e a value in parent ta$le (primary #ey) for every non-null value
in child ta$le (foreign #ey) Foreign #ey can $e defined along "ith column definition
or separately after the definition of all the columns
Synta5 1: (1long "ith column definition)
&/'6M71 &.1R(K) R+F+R+7&+S !12'+( /7 -+'+!+ &1S&1-+%-+'+!+%S+! 76''

Mainframe Refresher Part-1 Page:132

Synta5 (: (1fter column definition)
F/R+IB7 *+, F*+,(&/'6M718&/'6M7() R+F+R+7&+S !12'+( /7
-+'+!+%&1S&1-+%S+! 76''
Delete %ule
-elete rule defines "hat action needs to $e ta#en on child ta$le "hen there is
a deletion in primary ta$le !he three possi$ilities are $elo":
&1S&1-+: &hild ta$le ro"s referencing parent ta$le "ill also $e deleted
R+S!RI&!: &annot delete any parent ro" "hen there is reference in child ta$le
S+! 76'': S+! the foreign #ey value as 76'' "hen the respective primary ro" is
deleted
Insert and 6pdate rules cannot $e defined 2ut they can $e implemented using
!RIBB+RS
--'-1lternate *ey -efinition
&andidate #eys that are not defined as primary #ey are called alternate #eys
!his can $e defined along "ith column definition or separately after the definition of
all the columns using the #ey"ord 67IV6+ 1lternate #ey definitions &177/! $e
added later using 1'!+R command
Synta5 1: &/'6M71 &.1R(1>) 67IV6+ 7/! 76''@
Synta5 (: 67IV6+(&olumn1)
--'- 1dding &onstraints
1 chec# constraint allo"s you to specify the valid value range of a column in
the ta$le For e5ample8 you can use a chec# constraint to ma#e sure that no salary in
the ta$le is $elo" Rs1>>>>8 instead of "riting a routine in your application to
constrain the data
&.+&* clause and the optional clause &/7S!R1I7! (for named chec#
constraints) are used to define a chec# constraint on one or more columns of a ta$le
1 chec# constraint can have a single predicate8 or multiple predicates Qoined $y 17-
or /R !he first operand of each predicate must $e a column name8 the second
operand can $e a column name or a constant8 and the t"o operands must have
compati$le data types
Synta5 1: 1-- &.+&* (0/R*-+P! 2+!0++7 1 and 1>>)@
Synta5 (: 1-- &/7S!R1I7! 2/76S&.* &.+&* (2/76S FC S1'1R,)@
1lthough &.+&* IS 7/! 76'' is functionally e3uivalent to 7/! 76''8 it
"astes space and is not useful as the only content of a chec# constraint .o"ever8
later if you "ant to remove the restriction that the data $e 7on-null8 you must define
the restriction using the &.+&* IS 7/! 76'' &lause
--'-Inde5 creation
!a$le spaces should $e created $efore creating the ta$le 2ut inde5 spaces
are automatically created "ith creation of inde5 So create inde5 command provides
optional parameters of 6SI7B S!/BR/6P8 PRIV!,8 S+&V!,8 FR++P1B+ and P&!FR++

Mainframe Refresher Part-1 Page:133

etc for the allocation of inde5 space 2ut usually "e don;t mention these parameters
and allo" the system to allocate it in the right place "ith respect to ta$le space
&R+1!+ R67IV6+S I7-+4 inde5-name on !a$le-name (column-name Rasc%descS8)
&R+1!+ 67IV6+ I7-+4 +MPI7-+4 /7 +MP!12'+ (+MP7/ 1S&)
&reating uni3ue inde5 on a 76'' column is possi$le if there is only one 76''
is availa$le in that column
--'-Sample Storage group &reation
&R+1!+ S!/BR/6P -S7JBK1-
:/'6M+S (-2P*>18 -2P*>()
:&1! -2(&1!U@
6sing the 1'!+R command8 volumes can $e added or removed at later stage
using the command 1-- :/'6M+S and R+M/:+ :/'6M+S
--'-Sample -ata$ase &reation
&R+1!+ -1!121S+ -S7J-K11
S!/BR/6P -S7JBK1>
26FF+RP//' 2P>@
--'-Sample !a$le space &reation
&R+1!+ !12'+SP1&+ -S7JSK1-
I7 -S7J-K11
6SI7B S!/BR/6P -S7JBK1>
PRIV!, (>
S+&V!, (>
+R1S+ 7/
'/&*SIU+ P1B+ '/&*M14 S,S!+M
26FF+RP//' 2P>
&'/S+ 7/
FR++P1B+ > P&!FR++ A
-S+!P1SS -S7J@
PRIV!, NPrimary space to $e allocated during ta$le space creation (*2)
S+&V!, -Secondary space ta#en as amount of data in ta$le space gro"s (*2)
+R1S+ N0hether -2( defined datasets are to $e erased "hen ta$le space is
dropped
'/&*SIU+ N Indicates si)e of loc# N &an $e !12'+SP1&+8 !12'+8 P1B+8 R/0 or 17,
17, means -2( "ill decide the loc#
'/&*M14 N Indicates ma5imum num$er of page % ro" loc#s a$ove "hich loc#
escalation occurs
26FF+RP//' N 2uffer pool associated "ith the ta$le space
&'/S+ N Indicates "hether datasets associated "ith ta$le space should $e closed
"hen there are no current users of ta$le space

Mainframe Refresher Part-1 Page:134

FR++P1B+ N 7um$er of pages after "hich a empty page is availa$le
P&!FR++ - Percentage of page to $e left free for future inserts
--'-Sample !a$le &reation
&R+1!+ !12'+ -S7JK1>+MP
(+MP7/ &.1R(M) 7/! 76''8
71M+ :1R&.1R(A>) 7/! 76''8
0/R*-+P! &.1R(=)8
P./7+7/ &.1R(K) &/7S!R1I7! 76M2+R &.+&*
(P./7+7/ GC <>>>>; 17-
P./7+7/ FC <OOOO;)8
2IR!.-1!+ -1!+8
S1'1R, -+&IM1'(O8()8
PRIM1R, *+, (+MP7/)8
F/R+IB7 *+, R+- (0/R*-+P!) R+F+R+7&+S -S7JK1>-+P!
/7 -+'+!+ S+! 76'')
I7 -S7J-K11-S7JSK1-@
--'-Sample :ie" &reation
!he general synta5 of vie" definition is
&R+1!+ :I+0 vie"-name (column18) 1S su$-3uery R0I!. &.+&* /P!I/7S
0I!. &.+&* /P!I/7 ensures that all the inserts and updates made to the
$ase ta$le using this vie" satisfies the limit imposed $y the "here condition of the
su$-3uery (-omain Integrity)
&R+1!+ :I+0 -2(BR/6P (+MPI- +MP71M+ S*I''S+!)
1S S+'+&! +MPI-8 +MP71M+8 S*I''S+!
FR/M -S7JK1>+MP
0.+R+ S*I''S+! C <-2(; 0I!. &.+&* /P!I/7@
!his vie" sho"s name and id of all the employees "ho #no"s -2(
<0I!. &.+&* /P!I/7; ensures that all the inserts made to $ase ta$le using the vie"
-2(BR/6P8 must have -2( as S*I''S+! 1ny update-attempt to change the value of
S*I''S+! from -2( to anything else using the vie" -2(BR/6P is restricted
--'-1'!+R !12'+
0hen you create a ta$le using model ta$le8 the columns are defined in the
ne" ta$le as in the model ta$le 2ut the PRIM1R,8 F/R+IB7 *+, definitions are not

Mainframe Refresher Part-1 Page:135

inherited 0e have to define them using 1'!+R !12'+ 2efore defining primary #ey
using 1'!+R !12'+8 there should $e uni3ue inde5
&R+1!+ !12'+ ,-+P!
'I*+ -S7JK1>-+P!@
&R+1!+ 67IV6+ I7-+4 ,-+P!4
/7 ,-+P! (-+P!7/)@
1'!+R !12'+ ,-+P!
PRIM1R, *+,(-+P!7/)@
6sing 1'!+R statement8 alternate #eys cannot $e defined /ther than that "e
can add columns8 constraints8 chec#s 9 -R/P primary #ey
0hen a ne" column is added "ith 7/! 76'' 0I!. -+F16'!8 then the value for
the column for all the ro"s already e5ist in the ta$le is filled $ased on the type of
column:
1 7umeric NUero
( &har8 :archar -Spaces
= -ate ->1%>1%>>>1
K !ime ->>:>> 1M
6sing 1'!+R command8 "e can e5tend the length of :1R&.1R%&.1R items8 s"itch
the data-type of a column "ithin character data-types (&.1R%:1R&.1R)@numeric
data types(SM1''I7!8I7!+B+!8R+1'8F'/1!8-/62'+8-+&IM1') and "ithin graphical
datatypes(BR1P.I&8:1RBR1P.I&)
1'!+R !12'+ -S7JK1>+MP
1'!+R &/'6M7 0/R*-+P!
S+! -1!1!,P+ &.1R(M)@
--'--R/P
-R/P deletes the ta$le definition in addition to all the ro"s in it ,ou also lose
all synonyms8 vie"s8 inde5es8 referential and chec# constraints associated "ith that
ta$le Plans and Pac#ages are deleted using the command FR++
-R/P /$Qect /$Qect-name
-R/P !12'+ ta$le-name
FR++ P1&*1B+(&/''1?) - -eletes all the pac#ages $elongs to collection &/''1
-ata Manipulation 'anguage statements
-M'-S+'+&!
S+'+&! statement is the heart of all 3ueries and it is specifically used for
retrieving information 1s a primary statement to retrieve the data8 it is the most
comple5 and most complicated -M' statement used Si5 different clauses can $e
used "ith a S+'+&! statement and each of these clauses has its o"n set of
predicates !hey are FR/M-0.+R+-BR/6P2,-.1:I7B-67I/7 and /R-+R 2,
Synta5: S+'+&! columns FR/M ta$les
0.+R+ conditions
BR/6P 2, columns

Mainframe Refresher Part-1 Page:136

.1:I7B conditions
/R-+R2, columns
6p to IA> columns can $e selected 1A su$-3ueries can $e coded in addition to one
main 3uery
-M'-FR/M clause of S+'+&!
FR/M clause is used8 in conQunction "ith one or more references8 to specify
-2( data manager "here to retrieve data
0.+R+ &lause
It is al"ays follo"ed $y a search condition that contains one or more
predicates that define ho" the -2( -M is to choose the information that "ill $e
contained in the result dataset produced
1ny relational operator can $e coded (FG8 G F 8 C 8FC8 GC)
-M'-S+'+&!-0.+R+- 7/! &ondition
7/! #ey"ord can $e used to select all the ro"s e5cept the ro" identified "ith
the search condition Synta5: W8E%E N$ Dcon0itionE
<7/!; cannot $e used directly "ith comparison operators 7/! C is invalid
-M'-S+'+&!-0.+R+-'I*+ condition
'I*+ is used for pattern search <`; is a "ild card for any num$er of )ero or
more characters and <a; is used to indicate single un#no"n character
If you "ant to loo# for ` in the string8 then you should define +S&1P+
character +5: 0.+R+ col1 'I*+ <M6!.6aL`S1R1`; +S&1P+ <L;
!his "ill loo# for a string that starts "ith <M6!.6a`S1R1; "here a can $e
any character
-M'-S+'+&!-0.+R+-2+!0++7 and I7
6se 2+!0++7 to chec# the value of column is "ithin the range !he lo"er and
upper $oundaries are I7&'6SI:+ 6se I7 to chec# the value of column against a
:alues list
-M'-S+'+&!-0.+R+-17,%S/M+%1''
S+'+&!Z0.+R+ &/'6M71 G 17,T1''TS/M+ (Su$-Vuery)
1'' - If the value of &/'6M71 is greater than all the values return $y su$-
3uery8 then only the outer ta$le ro" "ill $e selected If no ro"s are returned $y su$-
3uery then all the ro"s of outer ta$le "ill $e selected
17, and S/M+ N If &/'6M71 value is greater than one of the values return
$y su$-3uery8 then the outer ta$le ro" "ill $e selected
-M'-S+'+&!-0.+R+-+4IS!
!his is useful "hen you "ant to Qust chec# "hether one or more ro"s e5ist
Synta5: 0.+R+ +4IS!S (su$-3uery)
,our main 3uery "ill return result only if at least one ro" e5ists for your su$
3uery 7/! +4IS!S chec# for unavaila$ility of any ro"s for the search condition in
the su$ 3uery
-M'-S+'+&!-BR/6P 2,

Mainframe Refresher Part-1 Page:137

6se BR/6P 2, for grouping ro"s $y values of one or more columns ,ou can
then apply column function for each group +5cept for the columns named in the
BR/6P 2, clause8 the S+'+&! statement must specify any other selected columns as
an operand of one of the column functions
If a column you specify in the BR/6P 2, clause contains null values8 -2(
considers those null values to $e e3ual !hus8 all nulls form a single group
,ou can also group the ro"s $y the values of more than one column
-M'-S+'+&!-.1:I7B (Su$Qecting Broup to conditions)
6se .1:I7B to specify a search condition that each retrieved group must
satisfy !he .1:I7B clause acts li#e a 0.+R+ clause for groups8 and contain the
same #ind of search conditions you specify in a 0.+R+ clause
!he search condition in the .1:I7B clause tests properties of each group
rather than properties of individual ro"s in the group
-M'-S+'+&!-67I/7 and 67I/7 1''
6sing the 67I/7 #ey"ord8 you can com$ine t"o or more S+'+&! statements
to form a single result ta$le 0hen -2( encounters the 67I/7 #ey"ord8 it processes
each S+'+&! statement to form an interim result ta$le8 and then com$ines the
interim result ta$le of each statement If you use 67I/7 to com$ine t"o columns
"ith the same name8 the result ta$le inherits that name
,ou can use 67I/7 to eliminate duplicates "hen merging lists of values
o$tained from several ta$les "hereas 67I/7 1'' retains duplicates
-M'-S+'+&!-/R-+R 2,
!he /R-+R 2, clause is used to sort and order the ro"s of data in a result
dataset $y the values contained in the column(s) specified -efault is ascending
order (1S&) If the #ey"ord -+S& follo"s the column name8 then descending order
is used Integer can also $e used in place of column name in the /R-+R 2, clause
S+'+&! &/'18&/'(8&/'= FR/M !121 /R-+R 2, &/'1 1S& &/'= -+S&
S+'+&! &/'18&/'(8&/'= FR/M !121 /R-+R 2, 1 1S& = -+S&
-M'-S+'+&!-&/7&1!
&/7&1! is used for concatenating t"o columns "ith the string you "ant in $et"een
!o concatenate the last name and first name "ith comma in $et"een8
S+'+&! '1S!71M+ &/7&1! Y8Y &/7&1! FIRS!7M+
FR/M -S7JK1>+MP@
&/'6M7 F67&!I/7 17- S&1'1R F67&!I/7
&olumn function receives a set of values from group of ro"s and produces a single
value S&1'1R function receives one value and produces one value
&/'6M7 F67&!I/7:

Mainframe Refresher Part-1 Page:138

Function Returns-- +5ample
M14 Ma5imum value in a column M14(S1'1R,)
MI7 Minimum value in a column MI7(S1'1R,)
1:B 1verage value of a column 1:B(S1'1R,)
S6M Sum value of a column S6M(S1'1R,)
&/67! 7um$er of selected ro"s &/67!(?)
1 -IS!I7&! can $e used "ith the S6M8 1:B8 and &/67! functions !he selected
function operates on only the uni3ue values in a column
( S6M and 1:B cannot $e used for non-numeric data types "hereas MI78 M14 and
&/67! can
S&1'1R F67&!I/7:
Function Returns--- +5ample
&.1R String representation of its first
argument
&.1R(.IR+-1!+)
-1!+ -ate derived from its argument -1!+(<1OII-1(-1M;)
-1, -ay part of its argument -1,(-1!+1--1!+()
-1,S Integer representation of its
argument
-1,S(<1OII-1(-1M;)
--1,S(<1OIO-11->(;) L 1
M/7!. Month part of its argument M/7!.(2IR!.-1!+) C 1M
,+1R ,ear part of its argument ,+1R(2IR!.-1!+)C1OII
-+&IM1' -ecimal representation of its
first argument
-+&IM1'(1:B(S1'1R,)8J8()
F'/1! Floating-point representation of
its first argument
F'/1!(S1'1R,)%&/MM
.+4 .e5adecimal representation of
its first argument
.+4(2&.1R&/')
I7!+B+R Integer representation of its
argument
I7!+B+R(1:B(S1'1R,)L>A)
./6R .our part of its argument ./6R(!IM+&/') G 1(
MI76!+ Minute part of its argument MI76!+(!IM+&/') G AO
S+&/7- Second part of its argument S+&/7-(!IM+&/') G AO
MI&R/S+&/7- Microsecond part of its
argument
MI&R/S+&/7-(!IM+&/') G 1(
!IM+ !ime derived from its argument !IM+(!S!MP&/') F ;1(:>>:>>;
!IMS!1MP !imestamp derived from its
argument or arguments
!IM+S!1MP(-1!+&/'8!IM+&/')
'+7B!. 'ength of its argument '+7B!.(1--R+SS)
S62S!R Su$-string of a string SI2S!R(FS!71M+818=)
:1'6+ !he first argument that is not
null
:1'6+(SM1''I7!181>>) L
SM1''I7!( G 1>>>
&6RS/R
&6RS/R is useful "hen more than one ro" of a ta$le to $e processed It can
$e loosely compared "ith se3uential read of file 6sage of cursor involves four steps

Mainframe Refresher Part-1 Page:139

1-+&'1R+ statement
!his statement -+&'1R+S the cursor !his is not an e5ecuta$le statement
Synta5: -+&'1R+ cursor-name &6RS/R R0I!. ./'-S F/R your-3uery
RF/R 6P-1!+ /F column1 column( T F/R F+!&. /7',S
(/P+7 statement
!his statement Qust readies the cursor for retrieval If the 3uery has /R-+R
2, or BR/6P 2, clause8 then result ta$le is $uilt .o"ever it does not assign values
to the host varia$les
Synta5: /P+7 cursor-name
=F+!&. statement
It returns data from the results ta$le one ro" at a time and assigns the value
to specific host varia$les
Synta5: F+!&. cursor-name I7!/
:0S-&olumn1
:0S-&olumn(
!he num$er of I7!/ varia$les should $e e3ual to S+'+&! columns of your -+&'1R+
cursor statement If F/R 6P-1!+ /F clause is coded8 then "hile fetching the ro"8
the e5clusive loc# is o$tained over the page of the ro" F+!&. &ursor is usually
placed in the perform loop that "ill $e e5ecuted until the SV'&/-+ is 1>>SV'&/-+
"ill $e set to 1>> "hen end of cursor is reached
If F/R 6P-1!+ /F clause is given8 then all the columns that are going to $e
updated using the cursor should $e mentioned in this clause If you don;t mention
F/R 6P-1!+ /F clause8 you can update any num$er of columns using 0.+R+
&6RR+7! /F cursor-name $ut you "ill $e getting the e5clusive loc# only during the
6P-1!+ statement and there are chances for the ro" to $e loc#ed e5clusively $y
another tas# in $et"een your R+1- and 6P-1!+
So it is suggested to use F/R 6P-1!+ /F clause "hen you are using the
cursor for update purpose
K&'/S+ statement
It releases all resources used $y the cursor If you don;t close the cursor8
&/MMI! statement "ill close the cursor !o retain the cursor in /P+7 stage during
&/MMI!8 6se 0I!. ./'- option in the -+&'1R+ statement of the &6RS/R !his
option "ill $e effective only in $atch environment R/''21&* close all the cursors
including the cursors defined "ith <0I!. ./'-; option
Synta5: &'/S+ cursor-name
Read /nly &ursor
!he cursor that cannot $e used for any update purpose is called as R+1-
/7', &6RS/R For e5ample8 cursor defined "ith 67I/78 P/I7 or BR/6P 2, cannot
$e used for update purpose
-M'-I7S+R!

Mainframe Refresher Part-1 Page:140

I7S+R! statement is used to insert ro"s to the ta$le 7/! 76'' &olumn
values should $e supplied during I7S+R! /ther"ise I7S+R! "ould fail
1Specify values for columns of single ro" to insert
I7S+R! I7!/ ,-+P! (-+P!7/8 -+P!71M+8 MBR7/8 1-MR-+P!8 '/&1!I/7)
:1'6+S (Y+=1Y8 Y-/&6M+7!1!I/7Y8 Y>>>>1>Y8 Y+>1Y8 Y Y)@
I7S+R! I7!/ ,+MP
:1'6+S (Y>>>K>>Y8 YR6!.+RF/R-Y8 Y2Y8 Y.1,+SY8 Y+=1Y8
YAMIJY8 Y1OJ=->1->1Y8 YM171B+RY8 1M8 YMY8 Y1OK=->I-1>Y8 (K>>>8
A>>8 1O>>)@
,ou can name all the columns or omit 0hen you list the column names8 you
must specify their corresponding values in the same order as in the list of column
names
(Mass Insert 1nother ta$le or vie" contains the data for the ne" ro"(s)
I7S+R! I7!/ !+'+
S+'+&! '1S!71M+8 FIRS!7M+8 P./7+7/
FR/M -S7JK1>+MP
0.+R+ 0/R*-+P! C Y-(1Y@
If the I7S+R! statement is successful8 SV'+RR-(=) is set to the num$er of
ro"s inserted
-ependant ta$le insertion: (!a$le "ith foreign *ey)
+ach non-null value you insert into a foreign #ey column must $e e3ual to
some value in the primary #ey (the primary #ey is in the parent ta$le) If any field in
the foreign #ey is null8 the entire foreign #ey is considered null If you drop the inde5
enforcing the primary #ey of the parent ta$le8 an I7S+R! into either the parent ta$le
or dependent ta$le fails
-M'-6P-1!+
6P-1!+ statement is used to modify the data in a ta$le !he S+! clause
names the columns you "ant to update and provide the values you "ant them
changed to !he condition in the 0.+R+ clause locates the ro"(s) to $e updated If
you omit the 0.+R+ clause8 -2( updates every ro" in the ta$le or vie" "ith the
values you supply
If -2( finds an error "hile e5ecuting your 6P-1!+ statement (for instance8 an
update value that is too large for the column)8 it stops updating and returns error
codes in the SV'&/-+ and SV'S!1!+ host varia$les and related fields in the SV'&1
7o ro"s in the ta$le change (ro"s already changed8 if any8 are restored to their
previous values) If the 6P-1!+ statement is successful8 SV'+RR-(=) is set to the
num$er of ro"s updated
Synta5:
6P-1!+ ta$le-name S+! column1 Cvalue18 column( Cvalue( R0.+R+ conditionS@
-M'--+'+!+
-+'+!+ statement is used to remove entire ro"s from a ta$le !he -+'+!+
statement removes )ero or more ro"s of a ta$le8 depending on ho" many ro"s
satisfy the search condition you specified in the 0.+R+ clause If you omit a 0.+R+
clause from a -+'+!+ statement8 -2( removes all the ro"s from the ta$le or vie"
you have named !he -+'+!+ statement does not remove specific columns from the
ro" SV'+RR-(=) in the SV'&1 contains the num$er of deleted ro"s

Mainframe Refresher Part-1 Page:141

Synta5: -+'+!+ FR/M ta$le-name R0.+R+ &/7-I!I/7S
-M' N 76''S
/ne of the 1( &/-- Rules for relation data$ase system is < 76'' values are
supported for representing missing information in a systematic "ay irrespective of
the data type; -2( supports 76'' values
76'' I7 S+'+&! S!1!+M+7!
76'' is defined as 6n#no"n value in R-2MS terminology
!"o un#no"n values cannot $e same 1s +V61' can $e used only for #no"n
values8 &/'6M71C76'' is meaningless In the "here predicate if 76'' needs to $e
chec#ed8 0.+R+ &/'6M71 IS 76'' is the right "ay of coding If BR/6P2, is done
on a 76'' column8 then all the columns "hose value is un#no"n (76'') forms one
BR/6P
+5ample8 If V61'IFI&1!I/7 is a column defined "ith 76'' attri$ute in
+MP!12'+8 then SV' for retrieving all the employees "hose V61'IFI&1!I/7 is not
yet #no"n is:
S+'+&! +MP71M+8V61'IFI&1!I/7 FR/M +MP!12'+
0.+R+ V61'IFI&1!I/7 IS 76''
.igh-level languages don;t have any 76'' concept So if the column is 76''8
then the host varia$le corresponds to that column should $e set to )ero (numeric) or
spaces (non-numeric) !his can $e done in the programming 2ut for doing this "e
should #no" "hether the column is 76'' or 7/! 76'' indicators are used for this
purpose 76'' indicator is a ( $yte field (SO(K) &/MP) 7egative value8N1 in 76''
indicator field indicate that the column is 76''
+4+& SV'
S+'+&! V61'IFI&1!I/7
I7!/ :0S-V61'IFI&1!I/7 :0S-V61'IFI&1!I/7-76''
FR/M +MP!12'+
0.+R+ +MPI-C(>A(
+7--+4+&
IF SV'&/-+ C >
P+RF/RM 1>>>-&.+&*-F/R-76''S
Z
1>>-&.+&*-F/R-76''S
IF 0S-V61'IFI&1!I/7-76'' F > !.+7
M/:+ SP1&+S !/ 0S-V61'IFI&1!I/7
+7--IF
If V61'IFI&1!I/7 of +MPI- C (>A( is 76'' and if you didn;t code null
indicator8 then the 3uery "ill fail "ith SV'&/-+ N=>A and the error message
corresponding to this code is <!.+ 76'' :1'6+ &177/! 2+ 1SSIB7+- !/ /6!P6!
./S! :1RI12'+ 76M+R posit-num 2+&16S+ 7/ I7-I&1!/R :1RI12'+ IS
SP+&IFI+- <
!his #ind of 76'' chec# (1>>-&.+&*-F/R-76''S) is highly recommended for
numeric fields /ther"ise the program may a$normally end at some place do"n the
line8 "hen the field is used for some arithmetic operation
Instead of 76'' indicator8 :1'6+ function can also $e used
S+'+&! :1'6+(V61'IFI&1!I/78; <)
I7!/ :0S-V61'IFI&1!I/7
FR/M +MP!12'+

Mainframe Refresher Part-1 Page:142

0.+R+ +MPI-C(>A(
If V61'IFI&1!I/7 is 76''8 then < < "ill $e moved to 0S-V61'IFI&1!I/7
76'' I7 I7S+R!%6P-1!+ S!1!+M+7!
!he concept is same -2( informs the 76'' presence thru; the 76'' indicator
to the programming language In similar "ay8 the programming language should
inform the 76'' to -2( $y 76'' indicator
Pust $efore I7S+R! or 6P-1!+ move N1 to 76'' indicator varia$le and use
this varia$le along "ith host varia$le for the column to $e inserted%updated
/nce N1 is moved to null indicator8 then independent of value presence in the host
varia$le8 76'' "ill $e loaded In the follo"ing 3uery8 though <2+; is moved to host
varia$le8 it "ill not $e loaded into the ta$le as null indicator has N1 It should have
$een set to > $efore loading
M/:+ N1 !/ 0S-V61'IFI&1!I/7-76''
M/:+ <2+; !/ 0S-V61'IFI&1!I/7
+4+& SV'
6P-1!+ +MP!12'+
S+! V61'IFI&1!I/7 C :0S-V61'IFI&1!I/7 :0S-V61'IFI&1!I/7-76''
0.+R+ +MPI-C(>A(
+7--+4+&
It is common feeling that 76'' provides more trou$le than $enefit So it is
al"ays $etter to specify 7/! 76'' or 7/! 76'' 0I!. -+F16'! for all the columns
:alues in null indicator
1 negative value in null indicator field implies that the column is 76'' and a
positive value or U+R/ in null indicator implies that the column is 7/! 76'' :alue of
N( in null indicator indicates that the column has $een set to null as a result of a
data conversion error
-&'-BR17! and R+:/*+ commands
-ata &ontrol 'anguage consists of commands that control the user access to
the data$ase o$Qects !he -ata$ase 1dministrator (-21) has the po"er to give
(BR17!) and ta#e (R+:/*+) privileges to a specific user8 thus giving or denying
access to the data
Synta5:
BR17! access /7 o$Qect !/ 6S+R-I- T P62'I& R0I!. BR17! /P!I/7S
R+:/*+ access /7 o$Qect FR/M 6S+R-I- T P62'I&
+5ample:
BR17! S+'+&!8 6P-1!+ /7 +MP!12'+ !/ SMS4'JM
BR17! 1'' /7 +MP!12'+ !/ SMS4'JM
R+:/*+ &R+1!+ !12'+8 &R+1!+ :I+0 FR/M SMS4'JM
R+:/*+ I7S+R! /7 +M!12'+ FR/M SMS4'JM

Mainframe Refresher Part-1 Page:143

&/MMI! and R/''21&*
1 transaction8 or a unit of "or#8 is a recovera$le se3uence of one or more
SV' operations that are grouped together as a single unit8 usually "ithin in an
application process
1ll the changes made to the data$ase since the initiation of transaction8 are
made permanent $y &/MMI! R/''21&* $rings $ac# the data$ase to the last
committed point
Synta5:
+4+& SV' &/MMI! +7--+4+&
+4+& SV' R/''21&* +7--+4+&
-2( Restart 'ogic:
6sually there is only one &/MMI! or R/''21&* Qust $efore the termination of
the transaction 2ut it is not preferred al"ays
If the program is updating one million records in the ta$le space and it
a$normally ends after processing ninety thousand records8 then the issued
<R/''21&*; $rought the data$ase $ac# to the point of transaction initiation
!he restart of the program must have to process ninety thousand successful-$ut-not-
committed updates once again !he repeated cost occurred is due to 2ad design of
the application

If the program is e5pected to do huge updates8 then commit fre3uency has to
$e chosen properly 'et us say8 after careful analysis8 "e have designed our
application &/MMI! fre3uency as thousand records If the program a$normally ends
"hile processing 1A>>
th
record8 then the restart should not start from first record $ut
from 1>>1
st
record !his is done using restart logic
&reate one temporary ta$le called R+S!1R!S "ith a dummy record and
inserts one record into the ta$le for every commit "ith #ey and occurrence of
commit !his insertion should happen8 Qust 2+F/R+ the issue of &/MMI!
First paragraph of the procedure should read the last record of the ta$le and
s#ipped the records that are already processed and committed (1>>> in the previous
case) 1fter the processing of all the records (one million)8 delete the entries in the
ta$le and issue one final &/MMI!

Mainframe Refresher Part-1 Page:144

P/I7S
Most of the times8 the complete information a$out an entity is retrieved from
more than one ta$le Retrieving information from more than one ta$le can $e done
in t"o "ays /ne method is P/I7 and the other method is 67I/7 0e have already
discussed a$out 67I/7 It is used to get information a$out more entities In other
"ords8 it returns more ro"s P/I7 is used to get detail information a$out entities In
other "ords8 it returns more columns
!here are t"o #inds of P/I7 Inner Qoin returns ro"s from t"o or more ta$les
$ased on matching values /uter Qoin returns ro"s from to" or more ta$les
independent of matching or non-matching
P/I7: I77+R
!"o or more ta$les are Qoined together using the column having e3ual values
among them
+MP!12'+ S1'!12'+
DESIG SALARY
SSE 400000
SE 300000

S+'+&! +MP-71M+ S1'1R, FR/M +MP!12'+8 S1'!12'+ 0.+R+
+MP!12'+-+SIB71!I/7 C S1'!12'+-+SIB71!I/7
It can also $e coded as
S+'+&! +MP-71M+ S1'1R, FR/M +MP!12'+ I77+R P/I7 S1'!12'+ /7
+MP!12'+-+SIB71!I/7 C S1'!12'+-+SIB71!I/7
Result
-+:I K>>>>>
Since there is no !' designation in the S1'!12'+8 M6!.6 "ill not appear in the
output
P/I7:F6'' /6!+R P/I7
!he clause F6'' /6!+R P/I7 includes unmatched ro"s from $oth ta$les
Missing values in a ro" of the result ta$le contain nulls
S+'+&! +MP-71M+ S1'1R, FR/M +MP!12'+ F6'' /6!+R P/I7 S1'!12'+ /7
+MP!12'+-+SIB71!I/7 C S1'!12'+-+SIB71!I/7
Result:
M6!.6 --
-+:I K>>>>>
--- =>>>>>

EMP_ID EMP_NAME DESIG
100MUTHU TL
101DEVI SSE
Mainframe Refresher Part-1 Page:145

P/I7:'+F! /6!+R P/I7
!he clause '+F! /6!+R P/I7 includes ro"s from the ta$le named $efore it
"here the values in the Qoined columns are not matched $y values in the
Qoined columns of the ta$le named after it
S+'+&! +MP-71M+ S1'1R, FR/M +MP!12'+ '+F! /6!+R P/I7 S1'!12'+ /7
+MP!12'+-+SIB71!I/7 C S1'!12'+-+SIB71!I/7
Result
M6!.6 --
-+:I K>>>>>
P/I7:RIB.! /6!+R P/I7
!he clause RIB.! /6!+R P/I7 includes ro"s from the ta$le named after it
"here the values in the Qoined columns are not matched $y values in the
Qoined columns of the ta$le named $efore it
S+'+&! +MP-71M+ S1'1R, FR/M +MP!12'+ RIB.! /6!+R P/I7 S1'!12'+ /7
+MP!12'+-+SIB71!I/7 C S1'!12'+-+SIB71!I/7
Result
-+:I K>>>>>
---- =>>>>>
Restrictions on /uter Poins
1 :1'6+ or &/1'+S&+ function can $e used only "ith F6'' /6!+R Qoin
( /nly <C; can $e used as comparison operator in F6'' /6!+R Qoin
= Multiple conditions can $e coded "ith 17- </R; and <7/!; are not allo"ed
Su$-3ueries
Su$-Vueries are nested S+'+&! statements Su$-3uery ena$les a user to
$ase the search criteria of one S+'+&! on the result of another S+'+&! statement
It is al"ays part of a predicate
Synta5: (M1I7-V6+R,) 0.+R+ operand operator (S62-V6+R,)
Su$-3ueries can appear in the predicates of other su$-3uery !his is called
nested su$-3uery and the nesting is possi$le up to 1A levels
6sually su$-3uery e5ecutes only once and it is e5ecuted first and the value
returned $y su$-3uery "ill $e used for main 3uery !his #ind of su$-3uery is called as
un-correlated su$-3uery 0hen the su$-3uery refers to the ta$le referred in the
main-3uery then the su$-3uery is e5ecuted for every e5ecution of main-3uery and
this #ind of 3uery is called correlated su$-3uery &orrelated su$-3ueries cannot $e
used for update%insert%delete purpose
+5ample:
!he follo"ing 3uery lists the employees "ho get more than the average salary
of their department
S+'+&! +MP71M+8-+P!76M8S1'1R,
FR/M +MP!12'+

Mainframe Refresher Part-1 Page:146

0.+R+ S1'1R, G (S+'+&! 1:B(S1'1R,)
FR/M -+P!76M
0.+R+ +MP!12'+-+P!76MC-+P!-+P!76M)

/P!IMIU+R- 1&&+SS P1!. S+'+&!I/7
Benerally8 the fastest "ay to access -2( data is "ith inde5 Inde5es are
structured in such a "ay to increase the efficiency of finding a particular piece of
data -2( uses many different algorithms to traverse an inde5 structure !hese
algorithms are designed to elicit optimum performance in a "ide variety of data
access scenarios
!o use an inde5:
1 /ne of the predicates for the SV' statement must $e inde5-a$le
( /ne of the columns (in any inde5-a$le predicate) must e5ist as column in an
availa$le inde5
!here are various types of inde5es are availa$le !hey are:
1 -irect Inde5 'oo#-6p
( Inde5 Scan N Matching inde5 scan
= Inde5 Scan N 7on-matching inde5 scan
K Inde5-/nly access
A 'ist pre-fetch
M Multi-inde5 access (17- 9 /R)
+5ample: !he primary #ey of the ta$le !1S*!12 is a composite #ey "ith columns
&'I+7!aI-8 PR/P+&!aI-8 M/-6'+aI-
-irect Inde5 'oo#-6p:
:alues are provided for each column in the inde5 In the a$ove e5ample8 if
the value for all the three columns are given in the "here clause8 then there "ill $e
a direct inde5 loo# up
S+'+&! M/-6'+aI-8 M/-6'+aS!1!6S FR/M !1S*!12
0.+R+ &'I+7!aI- C 1>> 17- PR/P+&!aI-C1> 17- M/-6'+aI- C 1
If only &'I+7!aI- and M/-6'+aI- is given then direct inde5 loo#-up is not possi$le
Inde5 scan "ould occur
Matching Inde5 Scan or 1$solute Positioning
It starts "ith root page and "or# do"n to a leaf page in much the same
manner as direct inde5 loop up does .o"ever since the full #ey is unavaila$le8 -2(
must scan the leaf pages using the values it does have8 until all matching values
have $een retrieved 1s it starts at root page8 the value of first column(s) should $e
given
S+'+&! M/-6'+aI-8 M/-6'+aS!1!6S FR/M !1S*!12
0.+R+ &'I+7!aI- C 1>> 17- PR/P+&!aI-C1>
!he 3uery use matching inde5 scan and returns all the module id and module
status for the given client and proQect
7on-matching inde5 scan or Relative positioning

Mainframe Refresher Part-1 Page:147

7on-matching inde5 $egins "ith the first leaf page in the inde5 and
se3uentially scans su$se3uent leaf pages applying the availa$le predicates If any
/R-+R 2, or BR/6P 2, is coded8 then optimi)er prefers non-matching inde5 scan
than ta$le space scan
S+'+&! &'I+7!aI-8 M/-6'+aI-8 M/-6'+aS!1!6S FR/M !1S*!12
0.+R+ PR/P+&!aI-C1>
/R-+R 2, M/-6'+aI-
Inde5-only access
If all the data re3uired $y the 3uery is availa$le in inde58 then -2( can avoid
reading the data page and perform non-matching inde5 scan
!his special type of non-matching inde5 scan is called inde5-only access
S+'+&! &'I+7!aI- FR/M !1S*!12 0.+R+ PR/P+&!aI- C 1> 17- M/-6'+aI-C1
Se3uential pre-fetch and 'ist pre-fetch
Se3uential pre-fetch is a techni3ue used $y optimi)er during S+V6+7!I1'
ta$le space S&17 It can $e though of as a read ahead mechanism invo#ed to pre-fill
-2( $uffers so that data is already in memory $efore it is re3uested
'ist Pre-fetch is a techni3ue used $y optimi)er during I7-+4+- access If the
cluster ratio of the inde5 is poor (less than J>`) then RI-s of matching inde5es are
sorted $ased on data page num$er and then the data-page is accessed
!his significantly reduces the I-/ as same page "ill not $e read second time
in this method &lustered inde5 access doesn;t use this techni3ue as already the data
ro"s are in the same order of inde5 (&luster ratio is 1)
Multi inde5 access
0hen more than t"o inde5es are used in "here clause
16sing the first inde58 RI-s matching the re3uirement are chosen and sorted $ased
on data-page num$er
(6sing the second inde58 RI-s matching the re3uirement are chosen and sorted
$ased on data-page num$er
=If the inde5es are Qoined using /R8 then the union of RI- list of 1 and ( is used to
access data page
K If the inde5es are Qoined using 17-8 then the intersection of RI- list of 1 and (
is used to access data page
!a$le Space Scan
If there is no inde5-a$le column in the predicate or -2( decides not to use
availa$le inde58 then the optimi)er choose ta$le space scanning
!a$le space scanning is li#e se3uential read of file 1ll the ro"s of all the
pages are read se3uentially and the ro"s satisfying the selection criteria in the "here
clause is chosen for further processing
Vuery Parallelism
!his is another techni3ue that can $e applied $y the optimi)er is 3uery
parallelism 0hen parallelism is invo#ed8 an access path can $e $ro#en up into
parallel groups +ach parallel group represents a series of concurrent operations "ith
the same degree of parallelism -egree of parallelism refers to the num$er of
concurrent tas#s used to satisfy the 3uery
Vuery I%/ parallelism (as of -2( :=):

Mainframe Refresher Part-1 Page:148

2rea#s the data access for the 3uery into concurrent I%/ streams e5ecuted in
parallel should reduce the overall elapsed time for the 3uery 0ith 3uery I%/
parallelism8 -2( is limited to operate on a single processor for each 3uery
Vuery &P Parallelism (as of -2( :K):
!he large 3uery is decomposed into multiple smaller 3ueries that can $e
e5ecuted concurrently "ith one another on multiple processors &P parallelism
al"ays uses I%/ parallelism !his should further reduce the elapsed time of the
3uery
Vuery Sysple5 Parallelism (as of -2( :A):
It further enhances parallel operations $y ena$ling a single 3uery to $e
$ro#en up and run across multiple -2( su$systems "ithin a data-sharing group It
ta#es the advantage of the processing po"er of multiple -2( su$systems
Filter factor
Filter factor is a ratio that estimates I%/ costs !he optimi)er calculates the
filter factor for a 3uery;s predicates $ased on the num$er of ro"s that "ill $e filtered
out $y the predicates !hat is8 if the predicate is most restrictive8 the filter factor
"ould $e lo"8 the I-/ cost "ould $e less and the 3uery "ill $e more efficient
For an inde5ed column8 FIRS!*+,&1R-F column of S,SI2MS,SI7-+4+S consists of
num$er of distinct values in the column
If the predicate is columnCvalue then filterfactor C 1%FIRS!*+,&1R-F
If the predicate is column FG value then filterfactor C (1-1% FIRS!*+,&1R-F)
!his case involves more I-/ is involved and inefficient
+4P'1I7
0e have already seen that -2( optimi)er chooses the access path for the
3uery If "e "ant to #no" "hat access path -2( chose during the plan preparation8
then the re3uest should $e placed to -2( !he re3uest can $e done t"o "ays:
Method 1: 6se +4P'1I7 (,+S) parameter in the 2I7- card
S+'+&! ? FR/M o"neridP'17a!12'+ /R-+R 2, 1PP'71M+8 &/''I-8 :+RSI/78
PR/B71M+8 !IM+S!1MP -+S&8 V6+R,7/8 V2'/&*7/8 P'177/
Method (: 6se the follo"ing command directly in the program or in SP6FI or VMF
Synta5: +4P'1I7 1'' S+! V6+R,7/Cinteger F/R SV'-statement
2efore posting the re3uest8 there should $e a P'17a!12'+ under the user-id8
$ased on model S,SI2MP'17a!12'+ P'17a!12'+ is a standard ta$le that must $e
defined "ith predetermined columns8 data types and lengths -uring $ind process8
-2( optimi)er $riefs the access path chose $y it in the P'17a!12'+
If you "ant to 3uery the access path for single 3uery then use the 3uery
$elo":
S+'+&! ? FR/M P'17a!12'+ 0.+R+ V6+R,7/Cinteger /R+-+R2, V2'/&*7/8
P'177/
7o" the access path ta#en $y the optimi)er is loaded into P'17a!12'+ /ne
should #no" the meaning of P'17a!12'+ columns and values to understand the
access path -2(:A has KM columns in P'17a!12'+

Mainframe Refresher Part-1 Page:149

P'17a!12'+ &olumn name Meaning
V6+R,7/ Integer value assigned $y the user issuing the +4P'1I7
or -2(
V2'/&*7/ Integer identifying level of su$-3uery or union in a SV'
statement !he first su$-select is num$ered as 18 the
second as ( and so on
1PP'71M+ 7ame of the P'17 or P1&*1B+ $ased on 2I7- stage of
static SV' It "ill $e spaces for SP6FI re3uest
PR/B71M+ 7ame of the program in "hich SV' statement is
em$edded -SVI+SV' for SP6FI +4P'1I7
P'177/ Integer value saying the step of the plan in "hich
V2'/&*7/ is processed
(!he order in "hich plan steps are underta#en)
M+!./- Integer value identifying the access method used for
the given step
1- 7ested loop Qoin
(-Merge scan Qoin
=-independent sort as a result of /R-+R2,8 BR/6P 2,8
-IS!I7& or I7
K-.y$rid Poin
1&&+SS!,P+ !echni3ue used for access
I N Inde5ed access
I1 N /ne fetch inde5 scan
R N !a$le Space Scan
7 N Inde5 access "ith In predicate
M N Multiple inde5 scan
M4 N specification of the inde5 name for multiple inde5
access
MI N Multiple inde5 access $y RI- intersection
M6 N Multiple inde5 access $y RI- union
M1!&.&/'S 7um$er of inde5 columns used in inde5ed access
1ccess type should $e I8 I18 M8 M4
I7-+4/7', <,; indicates access to the inde5 is sufficient to satisfy
the 3uery
PR+F+!&. Indicates "hich type of pre fetch "ill $e used
SNSe3uential8 '- 'ist8 2lan#N6n#no"n at $ind time
P1R1''+'ISM M/-+ Indicates type of parallelism used at $ind time
I N I%/ Parallelism8 & N &P6 Parallelism
4 N Sysple5 Parallelism8 2lan# N 7o or determined at
run time
V2'/&*a!,P+ !ype of SV' operation performed for the 3uery $loc#
&/RS62 N &orrelated su$ 3uery
7&/S62- 7on correlated su$ 3uery
6P-&6R8 -+'&6R N 6pdate and -elete using 0.+R+
&6RR+7! /F option of cursor
S+'+&!8 I7S+R!8 6P-1!+8 -+'+!+ N !ype of -M'
S+'6P- N S+'+&! "ith F/R 6P-1!+ /F
P/I7a!,P+ Indicates type of Qoin implemented
F N Full /uter Poin
' N 'eft /uter Poin (or converted right outer Qoin)

Mainframe Refresher Part-1 Page:150

2lan# N Inner Qoin or no Qoin
!IM+S!1MP -ate and time the +4P'1I7 for this ro" "as issued
/ther columns are:
&R+1!/R8 !71M+8 !127/8 1&&+SS&R+1!/R8 1&&+SS71M+8 S/R!7a67IV8
S/R!7aP/I78 S/R!7a/R-+R2,8 S/R!MaBR/6P2,8 S/R!&a67IV8 S/R!&aP/I78
S/R!&aBR/6P2,8 S/R!&aBR/6P8 !S'/&*M/-+8 R+M1R*S8 &/'6M7aF7a+:1'8
MI4/PS+V8 :+RSI/78 &/''I-8 1&&+SSa-+BR++8 1&&+SSaPBR/6PaI-8
P/I7a-+BR++8 P/I7aPBR/6PaI-8 S/R!&aPBR/6P8I-8 S/R!7aPBR/6PaI-8
M+RB+aP/I7a&/'S8 &/RR+'1!I/7a71M+8 P1B+aR17B+8 BR/6PaM+M2+R8
I2MaS+R:I&+a-1!180.+7a/P!IMIU+8 2I7-a!IM+

-,71MI& SV'
Static SV' is em$edded in application program and the only values that can
change are the values of the host varia$les in the predicates -ynamic SV' are
characteri)ed $y the capa$ility to change columns8 ta$les and predicates during a
program;s e5ecution
1dvantages: Fle5i$ility and $est access path (as the $ind happens at the run
time using latest R67S!1!S information)
-isadvantage: Slo" as the runtime is $ind time L e5ecution time
!ypes of -ynamic SV'
1+4+&6!+ IMM+-I1!+:
Move the SV' statement to $e e5ecuted into the host varia$le and issue
e5ecute immediate command
>1 0S-./S!
KO 0S-./S!-'+7B!. PI& SO(>K) &/MP
KO 0S-./S!-:1R PI& 4(K>)
M/:+ LK> !/ 0S-./S!-'+7B!.
M/:+ [S+! +MPa71M+ C <M6!.6; 0.+R+ +MPa7/C(>A(\ !/ 0S-./S!-!+4!
+4+& SV' +4+&6!+ IMM+-I1!+: 0S-./S!-:1R +7--+4+&
-isadvantages:
1It cannot $e used for S+'+&!
(+5ecuta$le form of the SV' "ill $e deleted once it is e5ecuted
(+4+&6!+ 0I!. PR+P1R+:
!his is e3uivalent to first form $ut here the SV' is prepared $efore e5ecution
and so the second disadvantage is avoided in this method
Form: 1
M/:+ LK> !/ 0S-./S!-'+7B!.
M/:+ [S+! +MPa71M+ C <M6!.6; 0.+R+ +MPa7/C(>A(\ !/ 0S-./S!-!+4!
+4+& SV' PR+P1R+ R67F/RM FR/M :0S-./S! +7--+4+&
+4+& SV' +4+&6!+ R67F/RM +7--+4+&
Form: (
Parameter mar#ers can $e used in place of constant values !his acts li#e
placeholder for the host varia$les in the SV'

Mainframe Refresher Part-1 Page:151

M/:+ LK> !/ 0S-./S!-'+7B!.
M/:+ [S+! +MPa71M+ C <M6!.6; 0.+R+ +MPa7/C]\ !/ 0S-./S!-!+4!
+4+& SV' PR+P1R+ R67F/RM FR/M :0S-./S! +7--+4+&
M/:+ (>A( !/ 0S-+MP-76M
+4+& SV' +4+&6!+ R67F/RM 6SI7B :0S-+MP-76M +7--+4+&
-isadvantage:
Select statement is not supported
=S+'+&! "ith S!1!I& &olumns (Fi5ed-list S+'+&!)
!he follo"ing method is used for data retrieval $ut the column to $e selected
are #no"n and unchanging
'et the 3uery $e < S+'+&! +MPa71M+ FR/M +MP!12'+ 0.+R+ -+P!a7/C];
M/:+ <Select SV' < to 0S-./S!
+4+& SV' -+&'1R+ &SR1 &6RS/R F/R S+'SV' +7--+4+&
+4+& SV' PR+P1R+ FR/M :0S-./S! +7--+4+&
M/:+ 1>> !/ 0S--+P!-7/
+4+& SV' /P+7 &SR1 6SI7B :0S-+MP-7/ +7--+4+&
P+RF/RM 67!I' SV'&/-+ C1>>
+4+& SV' F+!&. &SR1 I7!/ :0S-+MP71M+ +7--+4+&
+7--P+RF/RM
+4+& SV' &'/S+ &SR1 +7--+4+&
-isadvantage:
1!a$le name cannot $e changed 7um$er of columns cannot $e modified during run
time
!he fourth type of dynamic SV' #no"n as <varying-list select; provide hundred
percent fle5i$ility "here the num$er of columns and even the ta$le "e are accessing
can $e changed during run time !his uses the copy$oo# SV'-1 for its purpose
I7!+BRI!,
Integrity means the accuracy8 correctness or validity of data contained in the
data$ase Maintaining integrity is not an easy tas# in a multi user environment So
the tas# of maintaining integrity is handled $y the system than the user
-omain Integrity
It ensures that a value in a column is a mem$er of column;s domain or legal
set of values Simple e5ample is8 alpha$etic data on the integer column is restricted
+ntity Integrity
It means every ro" in a ta$le is uni3ue !o ensure entity integrity8 developer
has to define a set of column(s) as primary #ey
Referential Integrity

Mainframe Refresher Part-1 Page:152

It ensures the data integrity $et"een the ta$les related $y Primary (Parent)
and Foreign (&hild) #eys
&oncurrency and its issues:
-2( allo"s more than one application to access the same data at essentially the
same time !his is #no"n as concurrency &oncurrency results the follo"ing
pro$lems
1!he '/S! 6P-1!+ Pro$lem
!ime !ransaction-1 !ransaction-2
!> Read ro" R1
!1 Read ro" R1
!( 6pdate ro" R1
!= 6pdate ro" R1
!ransaction-2 over"rites the change done $y !ransaction-a at !(
In other "ords8 the update of transaction-1 is lost
(6ncommitted -ependency Pro$lem
It arises "hen a transaction is allo"ed to retrieve (update) a ro" that has
$een updated $y another transaction and has not yet $een committed $y the other
transaction
!ime !ransaction-1 !ransaction-2
!> 6pdate ro" R1
!1 Read and 6pdate ro" R1
!( Roll$ac#
!ransaction-2 updates ro" R1 $ased on the uncommitted change done $y
!ransaction-1 !ransaction-2 rolled $ac# its changes
=-ata inconsistency
'et us say there is ( account 1181( and account 1= should have sum of
amounts in 11 and 1( Say 11 C 1>>> 1( C (>>> 1=C=>>>
!ime !ransaction-1 !ransaction-2
!> Read ro" 11(1>>>)

Mainframe Refresher Part-1 Page:153

!1 Read ro" 11 and update to (>>>
!( 6pdate ro" 1((=>>>)
!= &alculate 1= and update (K>>>)
!K &ommit &ommit
7o" the value of 11C(>>>8 1(C=>>> $ut 1=CK>>> CC G -ata inconsistent
as 1= is e5pected to $e A>>> as per design
'oc#ing
'oc#ing solves the concurrency issues descri$ed a$ove 'oc#ing prevent
another transaction to access the data that is $eing changed $y the current
transaction !hree main attri$utes of loc# are mode8 si)e and duration
Mode of the loc#:
It specifies "hat access to the loc#ed o$Qect is permitted to the loc# o"ner
and to any concurrent application process
+5clusive (4) N !he loc# o"ner can read or change the loc#ed page &oncurrent
processes cannot ac3uire 17, loc# on the page nor they access the loc#ed page
6pdate (6) N !he loc# o"ner can read $ut cannot change the loc#ed page .o"ever
the o"ner can promote the loc# to <4; and update Processes concurrent "ith the 6
loc# can ac3uire <S; loc# and read the page $ut another <6; loc# is not possi$le
Share (S) - !he loc# o"ner and any concurrent processes can read $ut not change
the loc#ed page &oncurrent processes can ac3uire S or 6 loc#s on the page
!he a$ove three are "ith respect to pages !hree more #ind of loc#s are possi$le at
ta$le %ta$le space level !hey are: Intent Share (IS)8 Intent +5clusive (I4) and
Share%Intent +5clusive (SI4)
SIU+ of the loc#
It can $e R/08 P1B+8 !12'+ and !12'+SIU+
-uration of the loc#
It is the length of time the loc# is held It varies according to "hen the loc# is
ac3uired and released !his is controlled $y 1&V6IR+8 R+'+1S+ and IS/'1!I/7
'+:+' parameters of 2I7-
'/&* Issues

Mainframe Refresher Part-1 Page:154

'oc#ing is introduced to avoid concurrency issues 'oc#ing resulted suspension8
timeout and deadloc# pro$lems 2ut '/&* is needed for data integrity
Suspension
IR'M suspends an application process if it re3uests a loc# on an o$Qect that is
already o"ned $y another application process and cannot $e shared !he suspended
process is said to $e in <0ait Stage; for the loc# !he process resumes "hen the loc#
is availa$le
!imeout
0hen the o$Qect is in "ait stage more than predefined time8 then the process
(program) is terminated $y -2( "ith SV' return code NO11 or NO1= meant for
!IM+/6! !he IR'MR0! of -S7UP1RM determines the duration of the "ait time
-eadloc#
0hen t"o or more transactions are in simultaneous "ait stage8 each "aiting
for one of others to release a loc# $efore it can proceed8 -+1-'/&* occurs
If deadloc# occurs8 transaction manager of -2( $rea#s it $y terminating one
of the transactions and allo"s the other to process 'ater8 the application
programmer "ill restart the terminated transaction
'oc# and 'atch
1 true loc# is handled $y -2( using an e5ternal component called IR'M
.o"ever8 "hen it is practical8 -2( tries to loc# pages "ithout going to IR'M
!his type of loc# is #no"n as '1!&. 'atches are internally set $y -2( "ithout going
to IR'M
Initially latches are used to loc# only -2( inde5 pages and internal -2(
resources -2( := uses latching more fre3uently for data pages also 'atches are
preferred "hen a resource seriali)ation is re3uired for a short time 'oc#s and
'atches guarantee data integrity at the same level
1dvantage of 'atch over 'oc#:
1&ross-memory service calls to IR'M is eliminated
('atch re3uires a$out one third the num$er of instructions as a loc#
'oc# Promotion
0hen loc# is promoted from lo"er level to upper level8 it is called loc#
promotion -2( ac3uire <6; loc# to update a ro" 2ut at the same concurrent
processes can access the ro" in <S; loc# -uring update8 it needs <4; loc# and to get
the <4; loc#8 it "aits for concurrent processes to release <S; loc#s It promotes the
current loc# from <6; to <4; and this is called '/&* PR/M/!I/7 /7 M/-+ (<6; N
6pdate in Pending and <4; N 6pdate in Progress)
0hen the num$er of page loc#s e5ceeds predefined limit8 it is promoted to
ta$le or ta$le space level and this is '/&* PR/M/!I/7 /7 SIU+
'oc# Strategy
-2( decides the loc# to $e applied $ased on the follo"ing:
1 'oc# si)e declared at the time of ta$le space creation
( !ype of SV' statement N S+'+&! or 6P-1!+

Mainframe Refresher Part-1 Page:155

= +5plicit '/&* statement in the program
K 1&V6IR+ and R+'+1S+ option chosen $y user at the 2I7- time
A Isolation level specified at $ind time
M !he 76M'*!S and 76''*6S limit
7ormali)ation
-ata 7ormali)ation descri$es the process of designing a data$ase and
organi)ing data to ta#e $est advantage of relational data$ase principles It is the
process of putting one fact in one appropriate place !his optimi)es the updates at
the e5pense of retrievals
0hen a fact is stored in only one place8 retrieving many different $ut related
facts usually re3uires going to many different places !his tends to slo" the retrieval
process $ut update is easy and faster as the fact you are updating e5ists in only one
place
!he process involves five levels !a$les are usually normali)ed till level three
&olumns should $e automatic and
Remove repeating groups
Remove dependence of non-#ey
&olumn(s) on part of the #ey
(Partial -ependence)

6n normali)ed -ata
First 7ormal Form
Mainframe Refresher Part-1 Page:156

Remove dependence of non-#ey
&olumn(s) on other non-#ey columns
(!ransitive -ependence)
!he three levels can $e memori)ed using the statement $elo":
[ !he values in a ro" are dependant on the #ey8 the "hole #ey8 and nothing
$ut the #ey8 so help me &/--\
In the fourth level8 multi-valued dependencies are removed and in the fifth level8
remaining anomalies are removed
-e-normali)ation
-e-normali)ation is the process of putting one fact in more than one place It
is the reverse process of normali)ation !his "ill speed up the retrieval process at the
e5pense of data modification -e-normali)ation is not a $ad decision "hen a
completely normali)ed design is not performing optimally
System &atalog !a$les
-2( catalog is contained in a single data$ase (-S7-2>M) !he AK ta$les in
the -2( catalog collectively descri$e the o$Qects and resources availa$le to -2(
Prior to :ersionA8 there "as an additional data$ase called &ommunication
-ata$ase (&-2) "as used for esta$lishing and documenting distri$uted -2(
connections In the version A8 it has $een renamed and rolled into -2( catalog
+ach and every ta$le has its o"n importance So e5plaining all the ta$les and
the columns in it is highly impossi$le Refer the 3uery section to #no" a$out some of
the fre3uently used 3ueries on S,SI2M ta$les
1 S,SI2MS,S-6MM,1 is a dummy ta$le 0hen you "ant to do some arithmetic
operation or retrieving system information li#e current-date8 you can 3uery this
ta$le
S+'+&! 1>(A?(>(A FR/M S,SI2MS,S-6MM,1@
( 0hen a -2RM is $ound to P'178 all the SV' statements are placed into
S,SS!M!-2( ta$le 0hen a -2RM is $ound to P1&*1B+8 all of its SV'
statements are placed into S,SP1&*S!M! ta$le Information a$out the -2RMS
that "ere $ound to P'17 or P1&*1B+8 are stored in S,S-2RM ta$le -2RM Qust
created $ut not yet $ound is not registered any"here (Remem$er8 pre-compiler
don;t use -2( at all and -2RM is an output of pre-compiler)

Second 7ormal Form
!hird 7ormal Form
Mainframe Refresher Part-1 Page:157

= Information a$out plan is stored in S,S-2RM8 S,SP1&*16!.8 S,SP1&*'IS!8
S,SP'178 S,SP'17-+P8 S,SP'1716!.8 S,SP'S,S!+M8 S,SS!M! and
S,S!1216!.
K Information a$out the pac#age is stored in S,SP1&*1B+8 S,SP1&*16!.8
S,SP1&*-+P8 S,SP'S,S!+M8 S,SS!M! and S,S!216!.
A -2( &atalog stores only information a$out the P'17 !he e5ecuta$le form of
P'178 called S#eleton cursor ta$le (S*&!)8 is stored in the -2( directory in the
S,SI2MS&!>( ta$le
M Information a$out !a$le space% !a$le and Inde5es are stored in the follo"ing
!a$les
S,S!12'+SP1&+
S,S!12'+S S,S!12'+P1R!
S,S&/'6M7S S,SR+'S S,SI7-+4+S S,S&/'6M7S S,S!216!.
S,SFI+'-S S,S'I7*S S,SI7-+4P1R! S,S&/'16!.

S,S&/'-IS! S,SF/R+IB7*+,S S,S*+,S

S,S&/'-IS!S!1!S
S,S!12S!1!S
S,SI7+4S!1!S
!riggers (1vaila$le in version M)
!rigger is a piece of code that is e5ecuted in response to a data modification
statement (insert%update%delete) !o $e a $it more precise: triggers are event-
driven speciali)ed procedures that are stored in8 and managed $y the R-2MS +ach
trigger is attached to a single8 specified ta$le !riggers can $e thought of as an
advanced form of _rule_ or _constraint_ "ritten using an e5tended form of SV'
!herefore triggers are automatic8 implicit8 and non-$ypass a$le
7ested !riggers
1 trigger can also contain insert8 update8 and delete logic "ithin itself
!herefore8 a trigger is fired $y a data modification8 $ut can also cause another data
modification8 there$y firing yet another trigger 0hen a trigger contains insert8
update8 and%or delete logic8 the trigger is said to $e a nested trigger Most -2MSs8
ho"ever8 place a limit on the num$er of nested triggers that can $e e5ecuted "ithin
a single firing event If this "ere not done8 it could $e 3uite possi$le to having
triggers firing triggers ad infinitum until all of the data "as removed from an entire
data$ase^
!riggers cannot $e attached to the follo"ing ta$les:
1 System &atalog !a$le8 P'17a!12'+8 S!1!+M+7!a!12'+8 -S7aF67&!I/7a!12'+
:ie"8 1lias8 Synonym8 1ny ta$le "ith a three-part name

Mainframe Refresher Part-1 Page:158

!rigger in place of RI
!riggers can $e coded8 in lieu of declarative RI8 to support 1'' of the RI rules
0e can specify only /7 -+'+!+ rules in the --' statement 6P-1!+ and I7S+R!
rules of RI can $e implemented using triggers
Sample !rigger:
&R+1!+ !RIBB+R S1'1R,a6P-1!+
2+F/R+ 6P-1!+ /F S1'1R,
/7 +MP
F/R +1&. R/0 M/-+ -2(SV'
0.+7 (7+0S1'1R, G (/'-S1'1R, ? 1A))
2+BI7 1!/MI&
SIB71' SV'S!1!+ YIA>>1Y (YRaise e5ceeds A>`Y)@
+7-@

!he trigger e5ecutes once for each ro" So if multiple ro"s are modified $y a
single update8 the trigger "ill run multiple times8 once for each ro" modified 1lso8
the trigger "ill $e run 2+F/R+ the actual modification occurs Finally8 ta#e special
notice ho" 7+0 and /'- are used to chec# values $efore and after the update
!riggers :s Stored Procedures
!riggers are also similar to stored procedures 2oth consist of procedural logic
that is stored at the data$ase level .o"ever8 stored procedures are not event-driven
and are not attached to a specific ta$le 1 stored procedure is e5plicitly e5ecuted $y
invo#ing a &1'' to the procedure (instead of implicitly $eing e5ecuted li#e triggers)
1dditionally8 a stored procedure can access many ta$les "ithout $eing specifically
associated to any of them -2( has supported stored procedures since :ersion K
-2( 6tilities
Most of the time8 application programmer doesn;t need any #no"ledge on
-2( utilities 2ac#up8 Reorgani)ation8 Recovery and maintenance of data$ase are
ta#en care $y the -21 of the proQect
-2( utilities are $riefed here to Qust familiar "ith it
-S76PR/& is the -2( catalogued procedure that e5ecutes the program -S76!I'2
-S76!I'2 is a master program and it calls other programs $ased on the first "ord of
control card !he first "ord of control card should $e utility that needs to $e invo#ed
Most of the -2( 6tility programs are divided into four maQor categories
6tility Purpose
&/P,
(2ac#up and
Recovery)
It is used to create image copy $ac#up dataset for a complete
ta$le space or a single partition of a ta$le space It can $e of
type F6'' or incremental 2ased on num$er of modified pages
after the previous $ac#up8 prefer F6'' or incremental image
copy Successful copy details are loaded in S,SI2MS,S&/P,
M+RB+&/P,
(2ac#up and
It is used to create full image copy from incremental image
copies

Mainframe Refresher Part-1 Page:159

Recovery)
V6I+S&+
(2ac#up and
Recovery)
It is used to record a point of consistency for related
application or system ta$les 6sually done $efore image copy
R+&/:+R
(2ac#up and
Recovery)
It is used to restore -2( ta$le space and inde5es to a specific
point in time It uses image copy and -2( logs information to
roll $ac# the ta$le space content to the old one R+&/:+R
I7-+4 generated ne" inde5 data from current ta$le space
data It is actually regeneration than restoring So it is
follo"ed $y R+&/:+R, !12'+SP1&+8 "hich is restoring
'/1-
(-ata
/rgani)ation)
It is used to accomplish $ul# inserts to -2( ta$les It can add
ro"s to a ta$le retaining the current data or it can replace the
e5isting data "ith ne" data
R+/RB
(-ata
/rgani)ation)
It is used to re-clustering the data in ta$le space and resetting
the free space to the amount specified in the &R+1!+ --' and
deletes and redefining :S1M datasets for S!/BR/6P defined
o$Qects
&.+&*8 R+P1IR8
R+P/R!8
-I1B7/S+
!hese are data consistency utilities !hey are used to monitor8
control and administer data consistency errors
R67S!1!S
(&atalog
Manipulation
6tility)
It collects statistical information for -2( ta$les8 ta$le spaces8
partitions8 inde5es and columns It places this information into
-2( catalog ta$les !he -2( optimi)er uses the data in these
ta$les to determine optimal access path for the SV' 3ueries
&1!M1I7!8 M/-IF, and S!/SP1&+ are the other catalog
manipulation utilities
.o" the load card of '/1- utility loo#s]
'/1- -1!1 I7--7(S,SR+&) '/B(7/) 7/&/P,P+7-
R+S6M+ ,+S CG Resumes all the records from first to last
+7F/R&+ &/7S!R1I7!S
I7!/ !12'+ -21+MP!12'+
(+MP71M+ P/SI!I/7(1) &.1R((>)8
+MP1--R+SS P/SI!I/7((A) :1R&.1R
+MPPR/P+&! P/SI!I/7(A>) &.1R(=))
R+S6M+ ,+S CG Resumes all the records from first to last
R+S6M+ 7/ CG !a$le should $e empty
R+P'1&+ CG It overrides the previous record set "ith current record set
S,SR+& dataset should contain
1 (A A>
4444 44444444444444444444 44444
,,,,, ,,,,,,,,,,, ,,,,,

Mainframe Refresher Part-1 Page:160

'/1- -ata statement descri$es the data to $e loaded In the a$ove e5ample8
S,SR+& is coded and it should $e one of the --71M+ in P&'8 "hich points to actual
dataset
-ata are loaded in the order they appear in the dataset 1utomatic data conversion
$et"een compati$le data types is done if needed
0hat are &/P, P+7-I7B and &.+&* P+7-I7B status]
&/P, P+7-I7B and &.+&* P+7-I7B status on the ta$le space restricts any
updates on ta$le space
If you '/1- or R+/RB the ta$le space "ith the option '/B 7/8 then the ta$le
space get into &/P, P+7-I7B status !he meaning is8 an image copy is needed on
the ta$le space
If you '/1- the ta$le space "ith +7F/R&+ 7/ option8 then the ta$le space
get into &.+&* P+7-I7B status !he meaning is ta$le space is loaded "ithout
enforcing constraints &.+&* utility needs to $e run on the ta$le space
&/P, 6tility
&/P, !12'+SP1&+ +-S-2!RB>>I!S
F6'' ,+S T7/ ,+S F/R F6'' IM1B+ and 7/ F/R I7&R+M+7!1'
S.R'+:+' &.17B+

Mainframe Refresher Part-1 Page:161

M+RB+&/P, 6tility
M+RB+&/P, !12'+SP1&+ +-S-2!RB>>I!S
7+0&/P, (,+S% 7/)
,+S Merging all the incremental copies "ith the availa$le full image copy and
creates a ne" image copy
7/ Merging all the incremental copies and prepares a single incremental image
copy
R+P1IR 6tility
%%-S76PR/&S,SI7 ?
R+P1IR /2P+&! '/B ,+S S+! !12'+SP1&+ 7P&2!&>>!1SS+M>1 7/&/P,P+7-
%?
!his card repairs the ta$le space 7P&2!&>>!1SS+M>1 and clears the copy pending
status on the ta$le space
R67S!1!S 6tility
%%S,SI7 -- ?
R67S!1!S !12'+SP1&+ 7P&2!&>>!1SS+M>1
!12'+ (7P&2!O!S!1S!+M>1)
&/'6M7 (7P18 !+'7/8 &'SaM/8 !Ra&R!aM/8 !Ra&R!a,,8
S:&1a!,P8 RP!1a!,P8 SR&1a!,P8 &'RaM/8 &'Ra-,)
I7-+4 (1'')
S.R'+:+' &.17B+
R+P/R! ,+S 6P-1!+ 1''
%?
R+26I'-%R+&/:+R%R+/RB and &.+&* -1!1 6tility
R+26I'- I7-+4 (1'') !12'+SP1&+(7P&2!O-27P&SI>11)
S/R!*+,S
R+&/:+R !12'+SP1&+ 7P&!!O-27P&SO>K(
R+/RB !12'+SP1&+ 7P&!!O-27P&SI>KJ
67'--7 S,SR+
S/R!-+:! S,S-1 S/R!76M K
0/R*--7(S,S6!18SR!/6!)

&.+&* -1!1 !12'+SP1&+ 7P&!!O-27P&SI>1=
S/R!-+:! S,S-1 S/R!76M K
0/R*--7(S,S6!18SR!/6!)
V6I+S&+ &ard:
V6I+S&+
!12'+SP1&+ 7P&2!O>>7P&S1>>(
!12'+SP1&+ 7P&2!O>>7P&S1>>K

Mainframe Refresher Part-1 Page:162

S!1R! -ata$ase:

-S7 S,S!+M(-2(4)
S!1R! -1!121S+(7P&2!O>>) SP1&+71M(7P&S1>>1) 1&&+SS(R/)
S!1R! -1!121S+(7P&2!O>>) SP1&+71M(7P&S1>>() 1&&+SS(R/)
+7-

SV' N Buidelines for $etter performance
1 Pre-test all your 3ueries in SP6FI or VMF $efore placing in program
( 1void 3ualifiers for the ta$les in the program Bive it on the 2I7- card
= 6nless really needed8 avoid usage of -IS!I7&!8 67I/7 and /R-+R 2,
K 1void 0.+7+:+R
A &ode predicates on inde5-a$le columns N &ode the most restrictive predicated
first N 6se e3uivalent data types in the predicates
M -o not use arithmetic e5pressions in a predicate N -2( "ill not use inde5 in
this case
I Prefer 2+!0++7 in stead of <FC < and <GC;
J Prefer <I7; in stead of <'I*+;
O 1void the usage 7/! (+5cept "ith 7/! +4IS!S)
1> Poin using SV' instead of programming logic
11 6se P/I7S than Su$-3uery
1( Minimi)e the num$er of ta$les in the P/I7
1= 0hen a S+'+&! statement is coded8 use F/R F+!&. /7', !his ena$les $loc#
fetch option -2( and leads to efficient retrieval
1K If the cursor is used for update8 use F/R 6P-1!+ /F clause in -+&'1R+
statement itself
1A !hough -+&'1R+ &6RS/R can $e given in procedure division8 code it in
"or#ing storage section as a good practice -+&'1R+ cursor is not an
e5ecuta$le statement and procedure division is for e5ecuta$le statements
1M For e5istence chec#ing8 use constant (0.+R+ +4IS!S (S+'+&! 1 FR/M
!121)
1I Bive a thought on dropping inde5es $efore large insertions It avoids
unorgani)ed inde5es and poor performance
1J -on;t 6S+ Select ? - If there is any change in -2( ta$le structure8 then the
program needs to $e modified though it doesn;t need the field
!here is unnecessary I-/ overhead
1O -o the arithmetic operations "hile selecting the column(s) than doing in
programming language

Mainframe Refresher Part-1 Page:163

Famous SV' Vueries
First and second ma5imum salary of +MP!12'+
S+'+&! M14(S1'1R,) FR/M +MP!12'+
S+'+&! M14(S1'1R,) FR/M +MP!12'+
0.+R+ S1'1R, F (S+'+&! M14(S1'1R,) FR/M +MP!12'+)
7th ma5imum salary from +MP!12'+
S+'+&! S1'1R, FR/M +MP!12'+ 1
0.+R+ 7 C (S+'+&! &/67!(?)FR/M +MP!12'+ 2
0.+R+ 2S1'1R, GC 1S1'1R,)
.o" do you calculate day of the "ee#]
S+'+&! -1,S(-1!+(:0S-SV'--!1))-(-1,S(-1!+(:0S-SV'--!1))%I) ? I
I7!/ :0S--1,-/F-0++*
FR/M S,SI2MS,S-6MM,1
>-M means S67-1, to S1!6R-1, respectively
.o" do you get current date in -2(]
S+! :0S-&6RR+7!--1!+ C &6RR+7! -1!+
Sample 3uery to concatenate t"o columns
S+'+&! <Mr; TTFIRS!a71M+TTS!Fa'1S!a71M+
I7!/ :0S-6S+R-7M
FR/M &RSaS!1FF
0.+R+ S!Fa&/-+ C :0S-I-6S+R-I-
.o" do I get the primary #ey of a ta$le]
S+'+&! 71M+
FR/M S,SI2MS,S&/'6M7S
0.+R+ !2&R+1!/R C F!12'+ &R+1!/R 71M+G
17- !271M+ C F!12'+ 71M+G
17- *+,S+V G >
/r
S+'+&! 1&/'71M+8
1&/'S+V8
1/R-+RI7B8
FR/M S,SI2MS,S*+,S 18
S,SI2MS,SI7-+4+S 2
0.+R+ 1I471M+ C 271M+

Mainframe Refresher Part-1 Page:164

17- 1I4&R+1!/R C 2&R+1!/R
17- 1I4&R+1!/R C 2!2&R+1!/R
17- 2!271M+ C F!12 71M+G
17- 2!2&R+1!/R C F!12 &R+1!/RG
17- 267IV6+R6'+ C <P;

.o" do I get the list of affected programs due to a ta$le change]
S+'+&! BR17!++ _PR/BR1M_8 !!71M+ _!12'+ 71M+_8 S+'+&!16!. _S+'+&!_8
I7S+R!16!. _I7S+R!_8 6P-1!+16!. _6P-1!+_8 -+'+!+16!. _-+'+!+_
FR/M S,SI2MS,S!1216!.
0.+R+ BR17!++!,P+C YPY
17- !&R+1!/RC F!12'+ &R+1!/R 71M+G
17- !!71M+ C F!12'+ 71M+G
/R-+R 2, PR/BR1M
!o get the affected Plan names if an inde5 is dropped
S+'+&! 271M+8 2&R+1!/R8 2!,P+8 -71M+
FR/M S,SI2MS,SP'17-+P
0.+R+ 2!,P+ C <I;
17- 271M+ C FInde5 name to $e -roppedG
S,SP'17-+P ta$le records the dependencies of plans on ta$les8 vie"s8 aliases8 synonyms8
ta$le spaces8 inde5es8 functions8 and stored procedures
271M+ - !he name of an o$Qect the plan depends on
2!,P+ - !ype of o$Qect identified $y 271M+:
1 1lias8 F 6ser-defined function or cast function8 I inde58 S Synonym
! ta$le8 P Partitioned ta$le space8 R-!a$le space8 :- :ie"s8 /-Stored Procedure
-71M+ - 7ame of the plan
For pac#age dependency8 3uery S,I2MS,SP1&*-+P
!o get the vie" definition
S+'+&! 71M+8 &R+1!/R8 S+V7/8 !+4!
FR/M S,SI2MS,S:I+0S
0.+R+ 71M+ C F:I+0 71M+G
S+V7/ - IF !.+ :I+0 -+FI7I!I/7 IS M/R+ !.17 /7+ 'I7+
!+4! - :I+0 -+FI7I!I/7
!o get the !a$le%:I+0%1lias details
S+'+&! 71M+8 !,P+8 &R+1!/R8 &/'&/67!8 !2&R+1!/R8 !271M+8
*+,&/'6M7S8 &R+1!+-!S8 1'!+R+-!S8 &R+1!+-2,
FR/M S,SI2MS,S!12'+S
0.+R+ 71M+ C F!12'+ or :ie" or 1lias 7ameG

Mainframe Refresher Part-1 Page:165

17- &R+1!/R C F !12'+ or :ie" or 1lias &reatorG
!,P+ C ! (!a$le) or 1 (1lias) : (:ie") B (!emporary !a$le)
&/'&/67! - 7/ /F &/'6M7S - only for !a$les 17- :ie"s (> for 1lias)
R+&'+7B!. - Record length - only for !a$les (> for 1lias and :ie"s)
!2&R+1!/R (F/R 1'I1S) - 1&!61' !12'+ &R+1!/R
!271M+ (F/R 1'I1S) - 1&!61' !12'+ 71M+
*+,&/'6M7S - 7o of Primary *eys
.o" do I get all the o$Qects used $y a plan]
S+'+&! 271M+8 2!,P+ FR/M S,SI2MS,SP'17-+P 0.+R+ -71M+CP'17-71M+
.o" do I get all the inde5es for the ta$le]
S+'+&! 71M+8 &/'&/67!8 67IV6+R6'+8 &'6S!+RI7B FR/M S,SI2MS,SI7-+4+S
0.+R+ !271M+C!12'+-71M+
67IV6+R6'+ N <P; (Primary) <6; (1lternate)
&'6S!+RI7B N ,+S for clustering inde5
Bive an e5ample for Self Poin
+mployee ta$le has +mployee 7o8 +mployee 7ame8 Manager 7ame and other details
of employee I "ant to #no" all the employees and their managers
S+'+&! 1+MP71M+8 2M171B+R71M+
FR/M +MP!12'+ 18 +MP!12'+ 2
0.+R+ 1M171B+RI- C 2+MP7/
.o" do I get the difference $et"een t"o timestamps in num$er of seconds]
S+'+&! (((-1,S (!S() - -1,S (!S1)) ? JMK>>) L
((./6R (!IM+ (!S()) - ./6RS (!IM+ !S1))) ? =M>>) L
((MI76!+ (!IM+ (!S()) - MI76!+ (!IM+ (!S1))) ? M>) L
(S+&/7- (!IM+ (!S()) - S+&/7- (!IM+ (!S1))))
FR/M S,SI2MS,S-6MM,1@
In the first part8 you su$tract the start time from the end time8 deriving the num$er of
days $et"een the timestamps ,ou then multiply the num$er of days $y JMK>>8 the
seconds in a day8 to convert the days to the num$er of seconds
S+'+&! (-1,S (!S() - -1,S (!S1)) ? JMK>>

In the second part8 you derive the additional time (hours8 minutes8 and seconds8 list in
hhmmss format) $et"een the timestamps and convert the time to the num$er of
seconds First you need to e5tract and convert the hours to seconds:
S+'+&! (./6R (!IM+ (!S()) - ./6RS (!IM+ !S1))) ? =M>>
7e5t you need to e5tract and convert the minutes to seconds:
S+'+&! (MI76!+ (!IM+ (!S()) - MI76!+ (!IM+ (!S1))) ? M>
!hen you e5tract the remaining seconds:
S+'+&! S+&/7- (!IM+ (!S()) - S+&/7- (!IM+ (!S1))
'astly8 you add all partial results to produce the difference $et"een the t"o
timestamps in total num$er of seconds
Selected -2(-command panel commands: (/ption I of -2(I)

Mainframe Refresher Part-1 Page:166

--IS -2(-S7-2>1)
-isplays all the components in the -ata$ase -S7-2>1 and their status
--IS -2(-S7-2>1) SP1&+76M(555)
-isplays information a$out specific ta$le space%inde5 space(555) of data$ase
-S!1 -2(-S7-2>1)
Starts the data$ase -S7-2>1
-S!1 -2(-S7-2>1) SP1&+76M(555)
Start a specific ta$les pace%inde5 space of a data$ase
SP6FI- SV' Processing 6sing File Input
/ption 1 of -2(I panel ta#es you to SP6FI panel
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
G G
G !S#ESP01 SP"FI SSI!4 !S# G
G ===J G
G E@teB t6e >@=ut 9;t; set @;8e4 (C;@ Ee seLue@t>;A ?B =;Bt>t>?@e9) G
G 1 !+T+ SET #+ME''''' ===J MSMSX*,2'!B&'SP"FI'I#P"T(MEM1) G
G & VO*"ME SERI+*''''' ===J (E@teB >C @?t :;t;A?He9) G
G 3 !+T+ SET P+SS-OR!' ===J (E@teB >C =;ssK?B9 =B?te:te9) G
G G
G E@teB t6e ?ut=ut 9;t; set @;8e4 (Must Ee ; seLue@t>;A 9;t; set) G
G 4 !+T+ SET #+ME''''' ===J MSMSX*,2'!B&'SP"FI'O"TP"T G
G G
G S=e:>C7 =B?:ess>@H ?=t>?@s4 G
G / C$+#GE !EF+"*TS''' ===J (/# . !>s=A;7 SP"FI 9eC;uAts =;@eAO) G
G 2 E!IT I#P"T'''''''' ===J (/# . E@teB SQ* st;te8e@tsO) G
G 5 EXEC"TE''''''''''' ===J (/# . E<e:ute SQ* st;te8e@tsO) G
G , +"TOCOMMIT'''''''' ===J (/# . C?88>t ;CteB su::essCuA Bu@O) G
G 0 BRO-SE O"TP"T''''' ===J (/# . BB?Kse ?ut=ut 9;t; setO) G
G G
G F?B Be8?te SQ* =B?:ess>@H4 G
G 10 CO##ECT *OC+TIO# ===J G
G G
G G
G PRESS4 E#TER t? =B?:ess E#! t? e<>t $E*P C?B 8?Be >@C?B8;t>?@ G
G G
GNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
<SMS4'JM-2(SP6FII7P6!(M+M1); N It is my dataset "here I am going to code
SV' statements I "ant to e5ecute If I already have my 3uery in this dataset8 then
I "ill set +-I! I7P6! option as <7;
<SMS4'JM-2(SP6FI/6!P6!; - /utput of the SV' statement is received here 0e
no need to allocate the dataset
If 16!/&/MMI! is <,;8 then all the changes made to -2( using SV' statements are
committed on successful e5ecution of the 3uery
If you set the option &.17B+ -+F16'!S to <,;8 then you "ill get the screen "ith
SP6FI default values !he SP6FI allo"s you to set the values for:

Mainframe Refresher Part-1 Page:167

1 Isolation level and Ma5imum num$er of lines to $e returned from a S+'+&!
( /utput dataset characteristics
= /utput format characteristics (-efining length of numeric and character
column8 defining headers in your output file)
VMF (Vuery Management Facility)
Most of the installations use SP6FI for pre-testing the SV' statements
SP6FI comes "ith -2( product Some installation use VMF for their SV' operations
VMF provides greater fle5i$ility and lot of options in generating the result of the
3uery in a formatted output of report style
&o$ol--2( &ompilation P&'
//+PIJ1!B JOB (TV!&TM%3B4&)%CO#!=(4%*T)%
// MSGC*+SS=%C*+SS=X%#OTIF=PSS"I!
//*********************************************************************
//* I#STRE+M PROCE!"RE FOR COMPI*+TIO# Q PRECOMPI*E STEP
//*********************************************************************/
/PRECOMP EXEC PGM=!S#$PC%P+RM=1$OST(COBO*)1%REGIO#=4002K
//!BRM*IB !! !ISP=O*!%!S#=+PIJ1'TSTI#!I+'!BRM*IB(PSE*ECT&)
//STEP*IB !! !ISP=S$R%!S#=!&TB'!S#EXIT
// !! !ISP=S$R%!S#=!&TB'!S#*O+!
//SSI# !! !ISP=S$R%!S#=+PIJ1'TSTI#!I+'JC*(PSE*ECT&)
//SSCI# !! !ISP=(#E-%C+T*G%C+T*G)%
// !S#=+PIJ1'PRECOMP'*IST%"#IT=SS!+%
// SP+CE=(,00%(/00%/00))
//SS*IB !! !ISP=S$R%!S#=+PIJ1'TSTI#!I+'COBO*
// !! !ISP=S$R%!S#=+PIJ1'TSTI#!I+'!C*GE#
//SSPRI#T !! SSO"T=*
//SSTERM !! SSO"T=*
//SS"!"MP !! SSO"T=*
//SS"T1 !! SP+CE=(,00%(/00%/00)%%%RO"#!)%"#IT=SS!+
//SS"T& !! SP+CE=(,00%(/00%/00)%%%RO"#!)%"#IT=SS!+
//*
//*********************************************************************/
/* I#STRE+M PROCE!"RE FOR COMPI*+TIO# Q COMPI*E STEP
//*********************************************************************
//COBCOMP EXEC PGM=IGCRCT*%CO#!=(4%*T%PRECOMP)
//SSI# !! !S#=PP!S#$O"T%!ISP=(O*!%!E*ETE)
//SS*I# !! !S#=PP*O+!SET%!ISP=(MO!%P+SS)%"#IT=SS!+%
// SP+CE=(,00%(P-SPC%P-SPC))
//SSPRI#T !! SSO"T=*
//SS"!"MP !! SSO"T=*
//SS"T1 !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T& !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T3 !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T4 !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T/ !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T2 !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+
//SS"T5 !! SP+CE=(,00%(P-SPC%P-SPC)%%%RO"#!)%"#IT=SS!+

Mainframe Refresher Part-1 Page:168

//*********************************************************************
//* I#STRE+M PROCE!"RE FOR COMPI*+TIO# Q *I#KE!IT STEP
//*********************************************************************
//*KE! EXEC PGM=IE-*%P+RM=1XREF1%
// CO#!=((4%*T%COBCOMP)%(4%*T%PRECOMP))
//SS*IB !! !S#=SS&'COB&*IB%!ISP=S$R
// !! !ISP=S$R%!S#=!&TB'!S#*O+!
//SS*I# !! !S#=PP*O+!SET%!ISP=(O*!%!E*ETE)
//SS*MO! !! !ISP=O*!%!S#=P"SER''TSTI#!I+'*O+!S(PMEM)
//SSPRI#T !! SSO"T=*
//SS"!"MP !! SSO"T=*
//SS"T1 !! SP+CE=(10&4%(/0%/0))%"#IT=SS!+
// PE#!
//*
//*********************************************************************
//*I#VOKI#G I#STRE+M PROCE!"RE FOR COMPI*I#G COBO*.!B& PROGR+M'
//*********************************************************************
//COMP EXEC !S#$COB%
// MEM=!#SQ*0&%
// "SER=+PIJ1%
// P+RM'PRECOMP=1$OST(COBO*)%Q"OTE%SO"RCE%XREF1%
// P+RM'COBCOMP=1Q"OTE%SO"RCE%#O!#+M1%
// P+RM'*KE!=1*IST%XREF1
//PRECOMP'SSI# !! !S#=P"SER''TSTI#!I+'COBO*(PMEM)%!ISP=S$R
//PRECOMP'!BRM*IB !! !S#=P"SER''TSTI#!I+'!BRM*IB(PMEM)%!ISP=S$R
//PRECOMP'SS*IB !! !S#=P"SER''TSTI#!I+'!C*GE#%!ISP=S$R
//*KE!'SS*MO! !! !S#=P"SER''TSTI#!I+'*O+!S(PMEM)%!ISP=S$R
//*KE!'SSI# !! *
I#C*"!E SS*IB(!S#E*I)
//*********************************************************************
//*BI#!.P*+# STEP'
//*********************************************************************
//BI#! EXEC PGM=IKJEFT01%!#+M#BR=&0
//STEP*IB !! !S#=!&TB'!S#*O+!%!ISP=S$R
//SSTSPRT !! SSO"T=*
//SSO"T !! SSO"T=*
//!BRM*IB !! !S#=+PIJ1'TSTI#!I+'!BRM*IB(!#SQ*0&)%!ISP=S$R
//SSTSI# !! *
!S# SSTEM(!&TB) RETR(&)
BI#! P*+#(+PIJ1P1) MEMBER(!#SQ*0&) .
O-#ER(+PIJ1) ISO*+TIO#(CS) +CTIO#(REP*+CE)
/*
S;8=Ae BI#! P;:F;He C;B9 ;@9 Bes=e:t>Ie BI#! PA;@ :;B9 -IT$ R"# :?88;@9
//BI#! EXEC PGM=IKJEFT01%!#+M#BR=&0
//STEP*IB !! !S#=!&TB'!S#*O+!%!ISP=S$R
//!BRM*IB !! !S#=!P'!BRM*IB%!ISP=S$R
//SSTSI# !! *
!S# SSTEM(!S#P)
BI#! P+CK+GE(SOCCO**) MEMBER(SOC0&P01) O-#ER(SOC) 3
+CTIO#(REP*+CE) V+*I!+TE(BI#!) ISO*+TIO#(CS)
E#!

Mainframe Refresher Part-1 Page:169

//*
//STEP1 EXEC PGM=IKJEFT01%!#+M#BR=&0%CO#!=(4%*T)
//SSTSPRT !! SSO"T=*
//SSPRI#T !! SSO"T=*
//SSTSI# !! *
!S# SSTEM(!S#P)
BI#! P*+#(SOCB+TC$) PK*IST(SOCCO**'*) +CTIO#(REP*+CE) 3
RET+I# +CQ"IRE("SE) RE*E+SE(COMMIT) 3
ISO*+TIO#(CS) V+*I!+TE(BI#!) #O!EFER(PREP+RE) 3
C+C$ESIDE(0)
E#!
//*
//JS01 EXEC PGM=IKJEFT01%!#+M#BR=&0%CO#!=(4%*T)
//STEP*IB !! !S#=!&TB'!S#*O+!%!ISP=S$R
//SSTSI# !! *
!S# SSTEM(!S#P)
R"# PROGR+M(SOC0&P01) P*+#(SOCB+TC$) *IB(1!P'GO*IB1)
E#!
//

Mainframe Refresher Part-1 Page:170

&ustomer Information &ontrol System
&I&S

Mainframe Refresher Part-1 Page:171

&I&S (Customer Information Control System)
.istory
I2M launched the initial version of &I&S in 1OMJ
It is a -ata$ase%-ata &ommunication &ontrol System "here an application program
can concentrate on the application processing "ithout "orrying a$out /S8 hard"are
and others Initially &I&S "as on macro level and later upgraded to command level
!his $oo# is "ritten $ased on &I&S%M:S :(R=
!as# and !ransaction
!as# is a unit of "or# and transaction is an entity that initiates the e5ecution
of tas# !he transaction identifier identifies the transaction in &I&S

&onversation and Pseudo conversation
Program can communicate "ith user $y a pair of S+7- and R+&+I:+
commands 2ut in $et"een the S+7- and R+&+I:+8 that is during the human
response time8 all the resources are held $y the program
/nce the user entered the information in the screen8 the program proceeds
further !his mode of communication is called &onversational mode It is un-famous
for the resource "astage
In Pseudo conversation mode8 "henever there is a need for conversation "ith
user8 the program logically terminates there8 releases the resources held $y it and
pass control information to ne5t transaction and the ne5t transaction is automatically
started once user entered the information in the screen
It is actually multi tas# operation $ut loo#s li#e conversation from user point
of vie"
For easy understanding "e "ould say the communication in telephone line is
conversational mode (!elephone line is in usage through out the communication)
IR& as Pseudo conversation (/nce the message sent8 the line is freed and it again
gets the resources "hen the other side replied)
Multitas#ing and Multithreading
/perating system allo"s e5ecution of more than one tas# concurrently and
this is called multitas#ing If the one or more concurrent tas#s use the same copy of
the program8 then this is called multithreading So it is o$vious that multitas#ing is a
su$set of multithreading
Reentrant and Vuasi-reentrant
If the same copy of the program is used $y multiple tas#s8 then the system
should ta#e care of the proper reentrance after the S:&%&I&S interruption
Reentrant program is defined as a program that does not modify itself so that
it can reenter to itself and continue processing after an interruption $y the S:& call
of /S 2atch programs are non-reentrant Reentrancy under &I&S environment is
called 3uasi entrant as the interruption in &I&S may involve more than one S:& calls
or no S:& at all


Mainframe Refresher Part-1 Page:172

&/2/' programs should $e compiled "ith R+7! option for reentrancy in
multithreading environment
&I&S &ontrol Program and &ontrol !a$les
&I&S 7ucleus consists of I2M-Supplied &I&S control programs and
corresponding user-specified &I&S control ta$les !he important ta$les "ith respect
to developer point of vie" are given $elo":
&ontrol
!a$le
Function
P&! !he transactions and the main program associates "ith the transaction
should $e registered in Program ta$le !as# control Program (*&P)
refers P&!
PP! 1ll the &I&S programs and Maps have to $e registered in Processing
Program !a$le Program &ontrol Program (P&P) refers PP!
F&! 1ll the :S1M files used in the &I&S programs has to $e registered in
File &ontrol !a$le File &ontrol Program (F&P) refers F&!
-&! !ransient data 3ueues should $e predefined in -estination &ontrol
!a$le !ransient -ata Program refers -&!
!S! If you "ant to recover !emporary storage 3ueues during system crash8
then they should $e registered in !emporary Storage !a$le
R&! If any -2( commands are used in the program8 then the P'17 should
$e registered here
S7! 6ser I- and Pass"ord should $e registered in Sign-/n-!a$le
!&! 1ll the terminals should $e registered in !erminal &ontrol !a$le
P'! 1ll the programs that need to $e automatically started during &I&S
start up and Shut do"n should $e listed in Program 'ist !a$le
P&! &ontrol information of system logs and Qournal files is stored in Pournal
&ontrol !a$le Pournal &ontrol Program refers to P&!
&I&S--2(-&/2/' Program N&ompilation
&/2/' programs cannot recogni)e &I&S commands So all the &I&S
commands are coded "ithin +4+& &I&S and +7--+4+& scope !he program is first
passed to &I&S !ranslator and the translator "ill convert all the &I&S commands to
&/2/' call statements and this modified source is passed to &/2/' compiler
If your Program has -2( commands then the se3uence of preparing load
module "ould $e -2( Pre-compiler8 &I&S !ranslator8 &/2/' &ompiler and 'in# editor
'ogically spea#ing the order of -2( precompiler and &I&S translator can $e reversed
also 2ut as a convention "e are first doing precompilation
If translation is done first8 &I&S translator tries to recogni)e to -2(
statements and "ould issue diagnostic messages !he other reason is8 most of the
programs do lot of -2( operations than &I&S operations So if you do pre-
compilation first8 all the -2( statements are converted into &/2/' call statements in
first phase itself and the translation time "ould $e less
&/2/'-&I&S programs should $e compiled "ith R+7! R+SI-+7! 7/-,71M
and 'I2 options
Beneral Synta5 of &I&S statement

Mainframe Refresher Part-1 Page:173

+4+& &I&S function
R(option (argument value)S
R(option (argument value)S
+7--+4+&
Restricted &/2/' commands in &I&S environment
/S S:& !riggering statements 1&&+P! &6RR+7!--1!+ -1!+ -1, -ISP'1,
I%/ statements /P+7 &'/S+ R+1- 0RI!+ R+0RI!+ -+'+!+
S!1R!
S/R! statement R+!6R7 R+'+1S+
:S &/2/' ( allo"s S!/P R67 and that returns control $ac# to &I&S
M1P -+SIB7
2efore get into program design8 let us see ho" maps (screens) are designed
in &I&S Most of the installations use tools li#e S-F for screen designing !he tools
generate 2MS macros for the designed screen 0e $rief the 2MS macros involved in
the map design 2MS is acronym for 2asic Mapping Support
M1P and M1PS+!
1 screen designed thru 2MS is called M1P /ne or a group of maps ma#es up
a M1PS+!
P.,SI&1' M1P 17- S,M2/'I& M1P
Physical maps control the screen alignment8 sending and receiving of
&/7S!17!S and data to and from a terminal !hey are coded using 2MS macros8
assem$led and lin# edited into &I&S '/1- 'I2R1R, !hey ensure the device
independence in application programs
Sym$olic maps define the map fields used to store the :1RI12'+ data
referenced in &/2/' program !hey are also coded used 2MS Macros 2ut after
assem$ling8 they are placed in a &/P, li$rary and then copied into &I&S programs
using &/P, statement !hey ensure device and format independence to the
application programs
2MS Macro &oding Sheet
Since 2MS map definitions are purely assem$ler macros8 the follo"ing coding
convention must me maintained
1 1> 1M I(
(1-J) 'a$el (1>-1A) Macro name (1M-I1) /perands I(-&ontinuation

Macro name !here are three macros used in 2MS coding
1 -F.MS- -efining Mapset
( -.M-I -efining Maps
= -F.M-F -efining Fields
1ll the 2MS coding starts "ith -F.MS- follo"ed $y one or more -F.M-I
/ne or more -F.M-F follo" -F.M-I

Mainframe Refresher Part-1 Page:174

'a$el: 'a$el is name of the operation If the macro is -F.MS-8 it specifies
map-set name If the macro is -F.M-F then it specifies field name
/perands: -efine the parameters for the macro $eing invo#ed
&ontinuation: &ontinuation of macro is achieved $y <4; in I(
nd
column of the
current line and continues from the 1M
th
column of ne5t line
&omments: &omment lines are indicated $y <?; in column 1 1 comment line
cannot $e placed $et"een continuation lines and comment lines cannot $e continued
2lan# lines: ,ou cannot have $lan# lines in the assem$ler program
-F.MS-
It is used to define a mapset "ith its characteristic and to end a mapset So
you "ill find t"o -F.MS- in any 2MS coding !he important operands are $elo":
!,P+
It should $e -S+&! for Sym$olic map generation8 M1P for physical map
generation and FI71' to indicate the end of mapset 1lternatively sym$olic
parameter 9S,SP1RM can $e coded in the !,P+ of defining -F.MS- and the value
can $e overridden in the P1RM parameter of assem$ly procedure !his avoids the
change in the 2MS coding
M/-+
I7 for input maps li#e order entry screens and /6! for output maps li#e
display screens and I7/6! for input-output maps li#e update screens
'17B
It specifies the language in "hich the sym$olic map is to $e generated It can
$e &/2/'8 P'I8 1SM or RPB
S!/R1B+
16!/ is used to ac3uire separate sym$olic map area for each mapset
21S+CM1P-I/1R+1 allo"s multiple maps from more than one mapset to share
same storage area M1P-I/1R+1 "ill $e redefined multiple times to achieve it
!I/1PF4
It should $e <,+S; to reserve the prefi5 space of 1( $ytes for 2MS commands
to access !I/1 properly !his is re3uired for command level &I&S
&!R'
-evice control re3uests are placed here Multiple parameters are separated $y
comma FR++*2 is used to unloc# the #ey$oard FRS+! is used to reset the M-! of
all the fields in all the maps to )ero 1'1RM is used to set an alarm at screen display
time PRI7! is used to send the mapset to printer
!+RM
If anything other than =(I> terminal is used for display of screens8 then it
should $e coded here !his ensures device independence $y means of providing the
suffi5 S6FFI4 is used to specify suffi5 for the terminal and it should correspond to
!&! entry of the terminal
-F.M-I

Mainframe Refresher Part-1 Page:175

It is used to define a map "ith its characteristic in a mapset !here can $e
any num$er of -F.M-I Some of the important operands of -F.M-I are $elo":
SIU+ It has t"o arguments namely length and $readth and as a "hole the
si)e of the map is specified here
'I7+ !he map starting line is mentioned here
&/'6M7 !he map-starting column "ithin the 'I7+ is mentioned here
P6S! RIB.! or '+F! is coded here to inform the Qustification of the map
"ithin mapset
!he a$ove four parameters decides the si)e and location of map "ithin map
set &!R' and !I/1PF4 can $e also coded in -F.M-I :alue of -F.M-I overrides the
value of -F.MS-
-F.M-F
It is used to define a field "ith its characteristic in a map !here can $e any
num$er of -F.M-F "ithin -F.M-I Some of the important operands of -F.M-F are
$elo":
P/S
It has t"o arguments that decided the position of the field !he t"o
arguments are line and column It is the position "here the attri$ute $yte of the field
starts
'+7B!.
!he length of the field is coded here It e5cludes the attri$ute character
1!!RI2
1ll the input and output fields are prefi5ed $y one $yte attri$ute field that defines
the attri$utes of the field Some of the attri$utes are:
1 1S*IP%PR/!%67PR/! Mutually e5clusive parameters that define the
type of the field 67PR/! is coded for input and input-output fields PR/! is
coded for output and stopper fields 1S*IP is coded for screen literals and
s#ipper fields !he cursor automatically s#ipped to ne5t field and so you
cannot enter data into s#ipper field
( 76M >-O8Period and N are the only allo"ed characters
= 2R!%7/RM%-R* Mutually e5clusive parameters that define the
intensity of the field
K I& Insert &ursor &ursor "ill $e positioned on display
of map If I& is specified in more than one field of a map8 the cursor "ill $e
placed in the last field
A FS+! Independent of "hether the field is modified or
not8 it "ill $e passed to the program M-! is set for the field
P6S!IF,
RIB.! is the default value &ode '+F! for numeric fields
PI&I7 and PI&/6!
It defines the Picture clause of the sym$olic map in &/2/' and useful for
numeric field editing
I7I!I1'

Mainframe Refresher Part-1 Page:176

!he default value of the field is coded here 0hen the M1P is sent8 this value
"ill appear in the field !he constant information li#e !I!'+ is coded using I7I!I1'
#ey"ord of field definition !o avoid data traffic8 these constant information fields
should not $e coded "ithout '12+' parameter If there is no '12+' parameter8 then
sym$olic map "ill not generated for those fields as they are unnamed fields
.o" a field loo#s li#e in a Sym$olic map
'et the la$el of one -F.M-F is +MP71M+ in the map +MP-+! and the length
of it is (> !he respective sym$olic map "ould loo# li#e follo"s
>1 +MP-+!I
>( FI''+R PI& 4(1() !I/1PF4 C ,+S creates this 1( $yte filler
>( +MP71M+L PI& SO(>K) &/MP 'ength Field
>( +MP71M+F PI& 4 Flag $yte
>( FI''+R R+-+FI7+S +MP71M+F
>= +MP71M+A PI& 4 1ttri$ute $yte
>( +MP71M+I PI& 4((>) 1ctual field (Input)
/ther fieldsZ
>1 +MP-+!/O R+-+FI7+S +MP-+!I
>( FI''+R PI& 4(1() !I/1PF4 C ,+S creates this 1( $yte filler
>( FI''+R PI& 4(>=)
>( +MP71M+O PI& 4((>) 1ctual field (/utput)
/ther fieldsZ
So four fields are generated for every named field in the 2MS
FieldnameL'
It has length of the field entered $y the user during the input operation
FieldnameLI
It is the actual input field that carries the entered information !he value of
this field is 4;>>; if no data is entered !he space corresponds to 4;K>;
FieldnameL1
It is attri$ute $yte It defines the attri$utes of the field
FieldnameLF
It is a flag $yte It has 4;>>; $y default It "ill $e set to 4;J>; if the user
modifies the field $ut no data is sent !hat is "hen the user pressed clear #ey over
the field
FieldnameL/
!his field should $e populated in the program $efore sending the screen to
display
Please note that the "ords I7P6! (R+&+I:+) and /6!P6! (S+7-) are "ith respect to
program

Mainframe Refresher Part-1 Page:177

More on 1ttri$ute field
0e have Qust seen that attri$ute field is of 1 $yte that specifies the attri$utes
of the field /ne $yte is of eight $its and the values in each $it has its o"n meaning
For e5ample8
2it ( - <>; indicates the field is unprotected and <1; indicates the field is protected
2it = N <>; indicates the field is alphanumeric and <1; indicates the field is numeric
2it ( and = N <11; indicates that the field is 1uto-s#ip
2it K and A N <>>; indicates 7ormal intensity and non-detecta$le
<>1; indicates 7ormal intensity and detecta$le
<1>; indicates .igh intensity and detecta$le
<11; indicates -ar# and 7on-detecta$le
2it I N <>; indicates M-! is /FF <1; indicates M-! is /7
Modified -ata !ag(M-!)
M-! is one $it field of the attri$ute $yte !he program can receive only the
fields "ith M-! <1; on R+&+I:+ +ffective use of M-! can reduce the data traffic
drastically in the communication line
M-! can $e S+!%R+S+! in the follo"ing "ays
1 0hen the user modifies the field8 the M-! of the field is automatically set
to /7
( &!R'CFRS+! of -F.MS- or -F.M-I "ill R+S+! the M-! to </FF; for all
the fields in the mapset or map FS+! #ey"ord of the attri$ute operand
definition of -F.M-F "ill set the M-! to </7 < It overrides the FRS+!
definition for the specific field
= 2efore sending the screen8 $y overriding the M-! $it of attri$ute $yte of
field the M-! can $e set to </7;

If you are specific on the values of some fields independent of "hether the
user has modified or not8 code them "ith FS+! /ne good e5ample is default values
for the input fields (li#e /rder received date) If the user finds default value (current
date) in the screen and it is fine "ith his re3uirement8 then he "on;t touch the field
and M-! "ill not $e set !he program cannot receive the field as M-! is /FF
2ut actually the program needs this field So this field should have $een defined "ith
FS+!
&6RS/R Positioning
Positioning of cursor is an important area in screen design 2y default8 the
cursor "ill $e placed in the first unprotected field
Static Positioning
If I& is coded in the attri$ute operand of -F.M-F macro8 then the cursor "ill
$e placed in that field If I& is coded in more than one field8 then last field "ith I&
"ill get the cursor
Sym$olic Positioning

Mainframe Refresher Part-1 Page:178

Move N1 to length of the field "here you "ant place the cursor and send the
map "ith &6RS/R option !his is device independent method and recommended to
control the cursor position dynamically
Relative Positioning
Send the map "ith &6RS/R(value) option !his "ill set the cursor at the
position coded $y <value;8 relative to the first column of the screen !his is device
dependant method of dynamic cursor positioning and not recommended 0hen there
is change in screen layout8 the program needs to $e modified
&6RS/R(=>) "ill place the cursor in the =>
th
column (First line first column is
U+R/)

&ursor Position
+I2P/S7 of -F.+I2'* contains the offset of cursor position in the screen
"hen the data "as transferred to program from the terminal(relative to )ero) It is
half "ord $inary field
-ynamic attri$ute setting
1ny attri$ute of the field can $e modified in the program $y setting the $its of
attri$ute field properly &hanging the attri$ute in the program in a dynamic method
&I&S provides the standard attri$ute character list in the form of copy$oo#
(-F.2MS&1) !his can $e copied into our application program using &/P, statement
and "e can use the varia$les in the copy$oo# to change the attri$ute of a field in the
program
For e5ample8 if the information entered $y the user in a particular field is
failed in validation8 then as a usual practice8 in addition to thro" an error message in
the $ottom of the screen8 you may "ish to hi-light the field that is in error
M/:+ -F.67IM- to FI+'-1 CC G 0ill achieve this
S*IPP+R and S!/PP+R field
S#ipper is unla$elled one $yte field "ith the auto-s#ip attri$ute and stopper is
unla$elled one $yte field "ith protected attri$ute
S#ipper field s#ips the cursor to ne5t field "hen the current field is filled up to
its full length8 "hereas stopper field stops entering any more character after the
length of the field is reached !he user has to press R+S+! #ey to proceed further
S#ipper field is used to speed up the user entry and recommended to code at
the end of each unprotected field Stopper field is coded $ased on re3uirement and
importance of the field Stopper field usually follo"s the last unprotected field in the
screen
2MS I7P6!-/6!P6! /P+R1!I/7S
2asic 2MS input-output operations are carried out using the follo"ing
commands R+&+I:+ M1P8 S+7- M1P8 S+7- &/7!R/'8 S+7- !+4!8 S+7- P1B+
R+&+I:+ M1P
It is used to receive the information entered $y the user into program If
I7!/ is not coded8 then &I&S automatically finds the sym$olic map area
(mapnameLI) and places the mapped data !he values of the field can $e read in the
program $y referring to fieldnameLI

Mainframe Refresher Part-1 Page:179

+4+& &I&S R+&+I:+ M1P(map-name) M1PS+!(mapset-name) +7--+4+&
!he option !+RMI71' 1SIS overrides the upper-case translation specified in
the !&! 1s "e already discussed8 if the user didn;t modify any of the fields then
M-! "ill $e </FF; for all the fields Uero $ytes transmission results M1PF1I' e5ception
error
S+7- M1P
!his is used to send a map to a terminal 2efore issuing this command8 the
application program should prepare the data in the sym$olic map area If FR/M is
not coded8 then &I&S automatically finds the sym$olic map area (mapnameL/) and
ta#es the data to the terminal
+4+& &I&S S+7- M1P(map-name) M1PS+!(mapset-name) +7--+4+&
/ther /ptions in S+7- M1P are:
+R1S+ +rases the screen $efore displaying the M1P 0hen you first time
thro" the screen8 it should $e specified "ith +R1S+ It "ill not $e coded "hen you
Qust "ant to display the error messages over the current screen +R1S+6P erases
only the unprotected fields of the screen $efore displaying the M1P
-1!1/7', /nly sym$olic map data is sent to the terminal
M1P/7', /nly physical map data is sent to the terminal FR/M cannot $e
coded
FR++*28 1'R1M and FRS+! can $e also coded and the meaning is already discussed
!+4! 2uilding- S+7--!+4!8 1&&6M and P1BI7B
!e5t streams can $e sent to the terminal "ithout any pre-defined 2MS maps
!his is called te5t $uilding !e5t streams can optionally have header and trailer
Synta5 the S+7- !+4! command is:
+4+& &I&S S+7- !+4!
FR/M(data-value)
'+7B!.(data-value)
R.+1-+R(data-value)S
R!R1I'+R(data-value)S
R+R1S+S R1&&6MS RP1BI7BS
+7--+4+&
0hen to code 1&&6M]
!he te5t stream can consist of multiple paragraphs and the $uilding of
message can happen in multiple stages If you "ant to send the te5t stream only
after the $uilding of all the paragraphs8 use 1&&6M option for the S+7--!+4! of
every individual paragraph $eing $uilt !hey are accumulated and "ill not $e sent
immediately
/nce the page is $uilt "ith complete message of all the paragraphs8 issue
S+7- P1B+ command that "ill send the complete te5t-stream to the terminal
.+1-+R is placed in the first S+7--!+4! and !R1I'+R is placed in the S+7- P1B+
0hen to code P1BI7B]
1&&6M alone is enough if the te5t-stream can fit "ithin a single page
2ut if the te5t stream is e5pected to e5ceed one page8 then code P1BI7B in all the
S+7--!+4! commands in addition to 1&&6M option !he last S+7--P1B+ command
sends the first page of message to the terminal
!he user can enter paging commands or #eys to "al# through the pages

Mainframe Refresher Part-1 Page:180

!o use #eys instead paging commands8 the #eys should $e mapped "ith paging
commands in the System Initiali)ation !a$le (SI!) 6sually there "ill $e a mapping
for PFI and PFJ "ith page up and page do"n commands respectively P6RB+
M+SS1B+ is used to purge the message that is accumulated $ut not yet send
Format of .+1-+R and !R1I'+R
If !+4!-.+1-+R is the varia$le used in .+1-+R command and the header is
</R-+R I7:+7!/R, NPage nn- <8 then the varia$le !+4!-.+1-+R should $e defined
as follo"s in "or#ing-storage section
>1 !+4!-.+1-+R
>A FI''+R PI& SO(K) &/MP :1'6+ (I CG 'ength of the te5t
>A FI''+R PI& 4 :1'6+ <9; CG &haracter identifying automatic
page num$er in the te5t
>A FI''+R PI& 4 CG /ne $yte control field used $y 2MS

>A FI''+R PI& 4((I) :1'6+ </R-+R I7:+7!/R, N Page 99 - <
CG 1ctual te5t in the header
!R1I'+R also can $e coded in the same "ay 1utomatic- page-num$er-
identifying character "ill $e spaces for !R1I'+R "or#ing storage varia$le
1&&6M and P1BI7B can $e also used "ith S+7--M1P and the meaning is
same
S+7--&/7!R/'
0hen the M1P is sent8 "e can specify device control options li#e FR++*2
1'1RM +R1S+8 along "ith S+7--M1P If one "ants to issue the device control
options $efore sending the map8 S+7- &/7!R/' "ill $e useful It is used to
esta$lish the device control options dynamically
Synta5:
+4+& &I&S S+7- &/7!R/'
R&6RS/R(data-value)S R+R1S+ T +R1S+6PS RFR++*2S R1'1RMS RFRS+!S
+7--+4+&
PRI7! !hrough 2MS
PRI7! option of S+7- M1P command allo"s the reports to $e printed at the
local printer connected to the terminal In this case8 M1P is sent to the printer and
not to the terminal
Synta5:
+4+& &I&S S+7- M1P(<M1P-71M+;)
M1PS+!(<M1PS+!-71M+;)
PRI7!
7'+/M
+7--+4+&
7'+/M option is recommended "ith PRI7! option 0hen this option is used8
1 2MS $uilds the data stream using ne" line characters and $lan# characters to
position the fields on the printer page
( !he data stream is terminated $y +/M (end of message) that stops printing
So printer $uffer is efficiently used8 allo"s larger pages to $e printed from the
same $uffer that ma#es the printing faster

Mainframe Refresher Part-1 Page:181

Message Routing
1 message can $e routed to one or more terminals other than the direct
terminal "ith "hich the program has $een communicating !he message eligi$le for
message routing is8 a message constructed $y the S+7- M1P command "ith the
1&&6M option
R/6!+ command esta$lishes the message routing environment and the S+7-
P1B+ command issued after R/6!+ command sends the message to the destination
Synta5:
+4+& &I&S R/6!+ R'IS!(data-area)S8 R/P&'1SS(data-area)S8
RI7!+R:1'(hhmmss)T!IM+(hhmmss)S8
R!I!'+(data-area)S8 R+RR!+RM(name)S
+7--+4+&
'IS! and /P&'1SS name the route list and operator class codes respectively
I7!+R:1' % !IM+ determines the actual timing of message delivery in the time
interval or the time respectively
!I!'+ names the title field defined in the "or#ing storage section and
+RR!+RM specify the terminal I- "here the error message (if any) to $e sent
Route list is prepared in "or#ing storage using the follo"ing convention
!!!!rr///srrrrrr N J $ytes named <r; are declared as spaces !!!! names the
terminal identifier as in !&! and /// specify the operator id as in S7! s is status
flag &ode as many 1M $ytes fields as the destinations and indicate end of route list is
"ith the declaration of half "ord $inary field "ith N1 value
!he message can $e routed to every terminal at "hich users of the specified
operator class is signed on !his is done using /P&'1SS
Program -esign
Pseudo logic in &I&S programs is achieved in three "ays
1Multiple Programs and Multiple !ransaction Ids
!he conversation program is logically and physically divided into multiple
programs and each program is registered "ith one transaction I- +ach program
issues R+!6R7 command "ith ne5t transaction I- So after the screen is sent8 the
first program "ill $e terminated /nce the user filled up the information in screen
and press +7!+R8 the ne5t program of the ne5t transaction I- (returned $y the first
program) gets control and the same process is follo"ed for n programs
1dvantage: +asy development and maintenance
-isadvantage: Possi$le &ode redundancy and num$er of P&! and PP! entries
(Multiple !ransactions and single program
First paragraph of the procedure division controls the flo" the different
sections of the program $ased on the transaction identifier stored in +I2!R7I-
+very section ends "ith R+!6R7 command "ith ne5t transaction to $e invo#ed on
completion of the screen information $y the user
!hus the conversational program is logically divided than physical division
1dvantage: PP! entries are less compared to case 1
-isadvantage: 7um$er of P&! entries are still the same as case 1
=/ne transaction and /ne program (Preferred "ay)

Mainframe Refresher Part-1 Page:182

R+!6R7 command has an optional parameter of &/MM1R+1 and '+7B!.
6sing this parameter "e can pass information $et"een the transactions
So first paragraph of your program "ill chec# "hether this is the first entry or
nth entry If +I2&1'+7 is )ero8 this is first entry So divert the program to the section
that "ill do all initial processing and thro" the first screen for the user
In addition to this it updates &/MM1R+1 "ith some control information li#e
internal transaction identifier !his &/MM1R+1 is passed along "ith R+!6R7
!R17SI- So +I2&1'+7 is updated "ith '+7B!. of &/MM1R+1 !he second and nth
entrances don;t have +I2&1'+7 as )ero and so $ased on the information in the
&/MM1R+18 transfer the control to different sections of the program
!as# Initiation Process
16ser entered transaction identifier
(!erminal &ontrol Program along "ith !erminal &ontrol !a$le recogni)es the
incoming data from the terminal
=Storage &ontrol Program ac3uires the storage for the terminal input output
area (!I/1)
K!erminal &ontrol Program places the data from the terminal into !I/1 and
sets the pointer into !&! entry of the terminal
AIf there is no tas# is associated "ith the terminal8 then !&P gives the
control to tas# &ontrol Program8 "hich reali)es the transaction identifier in the data
in !I/1 (*&P)
MS&P ac3uires the storage area for tas# control area (!&1) in "hich *&P
prepares the control data for this tas#
I*&P refer P&! to identify the program associated "ith the transaction
JProgram &ontrol Program (P&P) loads the program into main memory from
the load li$rary and gives the control $ac# to *&P
O*&P gives the control to application program loaded into main memory
1>Program started processing N !as# is initiated
0ays of -ata Passing $et"een transactions
1 2y &/MM1R+1
In the e5ample $elo"8 0or#ing Storage item 0S-I!+M of length 0S-'+7B!.
is passed to the transaction +MP& !he program for the transaction <+MP&; should
have -F.&/MM1R+1 of si)e 0S-'+7B!. in the lin#age section to receive the
information passed $y R+!6R7 of this program
+4+& &I&S
R+!6R7 !R17SI-(<+MP&;) &/MM1R+1(0S-I!+M) '+7B!.(0S-'+7B!.)
+7--+4+&
0S-'+7B!. is full "ord $inary and the ma5imum length that can $e specified
is MK* So "e can pass data of ma5imum si)e MK* 2ut it is recommended not to
pass more than (K*
'I7* and 4&!' can also have use &/MM1R+1 to pass the information to the
program $eing called and the concept is same
( Vueues
!here are t"o types of 3ueues !SV and !-V !SV can $e used as scratch pad
in main memory ,ou can "rite as much as you "ant in !SV and they "ill $e
availa$le to all the transactions that are a"are of the 3ueue name !SV is primarily

Mainframe Refresher Part-1 Page:183

used to share huge amount of information across the transactions Refer Vueues
section for more details
= !&!&18 !018 &01
!01 N !ransaction "or# area N /ne per tas# - 0or# area associated "ith the
tas#
!&!61 N !erminal &ontrol !a$le 6ser 1rea N 0or# area associated "ith a
terminal and defined as one per terminal in !&!
&01 - &ommon "or# area N System "or# area defined $y system
programmer in SI! (System Initiali)ation !a$le)
0e can use !018 !&!61 and &01 for sharing the information across the
transactions
+5ternal address a$ility using 2'' &+''S of /S%:S &/2/'
2ase 'ocator for 'in#age is used to access the memory outside you "or#ing
storage If it is used in input commands li#e R+1-8 R+&+I:+8 the performance "ill $e
good as "e "ould $e directly accessing the input $uffer than "or#ing storage item
If you "ant to access system areas li#e &018 !&!61 or &S1 that e5ist outside your
program8 then you should use 2''
&ode 'in#age section as $elo":
>1 P1RM-'IS!
>A FI''+R PI& SO(>J) &/MP
>A !&!61-P!R PI& SO(>J) &/MP
>A !01-P!R PI& SO(>J) &/MP
>1 !&!61-1R+1
>A !&!61-I7F/RM1!I/7 PI& 4(m)
>1 !01-1R+1
>A !01-I7F/RM1!I/7 PI& 4(n)
!he mapping $et"een the pointers and data area is done in lin#age section as
follo"s
First filler is points the current >1 level8 "hich is P1RM-'IS! itself
!&!61-P!R points to ne5t >1 level8 "hich is !&!&1-P!R
!0S-P!R points to ne5t >1 level8 "hich is !01-P!R
In the procedure division8 code the follo"ing:
+4+& &I&S 1--R+SS !01(!01-P!R) !&!61(!&!61-P!R) +7--+4+&
S+R:I&+ R+'/1- !&!61-1R+1
S+R:I&+ R+'/1- !01-1R+1
!his "ill store the pointer of !01 in !01-P!R and !&!61 in !&!61-P!R
1s the mapping $et"een 2'' cells and areas is already done in lin#age section8
!&!61-1R+1 can access m $ytes of !&!618 "hich e5ist outside your "or#ing storage
and similarly !01-1R+1 to access n $ytes of !018 "hich e5ist outside your "or#ing
storage area
!o ensure the addressa$ility8 S+R:I&+ R+'/1- statement should follo"
"henever the content of 2'' cell is changed in any"ay So there should $e a
S+R:I&+ R+'/1- statement after the 1--R+SS statement as follo"s

Mainframe Refresher Part-1 Page:184

+nhancement $y :S &/2/'(
1--R+SS /F operator of :S &/2/'( easies the access of e5ternal items
!he a$ove re3uirement can $e met in :S &/2/'( as follo"s !here is no need for
P1RM-'IS! or S+R:I&+ R+'/1-
'I7*1B+ S+&!I/7
>1 !&!61-1R+1
>A !&!61-I7F/RM1!I/7 PI& 4(m)
>1 !01-1R+1
>A !01-I7F/RM1!I/7 PI& 4(n)
PR/&+-6R+ -I:ISI/7
+4+& &I&S 1--R+SS !&!61 (1--R+SS /F !&!61-1R+1)
!01(1--R+SS /F !01-1R+1)
+7--+4+&
1--R+SS /F maps the !&!61-1R+1 "ith !&!61 e5ists outside your "or#ing
storage
1SSIB7 statement
It is used to access the system value outside of application program
Some of them are length of common areas8 user-id
&01'+7B8 !&!61'+7B8 !01'+7B N assign to full "ord $inary "or#ing storage item
6S+RI- - assign to 4(>J) field
+4+& &I&S 1SSIB7
6S+RI-(0S-6S+RI-)
+7--+4+&
!he a$ove command fetches the user id into 0S-6S+RI-
+I2-+5ecutive Interface 2loc#
0hen &I&S translator translates your program8 it adds -F.+I2'* copy$oo# as
the first entry in your lin#age section 0henever a tas# is initiated8 the tas# related
information could $e accessed using the fields in the copy$oo# +I2 is acronym for
+5ecutive Interface 2loc#
Some of the fields in +I2 are:
+I2&1'+7 N 'ength of -F.&/MM1R+1
+I2-1!+ and +I2!IM+ N -ate and !ime of tas# initiation
+I21I- - !he last attention identifier pressed $y the user
+I2F7 - Function code of the last command (( $ytes)
+I2R&/-+ - Response code of the last command (M $ytes)
+I2!RMI- - !erminal I-
+I2!R7I- - !ransaction I-
&I&S PR/BR1M 'I7*1B+ S+&!I/7
If you loo# into the translated source listing8 the lin#age section of &I&S
program might have the follo"ing

Mainframe Refresher Part-1 Page:185

1 -F.+I2'* (Introduced $y !ranslator)
( -F.&/MM1R+1 (&oded $y you as the first entry in lin#age section)
= P1RM-'IS! (2'' cells coded $y you)
K Multiple >1 levels (!he num$er of >1 entries is e3ual to num$er of 2''
cells you have coded in P1RM-'IS! e5cluding the first 2'' cell that points
to P1RM-'IS! itself)
B+!M1I7 and FR++M1I7
B+!M1I7 command is used to o$tain a certain amount of storage in the main
memory
+4+& &I&S B+!M1I7 S+!(1--R+SS /F '*-I!+M)
'+7B!.(data-value)TF'+7B!.(data-value)
I7I!IMB(data-value)
+7--+4+&
'*-I!+M is a lin#age >1 item "hose length is e3ual to length mentioned in the
'+7B!. parameter and that much memory "ill $e allocated for you in the main
memory !he initial value of this field "ill $e set $y I7I!IMB parameter
+4+& &I&S FR++M1I7 -1!1('*-I!+M)
+7--+4+&
!he a$ove command "ill release the main memory occupied $y you using B+!M1I7
!hese commands are highly useful in macro level coding "here the 3uasi-
reentrancy is the responsi$ility of the application programmer Vuasi-reentrancy is
guaranteed in the &I&S command level &/2/' programs and so the need and usage
of these commands are almost o$solete
'I7* 4&!' and &1''
It is good practice to develop several functional modules rather than $uilding
one lengthy program that does all the functions It ma#es the program tough to
maintain8 understand and de$ug !he si)e of the program "ill $e large and it also
occupies more resources Functional splitting of su$ modules and calling or
transferring the control to them is achieved $y 'I7*8 4&!' and &1''
&I&S programs are usually run at various levels !he first program8 "hich
gets the control from &I&S8 that is the program registered against the transaction in
P&!8 runs at first level 'in#ed and &alled programs are running one level lo"er than
lin#ing or calling program and so the R+!6R7 or B/ 21&* in these programs "ill
give the control $ac# to 'in#ing or calling program 4&!' programs run at the same
level and so the R+!6R7 gives control to ne5t upper level
Synta5: +4+& &I&S 'I7*T4&!' PR/BR1M(name) &/MM1R+1("s-area)
'+7B!.("s-length) +7--+4+&

Mainframe Refresher Part-1 Page:186

0s-length is length of "s-area and "s-area has the information that needs to
$e passed to 'I7*%4&!' program :S &/2/' ( allo"s reentrant program and so
"hatever is achieved using 'I7* or 4&!' can $e also achieved $y &/2/' &1''
statement !he called programs should $e attached to the main program during lin#
edit and so the si)e of the load module "ill $e large in this case
Prefer 4&!' "henever possi$le as it involves fe"er overheads If that is not
possi$le then $ased on su$-program si)e and possi$le modification8 go for 'I7* or
&1'' If the si)e of the program is less and used $y only very fe" programs go for
&1'' as it "ont increase the si)e much at the same time application "ill run fast
If the program is e5pecting more changes8 then calling program also need to
$e compiled for every change in su$ program In case of 'I7*8 the compilation of
lin#ed programs is enough &alled &I&S programs need not $e registered in PP!
"hereas 'I7* and 4&!' programs should $e
'/1- and R+'+1S+
'/1- is used to load the program or ta$le that is compiled or assem$led8 lin#
edited and registered in PP! It is mostly used for loading the assem$ler ta$le
+4+& &I&S '/1- PR/BR1M(PBM1) S+! (1--R+SS /F '*-I!+M)
'+7B!.(0S-'+7B!.)
+7--+4+&
Program PBM1 is loaded and the address of the program or ta$le is mapped
to '*-I!+M and so the ta$le can $e accessed using the lin#age are '*-I!+M !he si)e
of the lin#age item is 0S-'+7B!. If <./'-; #ey"ord is coded in the '/1-
command8 then loaded program or ta$le "ill $e permanently resident until e5plicitly
released If it is not mentioned8 then termination of the tas# release the program or
ta$le
+4+& &I&S R+'+1S+ PR/BR1M(PBM1) +7--+4+& is used to release the
program or ta$le
1I- and .17-'+ 1I-
!here are certain attention identifiers (1I-) associates "ith every screen
+ntry screens have +7!+R and PF1 (.elp) #eys Vuery screens have PFI (Page 6p)8
PFJ (Page do"n)8 PF1 (.elp) and so on 2ased on the #ey pressed $y the user8 the
processing should happen in the program +I21I- of -F.+I2'* has the last user
pressed #ey It can $e verified in the program after the R+&+I:+ command
For verification of values in +I21I-8 &opy the standard 1I- list copy$oo#
provided $y &I&S in your program (&/P, -F.1I-) 7o" you can easily verify the #ey
pressed as follo"s
+:1'61!+ +I21I-
0.+7 -F.+7!+R P+RF/RM P1R1-1
0.+7 -F.PF1 P+RF/RM P1R1-(
0.+7 /!.+R P+RF/RM P1R1-=
+7--+:1'61!+

Mainframe Refresher Part-1 Page:187

!he a$ove chec#ing is done in &/2/' and this #ind of chec# has to $e done
after every R+&+I:+ command to properly route the flo" &I&S provides its o"n
routing processing $ased on the #ey pressed $y .17-'+ 1I- command !his "ill $e
effective through out the program and reduce the code redundancy !he routing "ill
$e automatically invo#ed on every R+&+I:+
+4+& &I&S .17-'+ 1I-
-F.+7!+R(P1R1-1)
-F.PF1(P1R1-()
17,*+,(P1R1-=)
+7--+4+&
.17-'+ &/7-I!I/7 and 7/ .17-'+
+very &I&S command has its o"n e5ception list /ne e5ample is M1PF1I'
e5ception of R+&+I:+ command .17-'+ &/7-I!I/7 is used to transfer control to
the proper procedure on e5pected e5ceptions .17-'+ condition cannot trac#
program interrupted 12+7-S li#e S>&K or S>&I It deals only "ith e5ceptions of
&I&S commands
!he conditions handled are effective from "here it appears to the end of the
program /ne .andle &ondition can $e overridden $y another condition !he main
program conditions "ill not $e effective in su$-programs
+4+& &I&S .17-'+ &/7-I!I/7
M1PF1I'(P1R1-1)
PBMI-+RR(P1R1-()
'+7B+RR(P1R1-=)
+RR/R(P1R1-4)
+7--+4+&
C G1ny error condition other than M1PF1I'8PBMI-+RR and '+7B+RR "ill transfer
the control to P1R1-4
If you "ant to reset the diversion done $y previous .17-'+ condition8 code
the condition name $ut don;t mention the paragraph name Ma5imum 1( conditions
can $e coded in one .17-'+ &/7-I!I/7 statement
If you "ant to deactivate all the conditions for a particular &I&S command8
code 7/.17-'+ !here are possi$ilities for infinite loop "hen the &I&S command in
the e5ception routine of the .17-'+ &/7-I!I/7 ends "ith same e5ception In the
a$ove e5ample8 if the there is '+7B+RR in P1R1-= for any of the &I&S command
coded there8 then the control again come to P1R1-= and forms infinite loop In such
cases8 7/.17-'+ "ill $e useful (in the 12+7- routine &I&S commands)
IB7/R+ &/7-I!I/7
!he synta5 is same as .17-'+ &/7-I!I/7 $ut it causes no action to $e
ta#en if the specified condition occurs in the program !he control "ill $e returned to
the ne5t instruction follo"ing the command8 "hich encountered the e5ceptional
condition It "ill $e effective from the place "here it appears to the end of the
program or until any .17-'+ condition overrides it
Ma5imum 1( conditions can $e coded in one IB7/R+ &/7-I!I/7 statement
R+SP
'i#e the file status verification of $atch &/2/' program8 SV'&/-+ verification
of -2( program8 the success or failure of &I&S command can $e done using &/2/'
statements and this give more structured loo# for the program

Mainframe Refresher Part-1 Page:188

!o achieve this8 code R+SP along "ith &I&S command &I&S "ill place the
result into the varia$le coded in R+SP It can $e chec#ed against -F.R+SP(7/RM1')
or -F.R+SP(condition) and appropriately control the flo" follo"ing the command
+4+& &I&S R+&+I:+ M1P(1) M1PS+!(2) R+SP(0S-R&/-+) +7--+4+&
+:1'61!+ 0S-R&/-+
0.+7 -F.R+SP(7/RM1') P+RF/RM PR/&+SS-P1R1
0.+7 -F.R+SP(M1PF1I') P+RF/RM P1R1-1
0.+7 /!.+R P+RF/RM P1R1-4
+7--+:1'61!+
0S-R&/-+ should $e defined as full "ord $inary in "or#ing storage If you
code R+SP8 then .17-'+ &/7-!I/7 "ill not $e effective for those &I&S commands
P6S. and P/P
!hey are used to suspend and reactivate respectively8 all the .17-'+
&/7-I!I/7 re3uests currently in effect In real life programming8 you may "ant to
deactivate all the active handle conditions and diversions for a su$routine (section)
em$edded in the program !his can $e achieved using P6S. .17-'+ 0hen you
come out of that section8 you can reactivate all the pushed commands and that can
$e done using P/P .17-'+

.17-'+ 12+7-
.17-'+ &/7-I!I/7 command intercepts only a$normal conditions of the
&I&S command e5ecution "hereas .17-'+ 12+7- ta#es care of any a$normal
termination "ithin the program
+4+& &I&S .17-'+ 12+7-
'12+'(12+7--R/6!I7+)TR+S+!T&17&+'
+7--+4+&
'12+' is to activate an e5it &17&+' is used to cancel the previously
esta$lished .17-'+ 12+7- re3uest R+S+! is to reactivate the previously cancelled
.17-'+ 12+7- re3uest
6S+R-12+7-
In $atch &/2/'8 the user 12+7-S can $e thro"n $y calling the assem$ler
routine I'2/127> using 12-&/-+ "hereas 12-&/-+ is "or#ing storage field of half
"ord $inary
!he follo"ing command is used to thro" user 12+7-S in &I&S
+4+& &I&S 12+7- 12&/-+(<OOOO;)
+7--+4+& is used to thro" user 12+7- OOOO
FI'+-.17-'I7B
&I&S supports only :S1M and 2-1M files 1ll the files8 that you "ant to use in
your &I&S application8 should $e registered in F&! "ith their complete attri$utes
&I&S commands refer the F&! entry name for doing operation on the file
1s all the files are already declared and defined in ta$les8 coding File-&ontrol
Paragraph of +7:IR/7M+7! division or FI'+ S+&!I/7 of -1!1 -I:ISI/7 is
meaningless and not re3uired !hus &I&S frees the application program from any
data dependant coding

Mainframe Refresher Part-1 Page:189

!he unit of I/ during R+1- is one control interval So even you read one
record into your program8 the complete control interval is read into main memory
$uffer !he si)e of control interval is preferred to $e large for se3uential processing
and small for random processing
!he file should $e /P+7 to issue an I-/ command !he status of the file can
$e 3ueried using the master transaction &+M! It can $e /P+7+-8 &'/S+-8 +712'+-
or -IS12'+- !his e5plicit opening or closing can $e done using &+M!
2ut this needs human intervention
&I&S :ersion 1I introduces automatic opening of the file if it is not in open
status during the access It is al"ays $etter to close it the "hen you no longer need
it -F/& (-ynamic File /pen &lose) can $e done in program using the S+! command
or lin#ing to -F.+M!P
-F/& 2, 'I7* &/MM17-
!he application program lin#s the master terminal program (-F.+M!P) and
passes &+M! parameter data re3uired for the file open%close through &/MM1R+1
Receiving the data8 -F.+M!P program opens%closes the files specified8 after "hich
the control is returned to the application program
+4+& &I&S 'I7* PR/BR1M(-F.+M!P)
&/MM1R+1(0S-&/MM1R+1)
'+7B!.(0S-'+7B!.)
+7--+4+&
!he file open command is "ritten into 0S-&/MM1R+1 and its length is
populated in 0S-'+7B!.
File /pen &ommand: S+! -1!1S+!(F&!-71M+) /P+7+-
-F/& 2, S+! &/MM17-
+4+& &I&S S+!
-1!1S+!(name) T FI'+(name)
/P+7T&'/S+-
+7--+4+&
-F/& 2, 21!&. P/2
-F/& can $e achieved from a $atch Qo$8 "hich issues the &+M! as the data
for the P+S Modify (F) command against the system console terminal
%% F cicsQo$8 <&+M! S+! -1!1S+!(F&!71M+) /P+7+-;
R17-/M 1&&+SS /F FI'+S
R+1-: +4+& &I&S R+1- FI'+(F&!-71M+) R6P-1!+S S1
I7!/(0S-I!+M) T S+! (1--R+SS /F '*-I!+M) S(
'+7B!.(0S-'+7B!.) S=
RI-F'-(0S-*+,) SK
*+,'+7B!.(0S-*+,-'+7B!.) B+7+RI& SA
S,SI-(S,S!+M-71M+) SM

Mainframe Refresher Part-1 Page:190

B!+V T +V61' SI
+7--+4+&
S1 Reads the file and if update is intended then code 6P-1!+ clause !his "ill get
e5clusive access over the complete control interval "here the specific record e5ists8
during the R+1- !hus &I&S ensures data integrity
S( Read the file into "or#ing storage varia$le 0S-I!+M 1lternatively8 the
address of the record in the input-output area can $e mapped to lin#age section
varia$le $y using S+! command Performance-"ise S+! is $etter than R+1- I7!/
:S &/2/'( supports 1--R+SS of #ey"ord and ma#es the code easier In the prior
version &/2/'8 P1RM list and S+R:I&+ R+'/1- should $e used to achieve the same
S= 1fter the R+1-8 the '+7B!. of the record R+1- is updated into 0S-'+7B!.
0S-'+7B!. is the "or#ing storage half "ord $inary item
SK *ey of the record to $e read is moved into 0S-*+,8 a "or#ing storage item
and a part of record structure (0S-I!+M)

SA If partial #ey is used8 then the length of the partial #ey should $e moved to
0S-*+,-'+7B!. and the #ey"ord B+7+RI& should $e coded !his is optional for full-
#ey read
SM Remote system name "here the re3uest to $e directed8 is coded here (1-K
character name)
SI +V61' is default B!+V can $e coded "hen you #no" the full #ey8 $ut you are
not sure the record "ith that #ey e5ists in the file
R+0RI!+
+4+& &I&S R+0RI!+ FI'+(F&!-71M+)
FR/M(0S-I!+M)
'+7B!.(0S-'+7B!.)
S,SI-(S,S!+M-71M+)
+7--+4+&
!o release the e5clusive access ac3uired during the R+1- "ith 6P-1!+8 the
record should $e R+0RI!!+7 using the a$ove synta5 !he parameters are self-
e5planatory
1fter you read record8 if you feel that you don;t "ant to update it8 then inform
the same to &I&S $y issuing 67'/&* command so that &I&S release the loc#
ac3uired $y you on the record
+4+& &I&S 67'/&* FI'+(F&!-71M+) +7--+4+&
0RI!+
!he synta5 of 0RI!+ is same as R+0RI!+ !here is a parameter RI-F'- "ith
*ey-value is coded in the 0RI!+ command ('i#e SK for R+1- command)

Mainframe Refresher Part-1 Page:191

0hen you "ant to add a set of records "hose #eys are in ascending order8
then 3ualify your first 0RI!+ "ith another parameter M1SSI7S+R! !his "ill get
e5clusive control over the file and provide high performance during the mass insert
If you use M1SSI7S+R!8 then you should issue 67'/&* to inform the
completion of your additions &I&S releases the file on 67'/&*
-+'+!+
1!he record read using R+1- "ith 6P-1!+ can $e deleted using
+4+& &I&S -+'+!+ -1!1S+!(F&!-71M+) +7--+4+&
(!he record in the file can directly $e deleted $y providing complete #ey
+4+& &I&S -+'+!+ -1!1S+!(F&!-71M+) RI-F'-(0S-*+,) +7--+4+&
=Broup of records can $e deleted using partial #ey 1fter the deletion8 the num$er of
records deleted is updated in the varia$le coded in 76MR+& parameter (0S--+'-
&/67!)
+4+& &I&S -+'+!+ -1!1S+!(F&!-71M+)
RI-F'-(0S-*+,)
*+,'+B7!.(0S-*+,-'+7B!.) B+7+RI&
76MR+&(0S--+'-&/67!)
+7--+4+&
S+V6+7!I1' R+1-:
Se3uential access of :S1M file under &I&S is called 2ro"sing It has FI:+
&ommands associated "ith it
S!1R!2R
It esta$lishes a position to start $ro"sing
+4+& &I&S S!1R!2R FI'+(F&!-71M+) RI-F'-(0S-*+,)
*+,'+7B!.(0S-*+,-'+7B!.) B+7+RI&
R+VI-(Integer-value)
S,SI-(S,S!+M-71M+)
B!+V T +V61'
+7--+4+&
Meaning of the parameters is same as R+1- operation e5planation 0hen you
"ant to do multiple $ro"sing concurrently over the same file8 then use R+VI- !he
first S!1R!2R can $e coded "ith R+VI-(1) and the second S!1R!2R can $e coded
"ith R+VI-(()
/ne $ro"se operation occupies one string of :S1M If all :S1M strings are
e5hausted for one :S1M file8 then the other transactions "ill have to "ait for one of
the strings to $ecome free So it is not recommended to use multiple $ro"sing
Instead8 once the $ro"sing is completed8 using R+S+!2R set the position to another
place and start $ro"sing !he synta5 of R+S+!2R is same as S!1R!2R
R+1-7+4! and R+1-PR+:

Mainframe Refresher Part-1 Page:192

+4+& &I&S R+1-7+4!T R+1-PR+: FI'+(F&!-71M+) RI-F'-(0S-*+,)
I7!/(0S-I!+M)
'+7B!.(0S-'+7B!.)
*+,'+7B!.(0S-*+,-'+7B!.)
R+VI-(I7!+B+R-:1'6+)
S,SI-(S,S!+M-71M+) +7--+4+&
R+1-7+4! is used to read the records in the for"ard direction from the
position esta$lished $y S!1R!2R R+1-PR+: is used to read the records in the
reverse direction R+1-PR+: follo"ed $y R+1-7+4! retrieves the same record once
again
-uring the $ro"se8 if you "ant to s#ip set of records8 then move the #ey of
the ne5t record you intended to read to RI-F'- and then issue R+1-7+4! !his is
called s#ip se3uential read !hus RI-F'- can $e used as $oth input as "ell as output
field
1s :S1M files are varia$le length in most of the cases8 0S-'+7B!. should $e
populated "ith ma5imum record length $efore issuing R+1- command
*+,'+7B!.(>) "ill position the cursor at the $eginning of the file
If you specify R+1-PR+: immediately after S!1R!2R8 then you should code
#ey of a record that e5ists on the dataset /ther"ise 7/!F7- condition occurs on
R+1-PR+:
+7-2R
It is used to terminate the current $ro"se function
+4+& &I&S +7-2R FI'+(F&!-71M+) R+VI-(I7!+B+R-:1'6+) S,SI-(S,S!+M-71M+)
+7--+4+&
6P-1!+ during 2R/0S+
6pdate and 2ro"se are mutually e5clusive functions So if you "ant to update
a record during the $ro"se operation8 first issue +7-2R !hen give random read
using the #ey in hand "ith 6P-1!+ option R+0RI!+ the record !hen issue S!1R!2R
"ith the #ey in hand and continue the $ro"sing

+S-S-2R/0SI7B
-efine a full-"ord $inary item in "or#ing storage for the R21 of +S-S file
Move '/0-:1'6+S or .IB.-:1'6+S to the field for the for"ard or reverse read
respectively Issue S!1R!2R "ith R21 and +V61' option RI-F'- should point to
defined R21 field 7o" issue R+1-7+4! or R+1-PR+: for for"ard or R+:+RS+ read
respectively
B!+V is invalid for +S-S
M/:+ '/0-:1'6+S !/ +S-S-R21
+4+& &I&S S!1R!2R FI'+(F&!-71M+) RI-F'-(+S-S-R21) R21 +V61' +7--+4+&
M/:+ ((M to 0S-'+7B!.
+4+& &I&S R+1-7+4! FI'+(F&!-71M+) I7!/(0S-I!+M) RI-F'-(+S-S-R21)
'+7B!.(0S-'+7B!.) R21
+7--+4+&

Mainframe Refresher Part-1 Page:193

+S-S-0RI!+
!he synta5 is same as *S-S 0RI!+ command Vualify the 0RI!+ "ith R21
option !he record "ill $e appended to the file and the R21 of the record is placed
into R21 field mentioned in the 0RI!+ command (+S-S-R21)
M/:+ ((A !/ 0S-'+7B!.
+4+& &I&S 0RI!+ FI'+(F&!-71M+) RI-F'-(+S-S-R21) '+7B!.(0S-'+7B!.) R21
+7--+4+&
+S-S-R17-/M 1&&+SS
If you #no" the R21 value of the record you "ant to access8 then you can
randomly access the +S-S file !he synta5 is same as R+1- of *S-S file $ut 3ualify
it "ith R21 option RI-F'- should point to full-"ord $inary item pre-filled "ith R21
of the record to $e accessed
RR-S 1&&+SS
RR-S file can $e accessed using RR7 in place of R21 and populating the
RI-F'- "ith RR7 num$er !he field should $e full "ord $inary
1lternate Inde5 access
Register the path in F&! and use the path name as file name to read the file
randomly using alternate inde5 Please refer :S1M section of the $oo# for
understanding "hat e5actly P1!. is
1s the alternate #ey need not $e uni3ue8 -6P*+, condition is very common
during the alternate inde5 usage and so it has to $e properly handled

Mainframe Refresher Part-1 Page:194

1S*!IM+
+I2-1!+ and +I2!IM+ have the values at tas# initiation time 6pon the
completion of 1S*!IM+8 these t"o fields are populated "ith current date and time
+4+& &I&S 1S*!IM+ +7--+4+&
F/RM1!!IM+
F/RM1!!IM+ is used to receive the information of date and time in various formats
+4+& &I&S F/RM1!!IM+ F/RM1!-!,P+(data-area) +7--+4+&
Format-type: ,,---8 ,,MM--8 ,,--MM8 MM--,,8 --MM,,8 -1,/F0++*8
-1,/FM/7!.8 M/7!./F,+1R8 ,+1R8 !IM+8 !IM+S+P8 and
-1!+S+P
+5ample:
+4+& &I&S
F/RM1!!IM+ MM--,,(0S--1!+) -1!+S+P !IM+(0S-!IM+) !IM+S+P
+7--+4+&
0S--1!+ contains the current date in MM%--%,, (-efault -1!+S+P is <;%;)
0S-!IM+ contains the current time in ..:MM:SS (-efault !IM+S+P is <:;)
-+'1, and S6SP+7-
It is used to delay the processing of a tas# for a specified time interval or until
the specified time If your tas# is doing some heavy &P6 $ounded "or#8 it is a good
to place the -+'1, command in order to allo" the other tas#s to proceed
+4+& &I&S -+'1, I7!+R:1'(..MMSS) T !IM+(..MMSS) +7--+4+&
S6SP+7- is used to suspend a tas# -uring the e5ecution of the command8
the tas# "ill $e suspended and the control "ill $e given to other tas#s "ith higher
priority 1s soon as all higher priority tas#s have $een e5ecuted8 control "ill $e
returned to the suspended tas#
+4+& &I&S S6SP+7- +7--+4+&
P/S! and 01I! +:+7!
P/S! is used to re3uest notification "hen the specific time has e5pired and
the 01I! +:+7! command is used to "ait for an event to occur 6sually these t"o
commands are used in pair8 as alternative to the -+'1, command
+4+& &I&S P/S! I7!+R:1'(..MMSS) T !IM+(..MMSS)
S+! (1--R+SS /F P/S!-+&2) +7--+4+&
+7--+4+&
+4+& &I&S 01I! +:+7! +&11--R(1--R+SS /F P/S!-+&2)
+7--+4+&
&17&+'
It is used to cancel the interval control commands such as -+'1,8 P/S! and
S!1R! "hich have $een issued !he interval commands to $e cancelled are identified
using R+VI-
+4+& &I&S S!1R! R+VI-(<S!1R!S;) +7--+4+&
+4+& &I&S &17&+' R+VI-(<S!1R!S;) +7--+4+& &ancels all the starts issued

Mainframe Refresher Part-1 Page:195

S!1R! and R+!RI+:+
S!1R! command is used to start a transaction at the specified terminal and at
the specified time or interval /ptionally8 data can $e passed to the to-$e-initiated
transaction
+4+& &I&S S!1R! !R17SI-(<+MP&;) !+RMI-(<!S!1;) S1
!IM+(1(=>>>)TI7!+R:1'(>>=>>>) S(
FR/M(0S-I!+M) '+7B!.(0S-'+7B!.) S=
R!R17SI-(<+MP-;) R!+RMI-(<!S!>;) SK
V6+6+(<+MP-+!;) SA
+7--+4+&
S1 +MP& is to $e started at the terminal !S!1
S( !IM+ and I7!+R:1' are mutually e5clusive If !IM+(..MMSS) is coded8 then
the tas# start at the terminal at the specific time In the a$ove e5ample it is 1(:=>
If I7!+R:1'(..MMSS) is coded then the tas# "ill start after the e5piry of the
interval In the e5ample8 the tas# starts after => minutes
S= !his program passes 0S-I!+M of si)e 0S-'+7B!. to the tas# +MP&
SK !ransaction I- +MP- and !erminal Id !S!> are passed to +MP& +MP& can
receive this information and may use for ne5t triggering
SA !SV 3ueue name can $e passed from this transaction +MP-+! is passed in
our case
!he data passed $y S!1R! command is received $y the ne" transaction using
R+!RI+:+ command upon the e5piry of S!1R! command
+4+& &I&S R+!R+I:+ I7!/(0S-I!M+)T S+!(1--R+SS /F '*-I!+M)
'+7B!.(0S-'+7B!.)
R!R17SI-(0S-!R17) R!+RMI-(0S-!+RM)
V6+6+(0S-V6+6+)
+7--+4+&
+7V and -+V
+7V gets the e5clusive control over the resource and -+V releases the
e5clusive control ac3uired over the resource 1s &I&S ta#es care of e5clusive access
over the resource "henever needed8 it is advisa$le not to use it in application
programs
2ut sometimes it may $e needed in fe" cases li#e updating !SV records or
getting access of the printer
+4+& &I&S +7V%-+V R+S/6R&+(V6+6+-71M+) +7--+4+&
S,7&P/I7! and !0/-P.1S+-&/MMI!
!he updates done $y a tas# is automatically committed at tas# termination
S,7&P/I7! is used to commit portion of "or# completed "ithout terminating the
tas#
+4+& &I&S S,7P/I7! +7--+4+&

Mainframe Refresher Part-1 Page:196

-uring the program processing8 if you "ant to roll $ac# the changes made $y
you8 then you can code S,7P/I7! "ith R/''21&* !his "ill $ac#ed out all resource
modifications done since the last sync point
+4+& &I&S S,7&P/I7! R/''21&* +7--+4+&
S,7&P/I7! in &I&S--2( environment is called as t"o-phase commit
!he changes made in the resources that are directly under the control of &I&S are
committed in the first phase and the changes made to -2( environment are
committed in the second phase
Vueues
!here are t"o types of 3ueues availa$le in &I&S
1!emporary Storage Vueue (!SV)
(!ransient -ata Vueue (!-V)
!heir properties are listed $elo":
!SV 7o need to predefine any"here 2y default8 !S 3ueues are created in main
memory So the content cannot $e recovered after system crash If you "ant
to recover8 then you should define them in !S!
Records can $e randomly accessed using I!+M option of R+1-V R+1- is not
destructive
-eletion of 3ueue deletes all the records in it -eletion of recovera$le !SV
should follo" sync point $efore ne5t 0RI!+V
Primarily used as scratch pad memory facility for any purpose
+5ample: Page-up and Page-do"n logic8 Passing huge data in $et"een the
phases of transaction8 Revie" and correction of multiple order entry screens
!-V !-V should $e predefined in -&!
R+1- is destructive and only se3uential /nce the record is R+1-8 it "ill $e
logically deleted and cannot $e read again
1utomatic !as# Initiation: 0hen num$er of records in the 3ueue e5ceeds the
!RIB'+: defined in the -F.-&! entry of the 3ueue8 the transaction coded in
the !R17SI- of -F.-&! is automatically triggered !his 1!I is possi$le only
in !-V
!here are t"o types of !-V N Intra and +5tra partition !he -&! entry
identifies the type of 3ueue from !,P+ parameter
Intra Partition Vueues are used "ithin a &I&S region and -+'+!+V deletes
all the records physically in the 3ueue
+5tra partition Vueues are used across the regions and systems If you "ant
to pass some data from &I&S to $atch or receive data from 2atch to &I&S8
you should go for e5tra partition 3ueue
In the same program !-V cannot $e opened in $oth input and output mode

Mainframe Refresher Part-1 Page:197

!SV are preferred over !-V for data passing !-V is used for $atch interface
or on 1!I re3uirement
MR/ and IS&
0ithin one processor8 there could $e more than one &I&S region8 each of
"hich runs independently under the same operating system !his is called Multi
region /peration (MR/) It is achieved $y four inter communication facilities
1Function Re3uest Shipping
(1synchronous Processing
=!ransaction routing
K-istri$uted !ransaction Processing
/ne &I&S in one processor can communicate "ith other &I&S in other
processor or other non-&I&S system regardless of "here the other processor
physically located !his is called Inter System &ommunication (IS&) It re3uires
sophisticated communication net"or#s $ased on the System 7et"or# 1rchitecture
(S71)
M1S!+R !R17S1&!I/7S
&+M!:
!his is Master !erminal transaction It is menu driven and easy-to-use
transaction $ut due to its nature of manipulating the &I&S environment8 most of the
functions are restricted to application programmer or end user
&+M! I7V6IR+TS+!TP+RF/RM
&+M! I7V !R17TPR/TFI'+ N -isplay information from P&!TPP!TF&!
&+M! I70 !1S* N -isplay the active running tas#s in the region
&+M! S+! command can $e used to reset the values of P&!TPP!TF&!
P+RF/RM has to $e handled carefully &+M! P+RF/RM S.6!-/07 "ill shut do"n
the entire &I&S region
Fre3uently used commands:
&+M! S+! PR(PBM-71M+) 7+0 - !o create a ne" copy of an application program
&+M! S+! -1(file-name) &'/%/P+7 - !o close%open a file from &I&S
&+&I:
!his is &ommand Interpreter transaction &I&S commands can $e pre-tested
using this command $efore placing them into the program
&+2R:
!his is $ro"se transaction !SV can $e $ro"sed using this transaction
&+-F:
!his is -iagnostic Facility transaction If you "ant to de$ug your program step
$y step8 then $efore typing transaction I- type &+-F so that de$ug mode "ill $e set
It intercepts a transaction at initiation and termination of a program8 $efore and after
e5ecution of any +4+& &I&S or +4+& SV' commands
&M1&:

Mainframe Refresher Part-1 Page:198

!his transaction is used to get 12+7- codes and messages
-ifferent "ays of initiating a transaction in &I&S
12y entering transaction identifier
(2y S!1R! command
=2y R+!6R7 !R17SI-
K2y registering the programs in P'!8 they "ill $e automatically initiated during &I&S
startup
A1utomatic !as# Initiation of !-V
MPF or P1 #eys could $e defined in P&! to initiate a &I&S transaction
&I&S -ump 1nalysis
-ump usually consists of -ump .eader 1rea8 !&1(6ser 1rea)8 !&1(System
1rea)8 !race !a$le8 !ransaction Storage and Program Storage
1t the top of the 12+7- dump8 there is a dump header area8 "hich provides
12+7- code8 !1S* (the transaction I-)8 Program Status 0ord (PS0) and the
contents of registers at the time of 12+7-
PS0
It is a dou$le "ord field containing the status information at the time of
12+7- =(
nd
$it says the addressing mode in use If the addressing mode is =1 $its8
then the $it "ill $e <1; and the $its == to M= contains the ne5t se3uential instruction
(7SI)8 "hich "ould have $een e5ecuted if the 12+7- had not occurred
First ma#e sure that you have program compilation and lin# edited
S,SPRI7!S of the program 12+7-+- and dump prints of the 12+7-+- transaction is
"ith you Program should $e compiled "ith 'IS! option
Finding the statement caused the 12+7-
1Identify the address of ne5t se3uential instruction from the PS0
( From the program storage8 identify the starting address of program storage
=Su$tract the starting address of program storage from the 7SI address identified in
the first step8 you "ill get the displacement of the 7SI from the $eginning of program
storage
KFind the displacement of application program from the $eginning of the load
module in the lin# edit list and su$tract this value from the calculated 7SI
displacement to get the real 7SI displacement
AFind the statement in the compilation listing that corresponds to the /FFS+!
calculated in the previous step !he statement one a$ove is the statement that
caused the 12+7-
M1nalyse the statement for the cause of 12+7- !his might have involved one or
more fields Most of the times8 you can easily come to conclusion the cause of the

Mainframe Refresher Part-1 Page:199

12+7- once you identified the statement If you could not8 then you may chec# the
value of the field at the time of 12+7- as follo"s
Finding the value of the field in error
1Find the 2ase 'ocator (2')8 -isplacement and length of the field from the M1P of
compilation listing
( Find the register num$er corresponding to the $ase locator from the $ottom of
compilation listing
= Find the address of this register in the dump
K 1dd the displacement to the register of the address to get the address of the field
A 'ocate the address in the dump to get the value of the field
&I&S !12'+ +7!RI+S
F&!
1ll the :S1M files8 P1!. $et"een $ase cluster and alternate inde5 and any
2-1M datasets are to $e registered in F&! to access them in the application
program
-F.F&! !,P+ C-1!S+!T FI'+8
1&&M+!.C2-1M T :S1M8
-1!1S+!C name T FI'+Cname8
S+R:R+V C (1--8 2R/0S+8 -+'+!+8 R+1-8 6P-1!+)8
RFI'+S!1!C (+712'+-T-IS12'+-8 /P+7+-T&'/S+-)S8
R26F7-C nL1S8
R26F7ICnS8
RS!R7/CnS8
R-S71M+CnameS8
R-ISPC/'- T S.RS8
R21S+CnameS8
1&&M+!. defines data access method
7ame mentioned in the FI'+ parameter is the one "ith "hich "e use in the
&I&S file commands !he name should correspond to the --71M+ of the file
specified in the P&' of the &I&S Qo$ itself If -S71M+ and -ISP are coded8 then P&'
entry is not needed
S+R:R+V lists the authori)ed input%output operations against the file If other
than the specified services is re3uested in the file control command8 then I7:R+V
condition "ill occur
FI'+S!1! indicates the initial file status "hen &I&S initially starts 26F7- and
26F7I indicate the num$er of data $uffers and inde5 $uffers respectively -efault
value is one for 26F7I and t"o for 26F7- S!R7/ is the num$er of :S1M strings $y
"hich concurrent access to the file is allo"ed
If the file $eing registered is path8 then 21S+ indicates the F&! name of the
$ase cluster

Mainframe Refresher Part-1 Page:200

PP!
1ll the &I&S application programs and 2MS map sets must $e registered in
PP! If the program is not registered here8 then the program is unrecogni)a$le to
&I&S
-F.PP! !,P+C+7!R,8
PR/BR1MCnameT M1PS+!C name
RPBM'17BC(1SS+M2'+R T &/2/' T P'I)S8
options
1SS+M2'+R is the default program language 1ll the map-sets are considered as
"ritten in assem$ler
P&!
!he control information of all &I&S transactions must $e registered in
program control ta$le (P&!)
-F.P&! !,P+C+7!R,8
!R17SI-Cname8
!1S*R+VC55558 (PF1-PF(K8 P11-P1=)
PR/BR1MCname8
R-!IM/6!CmmssS8
RR!IM/6!CmmssS8
RR+S!1R!C 7/ T ,+SS8
R!R17S+&C1 T -+&IM1'S8 (1-MK)
R-6MPC,+ST7/S8
Z/ther options
!R17SI- N !ransaction identifier name (1-K characters)
PR/BR1M N 7ame of the program associated "ith the transaction
!1S*R+V - *ey associated "ith the transaction initiation
-!IM/6! - -efines the timeout ("aiting time) in case of deadloc#
R!IM/6! - -efines the time limit "ithin "hich the user has to respond If
he didn;t then the tas# "ill $e cancelled
R+S!1R! N 1utomatic transaction is applied after the completion of the
transaction recovery from the a$normal termination of the transaction
!R17S+& N!ransaction security code
-6MP - 0hether -6MP is to $e ta#en in case of a$normal termination
of the transaction
!&!
1ll the terminals8 "hich are to $e under &I&S control8 should $e registered in
!&! !erminal &ontrol Program uses this ta$le for identifying the terminals and
performs all input%output operations against these terminals
-F.!&! !,P+C+7!R,8

Mainframe Refresher Part-1 Page:201

1&&M+!.C:!1M8
!RMI-7!Cname8
!RM!,P+Ctype8
F+1!6R+C(6&!R178)
/ptions
!RMI-7! is (1-K characters) terminal I-
!RM!,P+ is type of terminal +5 I2M=(I>
F+1!6R+ indicates the terminal services &I&S offers 6&!R17 is used to
translate all the lo"ercase characters to upper case characters
-&!
!-V control information is registered here -estination &ontrol Program uses
this ta$le for identifying all !-Vs and performs input%output operations against them
Intra partition 3ueue can $e defined as follo"s
-F.-&! !,P+CI7!R18
-+S!I-Cname8
R!R17SI-CnameS8
R!RIB'+:Cnum$erS8
RR+6S+C ,+ST7/S
!,P+ can $e I7!R1 (Intra partition !-V)
1!I:
!R17SI- and !RIB'+: are used for automatic tas# initiation If the num$er of
records in !-V e5ceeded the num$er of records mentioned against !RIB'+:8 then
transaction I- mentioned against !R17SI- "ill $e invo#ed automatically
/nce a record of intra partition !-V is read $y a transaction8 the record is logically
removed from8 the 3ueue If R+6S+ C ,+S is coded8 then the space occupied $y it
can $e used $y other records in future $ut the logically deleted records are not
recovera$le
+5tra partitioned 3ueue can $e defined as follo"s
-F.-&! !,P+C+4!R18
-+S!I-Cname8
-S&71M+Cname-(8
R/P+7CI7I!I1'T-+F+R+-S
-F.-&! !,P+CS-S&I8
-S&71M+Cname-(8
R!,PFI'+CI7P6!T/6!P6!TR-21&*S

Mainframe Refresher Part-1 Page:202

/P+7CI7I!I1' means the file "ill $e open at the &I&S start-up time and
-+F+R+- means the file "ill $e closed until it is specifically opened $y &+M!
-S&71M+ defines data control $loc# and for one -S&71M+8 a corresponding
-F.-&! entry must $e made "ith !,P+CS-S&I and the same -S&71M+8 "hich in
effect indicates --71M+ of e5tra partition dataset in P&' or &I&S P/2 itself
!,PFI'+ indicates the file to $e I7P6!8 /6!P6! or R+1- 21&*01R-
(R-21&*)
.o" to su$mit P&' from a &I&S program]
P&' can $e su$mitted using the SP//'/P+78 SP//'0RI!+ and SP//'&'/S+
commands
First you must open a spool for output using SP//'/P+7
+4+& &I&S
SP//'/P+7 /6!P6! 7/-+(Y?Y) 6S+RI-(I7!R-R)
!/*+7(reportato#en) R+SP(response field)
+7--+4+&
7/-+(Y?Y) specifies a destination node to send the P&' to 6S+RI- is set to
the name of the internal reader I7!R-R 1 uni3ue to#en "ill $e allocated $y &I&S
"hen the SP//'/P+7 is e5ecuted and placed in the field you specify using
!/*+7(reportato#en) !he to#en "ill $e used as a sending field on su$se3uent
commands !he to#en "ill $e J $ytes long
!o "rite each line of the Qo$ to the spool use the SP//'0RI!+ command
+4+& &I&S
SP//'0RI!+ FR/M(ioaarea) !/*+7(reportato#en)
R+SP(resonseafield)
+7--+4+&
!he _ioaarea_ field should $e the name of a data item containing the line of
P&' !he _reportato#en_ field should $e the same as the J $yte to#en returned from
SP//'/P+7 1n end of Qo$ statement (Y%%Y or Y%?+/FY) should $e "ritten as the last
line

Finally you must close the spool using SP//'&'/S+ (7ote if you do not
e5plicitly close the spool it "ill $e closed "hen the transaction terminates8
.o"ever it is good practice to close the spool e5plicitly)
+4+& &I&S
SP//'&'/S+ !/*+7(reportato#en) R+SP(responseafield)
+7--+4+&
1gain the _reportato#en_ field must $e the same as the one allocated at
SP//'/P+7

7otes:
!he R+SP option should $e coded on all the &ommands and it is
recommended that you also code R+SP(8 $ecause additional information is
returned for some e5ception conditions in this field
-&! entries and P&' -- statements are not needed "hen using this method

Mainframe Refresher Part-1 Page:203

7ote that in order to use this method -F.SI! SP//'C,+S must $e coded in
the &I&S System Initiali)ation !a$le &hec# "ith your friendly local SysProg if
you are unsure
6nder /S%:S &/2/' the SP//'0RI!+ command had to have F'+7B!.
specified F'+7B!. specifies the length of the data $eing "ritten in a full"ord
$inary field !his field is optional in ne"er versions8 if it is omitted then the
length is assumed to $e the length of the data item (io-area) specified in
FR/M

2e a"are of the performance considerations for "riting to the spool8 I2M says
_!ransactions that process S,S/6! data sets larger than 1>>> records8 either for
I7P6! or for /6!P6!8 are li#ely to have a performance impact on the rest of &I&S_
(Source: &I&S%+S1 :KR1 1pplication Programming Reference S&==-11I>->>)

Mainframe Refresher Part-1 Page:204

You might also like