Professional Documents
Culture Documents
Ims DB-DC
Ims DB-DC
IMS
Online Transaction Processing Message Processing Program (MPP) Two Batch n!ironment Share" Batch Processing (BMP) #clusi!e Batch (D$/I)(DBB)
$e!el of %&straction
'o&ol ) %D
(S%M Macro
D%SD
''--
IMS Data&ase
E P PE!S"N#$ D#%#
E P P#&!"$$
E P $'B!#!&
E P SK'$$
If MP personal "ata is "elete"+ all the others shoul" get "elete". This is referential integrity.
Page 1 of 89
(I .
$O*I'%$ MOD $
P-/SI'%$ $%/ )
D%SD
-ierarchical Mo"el
,ser "eals with logical !iew only. -e is not &othere" a&out how "ata is store" physically. This is "ata in"epen"ence. IMS $ogical Structure
$e!el 0
Parent )*S%" E!
Parent/'hil"
"!DE!
$e!el 1
$e!el 2
Page ( of 89
P)B P ! " 3 ! #
#)B
D$/'
0ile anage1ent
-IS%M -D%M
(S%M -ID%M
OS%M
M(S
Dis3 (olumes 4ote5 PSB an" DBD must &e create" &efore e#ecuting program.
(iew "etermines what user can see an" PSB "etermines (iew -ow to use IMS Data&ase Manager6
0. 'reate -ierarchical Mo"el 1. Inform IMS/DM a&out your "ata mo"el. This mo"el is to &e translate" to physical me"ium. The process is calle" Data&ase Description *eneration. DBD* 457 'reates DBD elements for IMS. 4ow IMS 3nows a&out your "ata mo"el. 4ow mo"el is create"+ nee" to put segments into it. Therefore nee" to pro!i"e access to user. 2. Pro!i"e access to user 7.hich "ata&ase/segments/fiel"s 7.hat user can "o 8 '),D -ow this !iew is "efine"6 This is "one &y Program Specification Bloc3 *eneration. PSB* 457 'reates PSB elements PSB restricts/allows what user can see. -ere user is a program. DB% loo3s after these things i.e. 0+1+2 Programmer ne!er "efines new "ata&ases. 9or any new program+ you nee" to create PSB element.
Page , of 89
Process %ccess )e:uest .hat 8 '),D ('reate+ )eplace+ ,p"ate+ Delete) On what 8 "&"(one P'B for each "ata&ase)/segment/segment :ualification .ith what/where 8 segment i7o %rea (-ere IMS returns the re:uire" "ata in this area "efine" in wor3ing storage) .as it successful 8 'ommunication P'B (e:ui!alent to S;$'%)
IMS reports on the call through program communication &loc3. IMS pro!i"es this programming interface through D$/I calls. '%$$ <'B$TD$I= ,SI4* 9,4'TIO4 P'B I7O7%) % SS%
In"i!i"ual hierarchical mo"el is one "ata&ase. 'ollection of all "ata&ases is corporate "ata&ase. (Only for IMS) Assignment1 :,tility '%IS%'B is e:ui!alent of DBD* 4. 'reate a file DBD0.%'B using te#t e"itor ( DIT)+ in!o3e the utility '%IS%'B to create a "ata&ase. In the same file write DBD an" then PSB specification.
Page 4 of 89
Persistent Data
Pro&lems57 0. Dura&ility 1. 'oncurrent ,sage (Isolation) 2. Manage (catalog) 'atalog policy57 )eco!ery + asy %ccess
IMSSRCLIB: DBD source DBDLIB: Generated DBD---------------Get the information IMS/ESA Version !" Manual# $tilities Reference-S%stem &Generated $tilities' Li(rar% Reader for )indo*s &do*nload from Internet or Cds'
P!
SK$
#SS'3N
Page 5 of 89
Three ways of accessing information57 0. )an"om 1. Se:uential (all) 2. Se:uential with criteria MP4O is a Eey fiel". Therefore all the MP occurrences will &e in ascen"ing or"er of MP4O One root with all "epen"ents is a "ata&ase recor"
Page 7 of 89
P)I4T 4O* 4 DBD 4%M H MPDB S * 4%M H MP+P%) 4THA+B/T SHID 9I $D 9I $D 9I $D S * 4%M HP)+P%) 4TH MP+B/T SH01 9I $D 9I $D S * 4%M HSE$+P%) 4TH MP+B/T SH2F 9I $D 9I $D 9I $D DBD* 4 9I4IS4D (S ;+,)5 ,ni:ue 3ey fiel" (S ;+M)5 4on7uni:ue 3ey fiel" IMS!MACLIB: Loo+ out in for DBD#SEG ,IELD etc! $tilit% to anal%-e DBD: IS.,/01tion 2 &IMS DB3 &DataBase 3ools' Manuals' DBDSRC: Contains DBD source DBDLIB: Contains DBD elements
Assignment3: 0. 1. 2. B. Print pictures of all the "ata&ase )eport of DBD use" &y "ifferent program PSBwise )eport DBD &y access metho"s5 -IS%M+ -D%M+ an" -ID%M. There won=t &e )eport for *S%M
Page 8 of 89
-ierarchical Se:uence 0. Top to Bottom 1. $eft to )ight IMS puts the segments in this or"er. If nee"s to a"" new segments into the "efine" se:uence+ e!ery time that se:uence has to &e &rea3 therefore IMS gi!es 2 access metho"s 2. B. F. D. -S%M (Se:uential) -IS%M (In"e#e") -D%M (Direct) -ID%M (In"e#e" "irect)
+SAM -ierarchical se:uential access metho" (-S%M) "ata&ases use the se:uential metho" of accessing "ata. %ll "ata&ase recor"s an" all segments within each "ata&ase recor" are physically a"Jacent in storage. %n -S%M "ata&ase can &e store" on tape or on a "irect7 access storage "e!ice. -S%M "ata&ases can only &e up"ate" &y rewriting them. Delete (D$ T) an" replace () P$) calls are not allowe"+ an" insert (IS)T) calls are only allowe" when the "ata&ase is &eing loa"e". %lthough the fiel"7le!el sensiti!ity option can &e use" with -S%M "ata&ases. %lthough the uses of -S%M are limite" &ecause of its processing characteristics+ it is use" for applications re:uiring se:uential processing only. Typically+ -S%M is use" for low7use files. These are files containing+ for e#ample+ statistical reports or files containing historical or archi!e "ata that has &een purge" from the main "ata&ase. In the "ata set+ a "ata&ase recor" is store" in one or more consecuti!e &loc3s. /ou "efine what the &loc3 siKe will &e. ach &loc3 is fille" with segments of the "ata&ase recor" until there is not enough space left in the &loc3 to store the ne#t segment. .hen this happens+ the remaining space in the &loc3 is pa""e" with Keros an" the ne#t segment is store" in the ne#t consecuti!e &loc3. .hen the last segment of a "ata&ase recor" has &een store" in a &loc3+ any unuse" space+ if sufficient+ is fille" with segments from the ne#t "ata&ase recor". In storage+ an -S%M segment consists of a 17&yte prefi# followe" &y user "ata. The first &yte of the prefi# is the segment co"e+ which i"entifies the segment type to IMS. This num&er can &e from 0 to 1FF. The segment co"e is assigne" to the segment &y IMS in ascen"ing se:uence+ starting with the root segment an" continuing through all "epen"ents in hierarchic se:uence. The secon" &yte of the prefi# is the "elete &yte. Because D$ T calls cannot &e use" against an -S%M "ata&ase+ the secon" &yte is not use".
Page 8 of 89
+ISAM Distri&utes one "ataset into two "atasets. Is a slowest access metho" of all. .hen DBD generation ta3es place+ it suggests space+ 'I siKe etc. then accor"ingly DB% creates the two "atasets+ ESDS > SDS
E P E P E P Primary Dataset
!B# !B#
P! SK$
P! SK$
SK$
!B#
O!erflow Dataset
In a hierarchical in"e#e" se:uential access metho" (-IS%M) "ata&ase segments in each "ata&ase recor" are relate" through physical a"Jacency in storage. ach -IS%M "ata&ase recor" is in"e#e"+ allowing "irect access to a "ata&ase recor". In "efining a -IS%M "ata&ase+ you must "efine a uni:ue se:uence fiel" in each root segment. These se:uence fiel"s are then use" to construct an in"e# to root segments (an" therefore "ata&ase recor"s) in the "ata&ase. -IS%M is typically use" for "ata&ases that re:uire "irect access to "ata&ase recor"s an" se:uential processing of segments in a "ata&ase recor".
Page 9 of 89
Data&ase )ecor"5 Starting from root to the last "epen"ant is one complete "ata&ase recor". $ogical )ecor" The logical recor" is a part of "ata&ase recor"+ which can &e store" in one 'I. In a logical recor"+ the first B &ytes are a "irect7a""ress pointer to the ne#t logical recor" in the "ata&ase recor". This pointer maintains all logical recor"s in a "ata&ase recor" in correct se:uence. The last logical recor" in a "ata&ase recor" contains Keros in this fiel". 9ollowing the pointer are one or more segments of the "ata&ase recor" in hierarchic se:uence. 9ollowing the segments is a 07&yte segment co"e of A. It says that the last segment in the logical recor" has &een reache".
-IS%M "ata&ase recor"s are store" in two "ata sets. The first "ata set+ calle" the primary "ata set+ contains an in"e# an" all segments in a "ata&ase recor" that can fit in one logical recor". The in"e# pro!i"es "irect access to the root segment (an" therefore to "ata&ase recor"s). The secon" "ata set+ calle" the o!erflow "ata set+ contains all segments in the "ata&ase recor" that cannot fit in the primary "ata set. % ESDS is the primary "ata set an" an SDS is the o!erflow "ata set. $ogical recor"s are groupe" into control inter!als ('Is). % control inter!al is the unit of "ata transferre" &etween an I/O "e!ice an" storage. /ou "efine the siKe of 'Is. ach "ata&ase recor" starts at the &eginning of a logical recor" in the primary "ata set. % "ata&ase recor" can only occupy one logical recor" in the primary "ata set+ &ut o!erflow segments of the "ata&ase recor" can occupy more than one logical recor" in the o!erflow "ata set. Segments in a "ata&ase recor" cannot &e split an" store" across two logical recor"s. Because of this an" &ecause each "ata&ase recor" starts a new logical recor"+ unuse" space e#ists at the en" of many logical recor"s. .hen the "ata&ase is initially loa"e"+ IMS inserts a root segment with a 3ey of all @L99Ls as the last root segment in the "ata&ase. ach logical recor" in the primary "ata set contains the root plus all "epen"ents of the root (in hierarchic se:uence) for which there is enough space. The remaining segments of the "ata&ase recor" are put in the o!erflow "ata set (again in hierarchic se:uence). The two MpartsM of the "ata&ase recor" are chaine" together with a "irect7a""ress pointer. .hen o!erflow segments in a "ata&ase recor" use more than one logical recor" in the o!erflow "ata set the logical recor"s are also chaine" together with a "irect7a""ress pointer.
Page 19 of 89
1. 9ollowing the in"e# pointer to the correct 'I 2. Searching this 'I for the correct logical recor" (the root 3ey !alue is compare" with each root 3ey in the 'I) B. .hen the correct logical recor" (an" therefore "ata&ase recor") is foun"+ searching se:uentially through it for the specifie" segment If an application program issues a *, call with an un:ualifie" SS% for a root segment or with an SS% :ualifie" on other than the root 3ey+ the -IS%M in"e# cannot &e use". The search for the segment starts at the &eginning of the "ata&ase an" procee"s se:uentially until the specifie" segment is foun". Picture to &e "rawn for "ata&ase -ow new segments are inserte" 6 'I split6
Page 11 of 89
.hen segments in a "ata&ase recor" are typically processe" in hierarchic se:uence+ use hierarchic pointers. .hen segments in a "ata&ase recor" are typically processe" ran"omly+ use a com&ination of physical chil" an" physical twin pointers. .hen an application program issues a call for a segment+ -9 pointers are followe" until the specifie" segment is foun". In this sense+ the use of -9 pointers in an -D "ata&ase is similar to using a se:uentially organiKe" "ata&ase. In &oth+ to reach a "epen"ent segment all segments that hierarchically prece"e it in the "ata&ase recor" must &e e#amine". -9 pointers shoul" &e use" when segments in a "ata&ase recor" are typically processe" in hierarchic se:uence an" processing "oes not re:uire a significant num&er of "elete operations. If there are a lot of "elete operations+ hierarchic forwar" an" &ac3war" pointers (e#plaine" ne#t) might &e a &etter choice. 9our &ytes are nee"e" in each "epen"ent segmentLs prefi# for the -9 pointer. ight &ytes are nee"e" in the root segment. More &ytes are nee"e" in the root segment &ecause the root points to &oth the ne#t root segment an" first "epen"ent segment in the "ata&ase recor". -9 pointers are specifie" &y co"ing PT)H- in the S *M statement in the DBD. -ierarchic 9orwar" an" Bac3war" Pointers5 .ith hierarchic forwar" an" &ac3war" pointers (-9 an" -B)+ each segment in a "ata&ase recor" points to &oth the segment that follows an" the one that prece"es it in the hierarchy (e#cept "epen"ent segments "o not point &ac3 to root segments). -9 an" -B pointers must &e use" together+ since you cannot use -B pointers alone.
Page 1( of 89
-9 an" -B pointers are specifie" &y co"ing PT)H-B in the S *M statement in the DBD.
Physical 'hil" 9irst Pointers5 .ith physical chil" first (P'9) pointers+ each parent segment in a "ata&ase recor" points to the first occurrence of each of its imme"iately "epen"ent chil" segment types. .ith P'9 pointers+ the hierarchy is only partly connecte". 4o pointers e#ist to connect occurrences of the same segment type un"er a parent. Physical twin pointers (e#plaine" later) can &e use" to form this connection. P'9 pointers shoul" &e use" when segments in a "ata&ase recor" are typically processe" ran"omly an" se:uence fiel"s are either "efine" for the segment type. If not+ new segments are not inserte" at the en" of all e#isting segment occurrences. If se:uence fiel"s are not "efine" an" new segments are inserte" at the en" of e#isting segment occurrences+ the com&ination of P'9 an" physical chil" last (P'$) pointers (e#plaine" ne#t) can &e a &etter choice. 9our &ytes are nee"e" in each parent segment for each P'9 pointer. P'9 pointers are specifie" &y co"ing P%) 4TH((name+S4*$)) in the S *M statement in the DBD. This is the S *M statement for the chil" &eing pointe" to+ not the S *M statement for the parent. 4ote+ howe!er+ that the pointer is store" in the parent segment.
Physical 'hil" 9irst an" $ast Pointers5 .ith physical chil" first an" last pointers (P'9 an" P'$)+ each parent segment in a "ata&ase recor" points to &oth the first an" last occurrence of its imme"iately "epen"ent chil" segment types. P'9 an" P'$ pointers must &e use" together+ since you cannot use P'$ pointers alone. P'9 an" P'$ pointers (as oppose" to Just P'9 pointers) are typically use" when5 4o se:uence fiel" is "efine" for the segment type. 4ew segment occurrences of a segment type are inserte" at the en" of all e#isting segment occurrences.
On insert operations+ if the IS)T rule of $%ST has &een specifie"+ segments are inserte" at the en" of all e#isting segment occurrences for that segment type. .hen P'$ pointers are use"+ fast access to the place where the segment will &e inserte" is possi&le. This is &ecause there is no nee" to search forwar" through all segment occurrences store" &efore the last occurrence. P'$ pointers also gi!e application programs fast retrie!al of the last segment in a chain of segment occurrences. %pplication programs can issue calls to retrie!e the last segment &y using an un:ualifie" SS% with the comman" co"e $. .hen a P'$ pointer is followe" to get the last segment occurrence+ any further mo!ement in the "ata&ase is forwar".
Page 1, of 89
% P'$ pointer "oes not ena&le you to search from the last to the first occurrence of a series of "epen"ent chil" segment occurrences. 9our &ytes are nee"e" in each parent segment for each P'9 an" P'$ pointer. P'9 an" P'$ pointers are specifie" &y co"ing the P%) 4TH operan" in the S *M statement in the DBD as P%) 4TH((name+DB$ )). This is the S *M statement for the chil" &eing pointe" to+ not the S *M statement for the parent. 4ote+ howe!er+ that the pointers are store" in the parent segment. % parent segment can ha!e S4*$ specifie" on one imme"iately "epen"ent chil" segment type an" DB$ specifie" on another. 'o"ing these pointers in the DBD5 DBD S *M % S *M B P%) 4TH((name.S4*$)) (specifies P'9 pointer only) S *M ' P%) 4TH((name.DB$ )) (specifie" P'9 an" P'$ pointers)
)esults in these pointers &eing create"5 Physical Twin 9orwar" Pointers5 .ith physical twin forwar" (PT9) pointers+ each segment occurrence of a gi!en segment type un"er the same parent points forwar" to the ne#t segment occurrence. 4ote that PT9 pointers can &e specifie" for root segments. .hen this is "one in an -D%M "ata&ase+ the root segment points to the ne#t root in the "ata&ase chaine" off the same root anchor points ()%P). ()%Ps are e#plaine" in a following section calle" M*eneral 9ormat of -D Data&ases an" ,se of Special 9iel"s.M) If no more root segments are chaine" from this )%P+ the PT9 pointer is Kero. .hen PT9 pointers are specifie" for root segments in -ID%M "ata&ase+ the root segment "oes not point to the ne#t root in the "ata&ase. .hat happens is e#plaine" in a su&se:uent section calle" M,se of )%Ps in a -ID%M Data&ase.M The important thing for you to 3now now is that if you specify PT9 pointers on a root segment in a -ID%M "ata&ase+ the -ID%M in"e# must &e use" for all se:uential processing of root segments. This increases access time. This pro&lem is eliminate" if you specify PT9 an" physical twin &ac3war" (PTB) pointers ("iscusse" ne#t). .ith PT9 pointers+ the hierarchy is only partly connecte". 4o pointers e#ist to connect parent an" chil" segments. Physical chil" pointers can &e use" to form this connection. PT9 pointers shoul" &e use" when segments in a "ata&ase recor" are typically processe" ran"omly+ an" you "o not nee" se:uential processing of "ata&ase recor"s. 9our &ytes are nee"e" for the PT9 pointer in each segment occurrence of a gi!en segment type. PT9 pointers are specifie" &y co"ing PT)HT in the S *M statement in the DBD. This Developed By: Shilpa Keluskar & Suvarnalata Naik
Page 14 of 89
01en a segment is .e2ete. in an +D .ata/ase3 it is 41ysi5a22y -em,6e. 7-,m t1e .ata/ase8 )1e s4a5e it ,55#4ie. 5an /e -e#se. 91en ne9 segments a-e inse-te.8
Page 15 of 89
-D%M Define" using one "ataset+ SDS or OS%M which is logically "i!i"e" into 1 parts
-ow "ata is place" 6 IMS pro!i"es )an"omiKing Mo"ule (%ssem&ly language mo"ule) Eey !alue (AAAA0) will &e the input !ando1i:ing odule
Output will &e a &loc3 num&er+ which will &e %!aila&le range. If it is G+ then recor" gets Store" into Gth &loc3. -ere there is a pro&lem. If the &loc3 num&er is "uplicate"+ the recor" gets store" into same &loc3. .hich re:uires more o!erhea". Therefore re:uire" to choose proper ran"omiKing mo"ule an" num&er of )%% &loc3s. If segment is "elete" that space is a!aila&le for new segments. -D%M supports ran"om access. It "oes not support for se:uential access. 27 8-IMS 279:-VSAM 3herefore IMS used 0SAM &0;erflo* Se5uential Access Method'# ISAM 1rior to VSAM <SDS#ESDS
Page 17 of 89
SDS 1 5 7 99
ESDS
% -ID%M "ata&ase is actually compose" of two "ata&ases. (-ID%M uses an in"e# to get to a specific root segment rather than the root anchor points use" &y -D%M.) The first "ata&ase contains the "ata&ase recor"s as the "ata&ase. The secon" "ata&ase contains the -ID%M in"e# as the in"e# "ata&ase. )oot segments in a -ID%M "ata&ase must ha!e a uni:ue 3ey fiel"+ &ecause an in"e# entry e#ists for each root segment &ase" on the rootLs 3ey. .hen initially loa"ing a -ID%M "ata&ase+ all root segments shoul" &e presente" to the loa" program in ascen"ing 3ey se:uence+ an" all "epen"ents of a root shoul" follow the root in hierarchic se:uence. 4ote that -ID%M+ unli3e -D%M+ has no root a""ressa&le or o!erflow area+ Just a series of &loc3s or 'Is. .hen "ata&ase recor"s are initially loa"e"+ they are simply loa"e" one after another in the or"er in which they are presente" to the loa" program. The space in 4ote how segments in a "ata&ase recor" are chaine" together. In this case+ hierarchic pointers were use" instea" of the com&ination of physical chil"/physical twin pointers. ach segment points to the ne#t segment in hierarchic se:uence. %lthough -ID%M "ata&ases can ha!e )%Ps+ you pro&a&ly "o not nee" to use them.
Page 18 of 89
Page 18 of 89
A#t,mi5ity ,7 t-ansa5ti,n: )olling &ac3 the transaction Transaction starts 'hanges 3ept in log Transaction completes 'hanges are ma"e permanent or else changes are un"one &y IMS if transaction fails 'OMMIT releases the loc3s ('hec3point)
DB/D' Dictionary57 Separate pro"uct along with IMS+ ta3es care of "ata&ase management.(catalog ser!ice)
Page 19 of 89
9,4'TIO45
IS)T ) P$ D $T *, *4 *4P Program wor3ing storage area use" &y IMS to store+ retrie!e "ata. Segment Search %rgument. To inform IMS 7 which segment to wor3 on.
IO%) %5 SS%5
To insert new MP segment5 0. 1. 2. B. IS)T I/O area to &e prepare" P'B which in"icates DB Segment 4ame ( MP)
Programs are users to IMS. IMS always tal3s to you through program. PSB 0. .hich "ata&ase to &e wor3e" on5 MPDBD 1. .hich segment to &e wor3e" on5 2 segments 2. .hat is the operationN IS)T IMS won=t allow to perform any other operation+ or use any other DBD not specifie" here. This way you can o&tain control on the "ata&ase operation a program can perform.
Page (9 of 89
P'B
Once this PSB is rea"y+ you can wor3 on it. 4ow "efine the segments of the "ata&ase. -ere there are 2 segments use" therefore S 4S * 4%M HOOOOOOOOOOO S 4S * 4%M HOOOOOOOOOOO S 4S * 4%M HOOOOOOOOOOO PSB* 4 4%M H MP%DD+$%4*H'OBO$ PS 4S *7Sensiti!e SegmentQ So &efore writing 'OBO$ program all these things nee" to prepare. 4ote5 ,se P)O'OPT H % %s many no. of P'B H 4o. Of "ata&ases /ou can also gi!e restriction at fiel" le!el that is one particular fiel" only shoul" get mo"ifie" an" not others
P'B 77777777777777 S 4S * 4%M H MP S 49$D 4%M H MP4%M 5 5 So here only MP4%M can &e mo"ifie". /ou cannot touch any other fiel" from that segment. IMS2!DBDLIB &1ds' contains DBD 6enerated! ,or e=am1le: EM.DBD IMS2!.SBLIB &1ds' contains .SB 6enerated! ,or e=am1le: EM.ADD
Page (1 of 89
.hen you e#ecute IMS program+ IMS first loo3 for PSB therefore specify program name with PSBname. IMS will create one area &y ac:uiring memory. If there use multiple P'B statements it will create occurrences of that area. P'B P'B P'B P'B* 4
Program "oes not start e#ecution+ IMS first "oes its Jo& then program starts e#ecution &ecause ? S is not aware of P'B mas3. DBP'B Mas35 Definition for this area is "efine" &y IMS. -ere only concatenate" 3ey length will !ary
00 2 C
11
00
Page (( of 89
E P 7
P! 7
SK$ ,
This entire pc& mas3 IMS puts into ac:uire" memory. MP7P'B7M%SE. DBD4%M H < MPDBD= P)O'OPTH=%= 4O7S 47S *H2 'O4'%T 4%T D7E /H01
This structure is 3nown as program communication &loc3. So first thing re:uire" for e#ecuting IMS Program5
0. 'reate PSB 1. Program e#ecute" 2. IMS creates P'B into its own area > not in program wor3 area. It is create" to inform you a&out your IMS operation. This is outsi"e the program wor3 area therefore nee"s to "efine P'B in lin3age section of 'OBO$ program. In the proce"ure "i!ision you shoul" write as5 P$OCED!$E DI:ISION !SIN; EMP-PCB-MAS& /ou are not suppose to change P'B. It is rea" only. If you try to change it. /ou will get %B 4D for storage !iolation
Page (, of 89
$owest 3ey can operate on any high 3ey area. But if higher !alue 3ey area tries to change anything from low73ey area+ storage !iolation will occur > program will %B 4D. !en 'I'S operates at lower le!el. In case if you are using two P'Bs
P'B P'B
MPDBD P)O?DBD
P)O' D,) DI(ISIO4 shoul" &e5 P)O' D,) DI(ISIO4 ,SI4* MP7P'B7M%SE P)O?7P'B7M%SE.
Page (4 of 89
D<S$$C00 #ecute D9S))'AA program to e#ecute your IMS co&ol program. /ou Just can=t "irectly e#ecutes your Program. @ ' P*MHD9S))'AA. P*M4%M H MP%DD PSB4%M H MPPSBRRRRR.. It first loa"s P'B7mas3 into memory > then it will loa" your program into memory. Then it passes %""ress of P'B7mas3 to the program. 1 'N+EN%"!&=P)B= #SK> 95 DBD=N# E 95 SE3 EN%=$E+E$ 95 S%#%*S=)"DE 95 P!")="P%'"NS 95 0'$$E! 95 SE3 EN%=N# E 95 KE&=$EN3%95 N* B=SENS=SE3S 95 )"N)#%=KE&
?@98A> ?@9(A> ?@9(A> ?@94A S9@95A )" P ?@98A S9@95A )" P S9@95A )" P ?@11A
Assignment*: 0. 'reate test "ata 1. .rite DBD for MP+ P)O? 'T an" PSB in one single .%'B file. Eeep P)O'OPT H % 2. In!o3e '%IS,TI$
Page (5 of 89
Day = Se6ment can ha;e onl% one SE> field If field is SE> and %ou are loo+in6 out for 2 ! It *ill sto1 search *hen it reaches 29! It *on?t search (e%ond that! )hereas if the field is SEARC4 field# it *ill search all the records! 3herefore slo*er 1erformance
In DBD* 4+ fiel"s "efine" using 9I $D other than S ; fiel" are S %)'- fiel"s. Only these fiel"s you can use in SS%. )ules are co"e" for segment ha!ing S ; fiel" &ut which is non7uni:ue. Still IMS nee"s to arrange it in or"er. *i!e it as (S ;+ M) This is non7uni:ue so "uplicates are allowe".
)y4e O7 CA'' 0. ,n:ualifie" '%$$ If '%$$ statement "oes not inclu"e SS% then that '%$$ is un:ualifie" '%$$. 1. ;ualifie" '%$$ If SS% is specifie" in a '%$$+ it is :ualifie" '%$$. )y4e O7 SSA >ualified SSA )ontaining seg1ent na1e 2ith so1e Cualifi.ation EDa1ple: E P @E PN" EE 1(,457A $n5ualified SSA )ontains Fust seg1ent na1e EDa1ple: 'NS!% E P
Page (7 of 89
CA''S
18 ;E) !NI>!E <#n5ti,n C,.e: ?;! <#n5ti,ns: !se. t, -et-ie6e a segment !se. 7,- -an.,m a55ess 3*=================================================@#A 3* E PSE3 3* E PSE3 P!SE3 3* P!SE3==================================@BA 3* SK$SE3================================@EA 3* E PSE3 @E PN"G1(,457A========@-A ?
(%) will gi!e first root occurrences. If SS%s are missing for any le!el+ then IMS assumes un:ualifie" SS% for that le!el. It is e:ui!alent to *, MPS *. IMS always starts search in hierarchical se:uence.
# E PSE3
B P!SE3
D E SK$SE3
Page (8 of 89
28 ;E) NEX) (Se"#entia2 P-,5essing <#n5ti,n C,.e: ?;N ? <#n5ti,n: !se. t, -et-ie6e ne@t se"#entia2 segment
CA'' *, *4 *4 *4 *4
*4 *4
9 *
B$%4E *%
4ow suppose if you want to retrie!e" s3ill7i" A0 of first employee Then you nee" to co"e following5 *, MPS * ( MP4OH012BFD) *4 SE$S *
Page (8 of 89
O) *4 SE$S *(SE$IDHA0) But what if you want to retrie!e particular segment for all the employees. Say+ 9or each employee print payroll recor". So for this is use ;NP call. ;NP5 *et 4e#t .ithin Parent. *, or *4 call esta&lishes parentage. If want to use *4P+ first you ha!e to use *, or *4 to esta&lish parent. S5,4e ,7 ;NP5 %ll the "epen"ents of the particular parent. *, MPS * *4P SE$S * .ill retrie!e all the s3ill segments un"er that employee. .hen s3ill segment will en" for that employee+ you will get return co"e of ;E.
38 $e42a5e an. De2ete Ca22 <#n5ti,n C,.e: ?$EP' ? an. ?D'E)A <#n5ti,n: !se. t, -e42a5e an. .e2ete t1e s4e5i7ie. segment 0Q )ea" .ith -ol" is necessary &efore you wor3 on with these calls *-,+ *-4+ *-4P 1Q .hile replacing+ 3ey portion cannot &e mo"ifie" 2Q 9or "elete call "o not mo!e anything into segment area. 3-* E PSE3 @E PN"G1(,457A D$E% @here no need to spe.ify Cualifi.ationH it 2ill 2ork on old .allA 3-* E PSE3 @E PN"G1(,457A "+E IIIIIIIII>> D$E% @here it 2ill give return .ode ;D?<A
BQ Once MP segment is "elete" all the "epen"ents of this segment will get "elete".
Page (9 of 89
FQ Some other formats you can use5 3-* 3-N E PSE3@E PN"G1(,457A P!SE3===@L @, D$E% J indi.ates )o11and )ode 0ollo2s %hree spa.es go for last P!SE3 go for first P!SE3
) P$ > D$ T must &e prece"e" &y -O$D call. Otherwise IMS will gi!e you the return co"e <D%=+ <D?=
* *B
*%
*E *P
Des5-i4ti,n Blan3 in the P'B status co"e after *4 or *4P call in"icates that the call was successful Segment not foun" 'an occur with *4 &ut not with *4P call. It in"icates that you=!e trie" to retrie!e a segment+ &ut are at the en" of "ata&ase. It is li3e %T 4D con"ition raise" "uring 'OBO$ ) %D statement. .hen you reach the en" of "ata&ase with *4P call+ D$/I returns the * status co"e. .hen an un:ualifie" *4 or *4P call mo!es to upper le!el in the hierarchy to retrie!e a segment )aise" &y un:ualifie" *4 or *4P at same hierarchical le!el &ut "ifferent segment. *4P is gi!en &efore esta&lishing a parentage
Page ,9 of 89
$est-i5t an" P-,6i.e access re:uires &uffers. %ccess Metho" cannot wor3 "irect with PSB. %'B is the com&ine" !ersion of PSB an" DBD. Buffer creation for DBD segments is "one &y use of %'B. In a mainframe+ un"er &atch mo"e i.e. D$/I en!ironment. IMS initialiKation nee"s to &e "one &efore program starts e#ecution. @ ' P*MHD9S))'AA P%)M (D$/I+RRRRRRRRRR.)
In D$/I &atch mo"e+ generation of %'B is "ynamically in!o3e". D9S))'AA loo3s PSB > ta3e correspon"ing DBD an" create the %'B &loc3 > then create P'Bs. %fter this it gi!es control to your program an" then the e#ecution starts. If this facility is a!aila&le in &atch D$/I+ then why it is not in Online6 .hy in Online+ %'B &loc3 generation is re:uire"6 Since in Online programs response time is critical therefore instea" of creating it "ynamically it is generate" first. ach program triggers %'B generation therefore in Online it is generate" first. It is a separate entity store" in %'B$IB.
In DBBA3C4 &ne*er ;ersion' in (atch en;ironment &.ARMA&DBB#B!!''# ACB should (e 6enerated in ad;ance li+e online Assem(l% lan6ua6e code routines are stored as a mem(er of SCS2!RESLIB ,ind out ho* man% mem(ers are 1resent in ACBLIB )hether man% .SB can reside in one ACBD
S#mma-y:-In D$/I In Online 7%'B creation is "ynamic (,sing D9S))'AA in ),4 ?'$)
7%'B* 4 is re:uire" (Sa!es Time) %lso in DBB (newer !ersion) 7%'B* 4 is re:uire"
Page ,1 of 89
%ools
Pro.ess
!e.eption
#ample5 Enowle"ge7ware 'o. #perts -ome $i&rary Books anuals Periodi.als Phy !ef> Papers : : : : : P ) # aths s Deli!ery ,ser !e.eption
)eception slots
Deli!ery Tray 9orms to &e "eli!ere" Data $ayer Business $ayer Presentation $ayer
Page ,( of 89
IMS/DC ,- IMS/)M P3 $'B Programs -ome )ontrol !egion ' S/ DB ' S/ D PP !egion "ut Out
;manager
0S$'B
Page ,, of 89
M9S loo3s for physics form in M9S$IB an" gi!es it to user. .ho will "esign the physics forms6 Total B forms to &e "esigne" an" 3ept in M9S$IB. ,ser will enter "ata in physics form an" presses enter. 4ow M9S will put this in ;M*). 0e nee. t, 4-,6i.e t1ese /2anB 7,-ms8 Same as CICS BMS ma4s
Managers .or3 Sheet5 $e"#i-ement Physics 'hemistry Maths %strophysics P-i,-ity 1 2 B 0 P-,g-am Phy pgm. 'he pgm. Math pgm. %stro pgm. A..-ess 777777 777777 777777 777777
Manager will call associate" program "epen"ing on the priority gi!en. IMS is not aware of this wor3sheet. So some&o"y has to inform that there are "ifferent forms+ with associate" e#perts. Once Program is loa"e"+ it will ta3e forms from ;M*) until no more forms.
Pseu"oco"e for su&Ject matter e#pert wor3 flow5 )ecei!e 9orm Perform P-,5ess ,ntil no7more7form *o &ac3 P-,5ess8 9in" the re:uire" information Sen" form with "etails )ecei!e form
Page ,4 of 89
/9O) MPO M9S will pic3 up MPO from M9S$IB an" sen" it to terminal. ,ser will enter "etails an" form goes to ;M*) when user presses 4T ). There shoul" &e i"entification form each form. So accor"ingly it gets store" in ;M*). <n= num&er of users can in!o3e same form to enter "etails. G characters transaction7i" is associate" for each screen. 'ontrol region pro!i"es this facility of system "efinition. It uses 1 macros 0. Transact 1. %pplctn %fter typing transaction i" at the terminal+ program is loa"e" into memory > starts e#ecution. 3erminolo6% CICS >uasi-reentranc% IMS Serial reusa(ilit%
If any program fails+ IMS pro!i"es transaction support to un"o all changes. 'ontrol region pro!i"es a log where IMS writes. %ll the entries li3e pgm0 start+ pgm1 start +empa"" "elt are store" into log. e1ory Disk %ape
Page ,5 of 89
.hen transaction is un"er e#ecution+ changes are put into memory. %ll re:uests go through control region. So that in case of failure control region un"o the changes. That=s how control region 3eeps trac3 of all "ata&ase changes. Program shoul" not "irectly tal3 to "ata&ase. It shoul" &e thru control region. If program 1 fails control goes &ac3 to control region. It will loo3 out for the changes in the log for program 1 an" un"o the changes. Therefore IMS pro!i"es atomicity to un"o the changes. IMS tal3s to "ata&ase on &ehalf of program Isolation is a!aila&le &y I)$M. %t the time of IMS generation+ select 5 0. IMS 'omponent Program Isolation Manager (In7&uilt) or I)$M 1. DB)' /es/4o .hile testing your program in &atch D$/I mo"e+ DB)' is 4. Because here you are wor3ing on "ummy "ata&ases or copy of "ata&ases. /ou are not wor3ing on real "ata&ases. Therefore DB)' is not re:uire" o!er here. -ere "ata&ases are use" for the creation of test "ata. If anything fails you Just ha!e to reloa" the "ata > start again. Therefore DB)' is <4= here. In real application it must &e </=.
'!$
DB!)
D$/'
)! ;M*)
' S/DB
P3 1 P3 P3 ( , 0S
,sers
%&o!e en!ironment is a normal en!ironment+ which run "uring office time (C7D) /ou run &atch program "uring off time i.e. after D pm. So "uring office time+ control region will ta3e charge of all the "ata&ase. If you try to use any "ata&ase for &atch Jo&+ you won=t get e#clusi!e control o!er it since control region is ha!ing e#clusi!e control on all the "ata&ases. Therefore you ha!e to use this "ata&ase for &atch Jo& after Dpm.
Page ,7 of 89
)! ;mgr
In a :ueue all messages gets accumulate" > then once in a "ay or so get processe" &y &atch program. This won=t ha!e trans7i" associate" to any program. 'ontrol region won=t sche"ule for this. There are two types of BMP57 0. Transaction Oriente" BMP 1. Batch Oriente" BMP Process 0. 1. MPP5 Imme"iately BMP7Transaction5 Defer7%ccumulate(accumulate" into :ueue > processe" &y &atch pgm)7Process .hen6 0 "ay+ 0wee3+ 0 month5 "epen"s on Business nee"s BMP7Batch5 %ccumulate" &y some&o"y7file -ere e!ents are capture" &y thir" party an" gi!en to us as files
2.
Page ,8 of 89
Screen Definitions (9iel"s > attri&utes) 0S #B) )o1pany My"ata E1pno: Na1e :
Page ,8 of 89
Data T 9ormat T De!ice 'haracteristics 1B+GA 5 Terminal type (21IA+1) 9ormat5 0. 1. 2. B. Position %ttri&ute Initial (alue $ength
Terminal
9ormat+ "e!ice characteristics an" %ID 3ey presse" this information you shoul" gi!e to IMS. A11lication .ro6rammin6 3ransaction Manual contains information a(out de;ices under :E9" cate6or% *ith full s%nta=!
4ote5 0. Eeep all the fiel"s on screen as %$P-% only. In a program you ta3e care of numeric an" "ecimal place etc. !ali"ation are "one in program only. 1. %fter pressing %ID 3ey+ terminal har"ware will sen" &ac3 only mo"ifie" fiel"s. It 3eeps trac3 of it &y one &it in attri&ute &yte+ which is MOD or 4OMOD. 2. '$ %)+ P%0 to P%2 3eys ha!e special meaning for IMS. Data is not transmitte" for these 3eys. Only IMS wor3s on these 3eys.
Page ,9 of 89
P)I4T 4O* 4 If you gi!e <AA'A=+ all the fiel"s are cleare" TIT$ L%DD MP S') 4L &efore sen"ing the screen to the terminal. UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU %DD MP 9MT D ( T/P H(21IA+1)+ @ 9 %THI*4O) + @ S/SMS*HM S*1+ Only unprotecte" fiel"s @ DS'%HLAA%AL+ are cleare" @ P9EH(P9E9$D1+LA0L+LA1L+LA2L+LABL+LAFL+LADL+LAIL+LAGL+ @ LACL+L0AL+L00L+L01L+L02L+L0BL+L0FL+L0DL+L0IL+L0GL+L0CL+ @ L1AL+L10L+L11L+L12L+L1BL) DI( T/P HI4O,T DP%* ',)SO)H((G+2F))+ @ 9I$$HPT D9$D LS/4T $ MP$O/ S/ST ML+ @ POSH(1+10)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) D9$D LUUUUUUUUUUUUUUUUUUUUUUL+ @ POSH(2+10)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) D9$D L%DD MP$O/ L+ @ POSH(F+1I)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) D9$D L777777777777L+ @ POSH(D+1I)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) D9$D L MP 4O5 L+ @ POSH(G+11)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) MP4O D9$D POSH(G+2F)+ @ $T-HD+ @ %TT)H(,4P)OT+%$P-%+4O)M+MOD) D9$D L MP 4%M 5 L+ @ POSH(0A+11)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) MP4%M D9$D POSH(0A+2F)+ @ $T-H2A+ @ %TT)H(,4P)OT+%$P-%+4O)M+MOD) D9$D L MP %DD) SS5 L+ @ POSH(01+11)+ @ %TT)H(P)OT+%$P-%+-I+4OMOD) MP%DD) D9$D POSH(01+2F)+ @ $T-HBA+ @ %TT)H(,4P)OT+%$P-%+4O)M+MOD)
Page 49 of 89
M S*1
D9$D
M9$D
M9$D
T/P HI4P,T+ SO)H(%DD MP+I*4O) )+ 4@TH%DDO S * <M9ST)4A1L+ $T-HG (P9E9$D1+LAAL)+ $T-H1 MP4O+ $T-HD+ ?,STH)+ 9I$$H'LAL MP4%M + $T-H2A+ ?,STH)+ 9I$$H'L L MP%DD)+ $T-HBA+ ?,STH)+ 9I$$H'L L
@ @ 4T ) 3ey
@ @ @ @ @ @ @ @ @ @ @
S * M9$D
M9$D
M9$D
M9$D
T/P HO,TP,T+ @ SO)H(%DD MP+I*4O) )+ @ 4@TH%DDI .hen %TT)H/ S+ length is increase" &y 1 &ytes MP4O+ @ $T-HG+ @ %TT)H/ S MP4%M + @ $T-H21+ @ %TT)H/ S MP%DD)+ @ $T-HB1+ @ %TT)H/ S ))MS*+ @ $T-HIC
Page 41 of 89
Page 4( of 89
91 'NP*%= S3> 95 'NP*%=$$ 95 'NP*%=LL 95 'NP*%=%!#N 95 'NP*%=P0KE& 95 'NP*%=N" 95 'NP*%=N# E 95 'NP*%=#DD! 91 "*%P*%= S3> 95 "*%P*%=$$ 95 "*%P*%=LL 95 "*%P*%=N"=#%%! 95 "*%P*%=N" 95 "*%P*%=N# E=#%%! 95 "*%P*%=N# E 95 "*%P*%=#DD!=#%%! 95 "*%P*%=#DD! 95 "*%P*%= ES31=#%%! 95 "*%P*%= ES31
P') P') P') P') P') P') P') P') P') P') P') P') P') P') P') P') P')
S9@9,A S9@9,A ?@98A> ?@9(A> ?@97A> ?@,9A> ?@49A> S9@9,A S9@9,A ?@9(A> ?@97A> ?@9(A> ?@,9A> ?@9(A> ?@49A> ?@9(A> ?@89A>
Page 4, of 89
-ow DD statements for "ata&ases are gi!en6 Ta3e DD names from DBD* 4 > "ataset names (physical names) from DB%. If you want to test the D$/I program+ you allocate "ataset for yourself+ you cannot use pro"uction "ataset. Populate the "ataset from pro"uction "ataset recor"s. ,ind out data(ase/dataset# 1s(-name namin6 standards! &I' Get the list of 1roduction data(ase F corres1ondin6 datasets!&3a+e hel1 of DBA or onsite 1erson' &II' Cou *ant to test a 1ro6ram so %ou should +no* *hich datasets %ou are usin6! ,or this refer to .SBGEG for the 1ro6ram A! Get the dataset names B! $sin6 list &II' datasets as model# allocate datasets for test! &$se ,ile-Aid'! So usin6 this em1t% dataset *ill 6et allocated C! Load test data usin6 A! M3D B! Select some data se6ments from the 1roduction dataset i!e! e=tract records from 1roduction usin6 file-aid! But tests dataD )e don?t +no* *hether it co;ers all the conditions or not! If %ou modif% this test data# then it should (e u1dated else*here! It mi6ht (e usin6 secondar% inde= etc! 3herefore it is not a relia(le method of creatin6 test data! C! Re== routine for test data! DD names F dataset names are 6i;en in test HCL!
S)EP'IB DD points to IMS.) S$IB+ which contains the IMS nucleus an" re:uire" action mo"ules. It must &e authoriKe". P$OC'IB DD points to IMS.P)O'$IB+ which contains all cataloge" proce"ures an" Jo&s for IMS. S%S!D!MP DD "efines a "ump "ata set. This DD statement is optional. The following DD Statements are optional+ "epen"ing upon your particular re:uirements. D<SC)' DD contains the S T) an"/or S TO statements to specify the processing options an" ranges re:uire" at sche"uling time. The S TO (S T Options) statement pro!i"es the a&ility to set the processing options to control the e#ecution of -SSP. The S T) (S T )ange) statement is use" to restrict access to specifie" parts of a D DB.
Page 44 of 89
D<SS)A) DD "efines a "ata set "escri&ing DB call an" &uffering acti!ity "uring an applicationLs e#ecution. The reports are written when the application terminates. If you are intereste" in recei!ing //D9SST%T reports+ inclu"e a //D9SST%T DD statement in this proce"ure. %n e#ample of this statement follows5 //D9SST%T DD S/SO,TH% 9or more information on these reports+ see IMS/ S% Data&ase %"ministration *ui"e. IMS DD %"" an IMS DD statement for IMS.PSB$IB+ concatenate" with IMS.DBD$IB+ if *S%M "ata&ases are accesse" &y the &atch application. The statements are5 //IMS DD DS4HIMS.PSB$IB+DISPHS-) // DD DS4HIMS.DBD$IB+DISPHS-) The PSB for the &atch application program must &e containe" in the IMS.PSB$IB+ an" the DBDs for the *S%M "ata&ases reference" &y the PSB must &e containe" in the MS.DBD$IB. D9S S$ DD .hen the SSM parameter is specifie" (or "efaulte" to &y specification in the control region)+ the su&system li&raries+ which must &e %P9 authoriKe"+ must &e a!aila&le to this region. If ?OB$IB/ST P$IB/$I4E$IST concatenation is not authoriKe"+ you must use the D9S S$ DD statement. 9or online IMS regions+ the su&system li&rary or li&raries must &e concatenate" after the li&rary containing the IMS mo"ules (usually IMS.) S$IB). .hen multiple su&systems are connecte"+ a""itional su&system "ata sets can &e concatenate".
Page 45 of 89
Data&ase 'all
4o ?'$
B P ?'$
-ere how you get the "ataset names an" ""names6 %ll the "ata&ases information is a!aila&le with control region therefore the "" statements shoul" &e 3nown to control region for BMP programs. .e are not re:uire" to gi!e ""names > "atasets names since they are a!aila&le with IMS control region.
0. 1. 2. B.
$og on to IMS region IBM screen will &e in front of user Inform a&out Transaction7i" of M Screens MPM 4,I MP%DDI MP$ISTI
Page 47 of 89
(III) 0S$'B IMS (II) /0"! E P N*" 0S (I) 1> (> EN* #DD 'NE*'!&
1.
MPM4,O
)ontrol !egion 'hec3 for !ali" transaction i". E1gr 0S / E P N*" *nkno2n %ransid
2.
MPT)4A0 (ali" Transaction I". $$+ VV+ MPT)4A0 (total 01 &ytes) Message is create" in :ueue with length 01+ rest all will &e spaces. Program associate" with MPT)4A0 will &e starte" &y IMS an" program will "isplay a sreen.
Page 48 of 89
System
E P%!N91 E PP3 91
* T ) ;, ST A0 re:uest (II $$ 777777 01 VV 777777 A MPT)4A0 enu Pf1: #dd Pf(: 'nCuiry :
01 &ytes
S 4D M 4, Screen (III
If P90 is Presse"
(I:
0B &ytes
IIIIII 91
* T ) ;, ST A0 re:uest (: $$ 777777 0B VV 777777 A 0B &ytes MPT)4A0 A0 (:I Program !ali"ates 3ey presse" if 3ey is !ali" transfer control to respecti!e program else "isplay error message on screen
Page 48 of 89
Page 49 of 89
'all
<'B$TD$I=
*, IO7P'B I4P,T7MS*7%) %.
%ll system ser!ice call wor3s with IO7P'B If IO7ST%T,S7'OD 7P'B H <;'= Mo!e <y= to no7more7mesg lse If IO7ST%T,S7'OD 7P'B 4OT H <;'= %4D 4OT H SP%' S '%$$ error routine n"7if n"7if
'all
<'B$TD$I=
IO-PCB 91 '"=P)B> 95 '"P)B=$%E! P') 95 0'$$E! P') 95 '"P)B=S%#%*S=)"DE P') 95 '"P)B=6*$'#N=D#%E P') 95 '"P)B=%' E="0=D#& P') 95 '"P)B= S3=SEE P') 95 '"P)B= "D=N# E P') 95 '"P)B=*SE!='D P') A2te-nate PCB 91 %!#NS0E!=P)B> 95 %!#NS0E!=$%E! P') ?@98A> 95 0'$$E! P') ?@9(A> 95 %!#NS0E!=S%#%*S=)"DE P') ?@9(A> Developed By: Shilpa Keluskar & Suvarnalata Naik
?@98A> ?@9(A> ?@9(A> S9@98A )" P=,> S9@98A )" P=,> S9@98A )" P> ?@98A> ?@98A>
Page 59 of 89
PSBs shoul" ha!e a P'Bs in the following or"er5 0. 1. 2. B. IO7P'B %$T )4%T 7P'Bs DB7P'Bs *S%M7P'Bs
%n Online programs get IO7P'B automatically. Therefore BMP programs will get IO7P'B automatically. 4ote5 9or )ealia+ in .%'B file a"" following statement5 P'B T/P HTP+MODI9/H/ S PSB* 4 4%M HRRRRRRRRRRRRRRRR
Page 51 of 89
'oncatenate" Eey5 ,se" in -IS%M+ -D%M+ -ID%M. Pointer is a num&er+ which is use" to reference a particular segment. To get employee information for particular s3ill then you will use empno an" s3illi" as a concatenate" 3ey. If concatenate" 3ey is use" as pointer then all the 3eys in!ol!e" in that concatenate" 3ey must &e uni:ue. )B%5 %nother way of locating segment. 'an &e use" in -D%M an" -ID%M. 9or -IS%M use 'oncatenate" Eey. In -IS%M )B% is not fi#. It changes as new split ta3es place in control inter!al therefore )B% !alue changes accor"ingly therefore in -IS%M you cannot use )B% to locate a segment. .hereas in -ID%M+ the )B% remains unchange".
Page 5( of 89
IMS )e-min,2,gy Sym&olic ('oncatenate" Eey). Direct ()B%). This is more efficient &ut has restriction of not &eing use" for -IS%M. *, MP ( 4%M ; %B')
%ll search fiel"s can also &e use" to :ualify a segment &ut here performance as compare" to se:uence fiel" will &e lowere"+ &ecause it will scan all the root segment occurrences till it fin"s ename %B'. Search fiel" cannot &e use" to pro"uce a list in ascen"ing or"er of the search fiel". In (S%M the solution for this is <%lternate In"e#es=. So we nee" to "efine another in"e# on 4%M . In IMS it is referre" as Secon"ary In"e#. If there are more employee with same nameW IMS resol!es this pro&lem &y intro"ucing another SDS file. So Secon"ary in"e# is ESDS plus SDS file.
N# E
P%!
( ,
IIIIIII>
In IMS all things are in terms of "ata&ase therefore you nee" to "efine secon"ary in"e# "ata&ase. In"e# "ata&ase will &e a root only "ata&ase+ which contains search fiel" an" pointer N# E P%!
If search fiel" is not uni:ue+ another "ataset gets a""e" to this "ata&ase an" together this is your secon"ary in"e# "ata&ase.
Page 5, of 89
DataBase ESDS N# E P%! 9irst Match SDS P%! P%! P%! IIII>> Secon" Match an" so on
-ere there is "elay in access therefore IMS "oes not recommen" to 3eep secon"ary in"e# as nonuni:ue. .hich is not practical. IMS pro!i"es some mechanism for ma3ing In"e# 3ey uni:ue. 0. In"e#e" fiel" can &e ma"e of (up to) F fiel"s in any or"er i.e. in"e# can &e &uilt on com&ination of multiple fiel"s. 1. /ou can a"" upto F fiel"s as su&7se:uence fiel"s. But IMS will loo3 for main in"e# fiel" only. !en programmers will see Just 4%M fiel" only. Su&7se:uence fiel"s are not !isi&le to program. IMS uses them to ma3e 3ey uni:ue an" a!oi" o!erhea" of SDS. 9or IMS N# E SuB=seC=field P%!
9or programmer
-ere "uplicates are not a!oi"e" &ut now they are store" into one "ataset therefore re"uce" o!erhea". %s a programmer you "on=t ha!e access to su&7se:uence fiel". Programmer has to ta3e care of "uplicates. 2. Inspite of using su&se:uence fiel"+ you cannot guarantee to ma3e 3ey uni:ue+ So IMS uses system relate" fiel"5 /S@ ("irect Pointer) an" /'E ('oncatenate" Eey) /S@5 IMS uses in"e# fiel" an" )B% (-D%M+-ID%M) /'E5 IMS uses in"e# fiel" an" concatenate" fiel" (-IS%M+ -D%M+ -ID%M)
Page 54 of 89
)a-get Segment: One+ which is retrie!e" using secon"ary in"e#. S,#-5e Segment: One+ which supplies !alues for secon"ary in"e#. P,inte- Segment: One+ which stores supplie" 3ey !alue an" pointers to target segment. 9or e#ample5 Secon"ary In"e#5 4%M Source Segment5 MPS * Target Segment5 MPS * Pointer Segment5 In"e# "ata&ase segment Target an" source segment nee" not &e same. If we want to &uil" secon"ary in"e# on s3ill then create s3ill7i" secon"ary in"e#. -ere again many employees will ha!e same s3ill7i". If use" /'E Secon"ary In"e#5 SEI$$ID Source Segment5 SE$ Target Segment5 MPS * Pointer Segment5 In"e# "ata&ase segment+ which is rootonly
Skill=id
)K P%!
To employee
Page 55 of 89
Page 57 of 89
Page 58 of 89
$'-I$D esta&lishes relationship &etween segments of two physically separate "ata&ases. $'-I$D statement comes un"er target segment an" it shoul" &e imme"iately followe" &y @D9$D statement.
Page 58 of 89
Sour.e
%arget Pointer
9rom any source segment+ you can select 0 to F fiel"s. 2. I"entify 0. Source Segment 1. Target Segment 2. Pointer (/ou ha!e to &uil" this segment. It is a separate "ata&ase) If MP4%M is a secon"ary in"e#5 Source Segment5 MPS * Target Segment5 MPS * If SEI$$7ID is a secon"ary in"e#5 Source Segment5 SE$S * Target Segment5 MPS * B. $'-I$D > @D9$D statements are to &e co"e" un"er target segment.
Page 59 of 89
F. If "uplicates names are present then IMS re:uires another SDS "ataset to store those pointers. ESDS SDS #B) 998 915 9(9 9,5 945
This re:uires high o!erhea". So the solution for this is use to Su& Se:uence fiel". Pic3 up some !alue from same segment an" put it in ESDS "ataset. But still in"e# will &e on 4%M . But now 4%M T fiel" is uni:ue. Programmer will still refer to 4%M + &ut IMS &uil"s the in"e# on 4%M T fiel". So for IMS "uplicates are not there. D. Sometimes there won=t &e any fiel" which ma3es in"e# uni:ue then IMS gi!es other option of /'E an" /S@ (these are system relate" fiel"s) 9I $D 4%M H/'E0 ST%)TH0 B/T SHD @D9$D RRRRRRRRRRRRRRR.S,BS ;H/'E0
)efers to concatenate" 3ey. -ere it is MP4O so D characters. This fiel" is not store" as a part of your segment. This fiel" is store" in In"e# "ata&ase. /S@ re:uires B &ytes &ecause it wor3s with )B%. This is use" with -D%M an" -ID%M &ut not -IS%M. .hereas use /'E with all. 9I $D 4%M H/S@0 ST%)TH0 (here B/T S are not re:uire" since it is always B &ytes) I. If In"e#e" "ata&ase is -IS%M then in In"e# "ata&ase POI4T ) must &e S/MBO$I' G. If In"e#e" "ata&ase is -ID%M then in In"e# "ata&ase POI4T ) may &e S/MBO$I' or S4*$ C. -ow to ma3e use of this In"e#6
4ormal .ay of %ccess ( MP4O) PSB P'B T/P HDB+ 4%M H MPDBD+P)O'OPTH% S *M S *M PSB* 4 PSB4%M HRR..+ $%4*,%* HRRR.
,sing Secon"ary In"e# ( MP4%M ) PSB P'B T/P HDB+ 4%M H MPDBD+ P)O'OPTH%+ P)O'S ;H4%M DBD S *M S *M PSB* 4 PSB4%M HRR..+ $%4*,%* HRRR.
Page 79 of 89
0A. /ou can co"e n num&er of P'B "epen"ing on your access re:uirement 00. ,se I4DI' S to access "ata&ase in normal se:uence an" faster access to segments. +,9 t1e Se5,n.a-y In.e@ Is Maintaine. .hen a source segment is inserte"+ "elete"+ or replace" in the "ata&ase+ IMS 3eeps the in"e# current. IMS "oes this whether or not the application program performing the up"ate uses the secon"ary in"e#. The way in which IMS maintains the in"e# "epen"s on the operation &eing performe". )egar"less of the operation+ IMS always &egins in"e# maintenance &y &uil"ing a pointer segment from information in the source segment that is &eing inserte"+ "elete"+ or replace". (This pointer segment is &uilt &ut not yet put in the secon"ary in"e# "ata&ase.) .hen a source segment is inserte"+ D$/I "etermines whether the pointer segment nee"s to &e suppresse". If the pointer segment nee"s to &e suppresse"+ it is not put in the secon"ary in"e#. If the pointer segment "oes not nee" to &e suppresse"+ it is put in the secon"ary in"e#. .hen a source segment is "elete"+ IMS "etermines whether the pointer segment is one that was suppresse". If so+ IMS "oes not "o any in"e# maintenance. If the segment is one that was suppresse"+ there shoul" not &e a correspon"ing pointer segment in the in"e# to "elete. If the pointer segment is not one that was suppresse"+ IMS fin"s the matching pointer segment in the in"e# an" "eletes it. ,nless the segment contains a pointer to the SDS "ata set+ which can occur with a non7uni:ue secon"ary in"e#+ the logical recor" containing the "elete" pointer segment in a ESDS "ata set is erase". .hen a source segment is replace"+ the pointer segment in the in"e# might or might not &e affecte". The pointer segment in the in"e# might nee" to &e replace"+ or it might nee" to &e "elete". %fter replacement or "eletion+ a new pointer segment is inserte". On the other han"+ the pointer segment might nee" no changes. IMS "etermines what nee"s to &e "one &y comparing the pointer segment it &uilt (the new one) with the matching pointer segment in the secon"ary in"e# (the ol" one). If &oth the new an" the ol" pointer segments nee" to &e suppresse"+ IMS "oes not "o anything (no pointer segment e#ists in the in"e#). If the new pointer segment nee"s to &e suppresse" &ut the ol" one "oes not+ then the ol" pointer segment is "elete" from the in"e#. If the new pointer segment "oes not nee" to &e suppresse" &ut the ol" pointer segment is suppresse"+ then the new pointer segment is inserte" into the secon"ary in"e#.
Page 71 of 89
If neither the new or the ol" segment nee"s to &e suppresse" an"5
If there is no change to the ol" pointer segment+ IMS "oes not "o anything. If the non3ey "ata portion in the new pointer segment is "ifferent from the ol" one+ the ol" pointer segment is replace". ,ser "ata in the in"e# pointer segment is preser!e" when the pointer segment is replace". If the 3ey portion in the new pointer segment is "ifferent from the ol" one+ the ol" pointer segment is "elete" an" the new pointer segment is inserte". ,ser "ata is not preser!e" when the in"e# pointer segment is "elete" an" a new one inserte".
Page 7( of 89
IMS/DC )-ans7e- C,nt-,2 t, ,t1e- 4-,g-am To transfer control to another program use5 %lternate P'B '-4* 'all IS)T 'all
P'B T/P HTP+ MODI9/H/ S 0. Set alternate P'B to re:uire" "estination i.e. transaction co"e of the program. 1. Insert a message using alternate P'B. 1 1 NS=DES% P') ?@98A> SN%= S3> 95 SN%=$$ 95 SN%=LL 95 0'$$E! P') S9@9,A )" P +#$*E ;M5<> P') S9@9,A )" P +#$*E LE!"S> P') ? +#$*E -'3-=+#$*ES>
%!#NS0E! SE)%'"N> "+E ; 0S%!N9(< %" NS=DES%> )#$$ ;)B$%D$'< *S'N3 D$'=)-N3 #$%=P)B NS=DES%> #lternate P)B is generated By ' S to .hange the .ontent of this area> Ne are suppose to use this .all> &ou .annot dire.tly assign value to #lternate=$%E! field of alternate P)B to 0S%!N9( %hen you issueH )#$$ ;)B$%D$'< *S'N3 D$'='S!% #$%=P)B SN%= S3 %his 1essage is Fust for syntaD .o1pletion
Page 7, of 89
Page 74 of 89
$$ ( 01
LL (
E P%!N91 8
Program will recei!e this message now you are suppose to sen" M 4, screen 1. /9O) MPM 4,O
$$ (
LL (
E P%!N91 8
?? (
0B
So Menu Program will recei!e 1 types of messages. One will &e 12 &ytes length an" other will &e 1* &ytes length
Page 75 of 89
It will recei!e F &ytes length message from M 4, program Sen" %"" Screen+ user will a"" "ata an" will press specifie" %ID 3ey to sa!e "ata. Program will recei!e input message of CD characters. $$ ( LL ( E P%!N9( 8 ?? ( N" 7 N# E #DD! ,9 49
P-,g-am 3 Program 0 will transfer = &ytes to program 2. Ta3e first fi!e employees into wor3ing storage then reply &ac3. If P9I is presse"5
$$ (
LL (
E P%!N9, 8
?? (
-ow to get last employee num&er of pre!ious screen to "isplay ne#t fi!e recor"s6 There are two possi&ilities5 0. $$ ( LL ( E P%!N9, 8 98 ( E PN" 7
1. Store employee7num&er some where &efore reply &ac3. Then afterwar"s co7 relate with terminal user an" use it.
Page 77 of 89
So+ 0. 'reate one "ata&ase (-D%M) which will &e root only
$%E!
E PN"
1. 'reate one fiel" on screen+ 3eep it as hi""en fiel"+ store start an" stop !alues to it.
$$
LL
E P%!N9,
98
9991
9995IIIIIIII
4ote 5 'reation of list on screen DO F D9$D 5 5 4D 2. Store this in memory ($i3e commarea in 'I'S)
Page 78 of 89
Bits A an" 0 are use for cursor positioning5 AA 5 Positioning not re:uire" 00 5 Position cursor on this fiel"
Bits 1 to I are always Keros. AAAAAAAAA 5 # <AA= 00AAAAAAA 5 # <'A= So if !ali"ation of fiel" fails Mo!e <'A= to attri&ute &yte of the fiel" to position cursor on that fiel".
Bit A 5 %lways 0 Bit 0 5 A or 0 (use always 0) Bit 1 5 Protection %ttri&ute. A7,nprotecte"+ 07Protecte" Bit 2 5 Shift %ttri&ute. A7%lphanumeric Shift+ 074umeric Shift Bit B an" F 5 Intensity %ttri&ute. AA74ormal+ A074o Display+ 0A7Bright+ 007Bright Bit D 5 $ight Pen Detection. Shoul" always &e Keros Bit I 5 Mo"ifie" "ata tag. A7MD9 O99+ 07MDT O4
Page 78 of 89
91 "*%P*%= S3> 95 $$ III 95 LL III> 95 #%%!1# P') ?@91A> 95 #%%!1B P') ?@91A> 95 0'E$D1 P') ?@=A> 95 #%%!(# P') ?@91A> 95 #%%!(B P') ?@91A> 95 0'E$D( P') ?@=A> : "+E ?<)9< %" #%%!1#> "+E ?<)D< %" #%%!1B> A2te-nate PCB
There are two types of %lternate P'B 0. Mo"ifia&le P)B %&PEG%PH "D'0&G&ES
%lternate P'Bs are also use" to sen" messages to other terminals (for &usiness nee"s) 9or such case use this type. %n" issue 0. '%$$ '-4* $T )MA0 1. '%$$ IS)T 2. ,se P,)* call. This will force the message to go to that terminal 1. 9i#e" P)B %&PEG%PH $%E! GE P%!N9( P)B %&PEG%PH $%E! GE P%!N9,
Page 79 of 89
This call goes to control region. Data&ase is 3nown &y D&7P'B. In this DBD mention D%T%S T H DD4%M In a startup ?'$ you specify the "" statement for D$/I "ata&ase. This is the way of IMS to inform control region a&out "atasets. .hate!er is running un"er IMS/D'+ "oes not re:uire any DD statement that is how all online programs+ which are MPP+ accesses "ata&ases. %lso for BMP programs DD names are not re:uire".
B. Instea" of allocating all the "atasets in a"!ance which increases the o!erhea" of system+ another way is5 D9SMD% macro statements5 Dynamic allocation on "eman" D0S D# DDII>>E PDBI>>DSNGIIIII> : : : 9or 2AA "ata&ases + you=ll get 2AA D9SMD% mem&ers. .hen they are translate" they are 3ept into one li&rary. This li&rary must &e concatenate" to your ) S$IB. Initially "ata&ase is not allocate". .hen program starts e#ecution an" it ma3es call to that "ata&ase+ IMS loo3s it into this li&rary an" allocates space. 9or each "ata&ase there will &e a separate PDS mem&er. .hich will ha!e DD an" "ataset name.
F. .hy we run programs in BMP6 .e cannot gi!e e#clusi!e control to "ata&ase. .e want other programs to share the "ata&ase therefore in pro"uction most of the programs are BMP programs. If they are D$/I they must run "uring nighttime+ when online system is off. In D$/I + "ata sharing in not a!aila&le. /ou r Jo& is "irectly running un"er M(S+ gains e#clusi!e control on "ata&ases.
Page 89 of 89
D. 'oncurrency5 Many users using "ata&ases simultaneously 7%'ID property of transaction I. MPP online programs5 ach message is a transaction. .hen program fetches ne#t message+ pre!ious transaction is complete" an" resources are release". In a shared s%stem it is necessar% to release a loc+ as soon as 1ossi(le 0nline transaction should not ta+e lon6 time
G. BMP Batch programs5 IMS assumes Start of the program an" n" of the program as one transaction. If you are up"ating payroll at en" of month+ which is a BMP transaction. So until this program finishes+ all the in!ol!e" segments will not &e a!aila&le which is not a welcome situation therefore some mechanism+ which shoul" release the resources in &etween (otherwise "ata won=t &e a!aila&le to other program+ might get IIIerror) since &atch program is hol"ing those resources. To resol!e this+ some position in &etween is re:uire". There are 1 types of &rea3s5 a. Brea3 it &y time &. Brea3 it &y num&er of input recor"s processe" )1e 9ay t, /-eaB is #se ,7 C1e5B4,int 5a22. IMS pro!i"es this facility. .hate!er is loc3e" up to that chec3point call is release" for other programs to use.
Page 81 of 89
-ow to fin" out whether any other concurrent user is using that resource or a segment6 Ma3e use of $og (System $og) %nalyKe PSB+ how many programs are using the "ata&ase you are going to up"ate. If you foun" that P0+ PI+ PFD+ P2F programs also uses the "ata&ases you are using+ ne#t fin" out The usage or fre:uency of the program going to run. If they are running fre:uently then you ha!e to gi!e fre:uent chec3points. If the fre:uency is low+ you may not gi!e chec3points after e!ery transaction
1. Determine fre:uency (4ot for %M @) 2. %)'5 %pplication )estart 'ontrol. It=s a utility to "ynamically change the chec3points. B. 'hec3point after e!ery transaction.
%nother reason for chec3point5 0. )estart5 If program a&en"s+ you shoul" start from the transaction+ which was not committe". 1. )eco!ery5 If "is3 "ri!e fails+ then you ha!e a "ata&ase &ac3up+ ta3e log "ataset+ from log get the up"ates an" up"ate the &ac3e" up "ata&ase an" &ring it to current position where the failure occurre". Therefore ta3e image copy of e!ery "ata&ase "aily+ hourly+ wee3ly etc. So that you can ta3e a latest copy of it an" then apply all the changes from log for that "ata&ase to the image copy. This is forwar" reco!ery. 4ow you ha!e to restart the program from the point where the %B 4D occurre" in the last e#ecution. +,9 4-,g-am 9i22 .e5i.e 7-,m 91i51 4,int t, sta-tF (for e#ample in the pre!ious e#ecution 2CCAAA recor"s were processe" so now it shoul" start from BAAAAAth recor") !ery chec3point will ha!e chec3point i"entifier. -ow to get uni:ue 'hec3point7i"6 9irst time run a normal run without %B 4D. /ou will get ? S message for last transaction+ which will ha!e some message num&er. 9rom where you will get chec3point i"6 (?OB$O*) ? S
Page 8( of 89
0.
.hen you are running program as a BMP+ if %B 4D occurs then IMS &ac3s out the changes you ha!e ma"e up to the pre!ious chec3point. 1. .hen you are running program as a D$/I+ this "oes not happens automatically+ you ha!e to &ac3e" out using some utility(Batch Bac3out ,tility). /ou ha!e to gi!e the chec3point7 i" to which you want to &ac3e" out for restart. (options in ?'$)
$O* IMS/D' uses O$DS (Online $og "ataset). It contains system relate" information an" "ata&ase (IMS) relate" information. It is implemente" in 2 stages5 0. Memory Buffer 1. Dis3 Dataset (there are 2 i"entical "atasets. .hen this gets full+ it is mo!e" on to Tape) 2. Tape Memory &uffer an" "is3 "atasets are .%DS (.rite %hea" Datasets+ smaller siKe+ faster "e!ices) DB)' software rea"s O$DS from Tape %gain Tape is "i!i"e" into 1 types 0. System $og "ataset (S$DS) 1. Data&ase reco!ery $og ()$DS) In a""ition to O$DS+ IMS also maintains )DS()estart Dataset). This is nothing &ut IMS chec3points to restart IMS in case of IMS failure. These are not our program chec3points.
999 A(end-deadloc+ a(end! ,rom s%stem lo6 ta+e 1rint of =? 9? re1ort to +no* *hich other concurrent 1ro6rams are usin6 data(ase the one *hich %our 1ro6ram is usin6 Chec+1oint fre5uenc% needs to (e increased
Page 8, of 89
9irst B characters will &e program i"5 92FA or 92FF $ast B characters will &e num&er up to CCCC But in this case if CCCC limit is reache" it resets to Kero. So here now 1 recor"s can ha!e "uplicate chec3point. Then which one will IMS use the first one or last one6 So for this also inclu"e time7stamp information into chec3point7i". 9ormat for which is5 IIDDD--MMDSSST II5 )egion I" DDD--MMDSSST5 %ctual time in "ays+ hours+ minutes+ secon"s+ an" 0Ath of secon". Or IMS chec3s log &ac3war"+ so always it will ta3e the latest one.
IMS ta+es care of IMS data(ases onl%! IMS Lo6 *ill not su11ort an%thin6# *hich is not IMS su11orted!
Page 84 of 89
;SAM <i2es IMS cannot han"le other se:uential file for reco!ery. That is IMS "oes not support other files chec3point. 'OBO$ support for chec3point is ) ),4 clause in S $ 'T statement. M(S pro!i"es chec3point facility for all files. Therefore se:uential file ha!e to use M(S chec3points. %n" IMS files will use IMS chec3points. Both nee" to &e i"entifie" &y one single chec3point mechanism. So how to resol!e this6 Some how we nee" to ma3e se:uential file as IMS "ata&ase. So here se:uential file is wrappe" as "ata&ase. 4ow IMS will un"erstan" this se:uential file as a IMS "ata&ase. This type of "ata&ase is 3nown as *S%M (*eneraliKe" Se:uential %ccess Metho") "ata&ase. It is a wrapper for your input or output se:uential file
If %ou ta+e directl% se5uential file# as it is then %ou *ill not a(le to use IMS chec+1oints therefore con;ert this file to GSAM data(ase! Go* IMS *ill *or+ on it! 3his file *ill (e treated as an IMS data(ase
DBD "efinition DBD N# EG%!#NDBDH #))ESSG@3S# HBS# A D#%#SE% DD1G%!#N'NH !E)0 G0H !E)"!DG89 DBD3EN 0'N'SEND
PSB "efinition P)B %&PEGDBHN# EGE PDBD P)B %&PEG3S# HN# EG%!#NDBD PSB3EN END
GSAM data(ase cannot (e used (% M.. 1ro6rams GSAM data(ase can onl% (e 1rocessed (% BM. and DL/I 1ro6rams
Page 85 of 89
9our possi&le !alues gi!en to *S%M5 A55ess $ * 'S Meaning $oa" *et $oa" Se:uential. 9or e!ery write "is3 IO won=t ta3e place. )ecor"s get store" into &uffer. .hen &uffer gets full+ recor"s are written to "ataset *et Se:uential. .hile rea"ing "ata+ group of recor"s gets written into &uffer. .hene!er user as3s for particular recor"+ it is gi!en from &uffer. $ema-B .rite to "ata&ase )ea" "ata&ase .rite to "ata&ase. %M @ stan"ar". ,se" to impro!e performance &y re"ucing IO time.
;S
$ea.ing ;SAM in $an.,m M,.e ,sing )ecor" Search %rgument+ you can rea" the *S%M file ran"omly. )ecor" Search %rgument ()S%)5 )ecor" Search %rgument is ma"e up of two fiel"s5 91 3S# =!S#> 95 N"!D1 95 N"!D(
Declare this area in wor3ing storage of the program. .hen this area is specifie" with *4 call. %""ress associate" with recor" gets store in this area()S%). $i3e this you can get all the recor"s a""ress. 'reate an array for storing all )S% !alues. Then in the same program you can rea" recor" ran"omly using )S%. Simple *4 call5 (-ere you won=t get )S% information) )#$$ ;)B$%D$'< *S'N3 D$'=3N 3S# =P)B '"=#!E#
Page 87 of 89
(ariation On *4 call5 )#$$ ;)B$%D$'< *S'N3 D$'=3N 3S# =P)B '"=#!E# 3S# =!S# -ere you will get the !alue associate" with recor". This will &e a i"entifier for that recor". /ou can create an array of all )S% !alues 91 !S#=%#B$E> 95 3S# =!S# "))*!S (99 %' ES> : :
In the same program now you can rea" *S%M file ran"omly &y issuing *, call5 )#$$ ;)B$%D$'< *S'N3 D$'=3* 3S# =P)B '"=#!E# 3S# =!S# /ou can use *S%M7)S% with IS)T call. This is optional. .hen recor" gets written+ *S%M7 )S% will ha!e some !alue+ .hich you can use to retrie!e the same recor". )9, s4e5ia2 5a22s #se. 9it1 ;SAM *S%M "ata&ases are opene" IMS or you can open e#plicitly &y issuing following calls5
Page 88 of 89
.hen P92 3ey is presse" from your terminal+ i.e. go &ac3 to M 4,+ "elete the recor" associate" with your $T )M7ID. .hen user an" program are interacting with each other+ IC character hi""en fiel" or -D%M "ata&ase can &e use". %nother way is Scratch Pa" %rea (SP%) siKe5 21IDA &ytes5 This area is use" when programs interact with each other an" they nee" to pass "ata to each other. Scratch Pa" %rea5 IMS facility for session management use" &etween programs. %lso in single program. Definition of SP% shoul" &e such that it shoul" ta3e care of all communication iterations.
Pg11
Pg1(
Pg1,
Page 88 of 89
Program1 an" Program2 shoul" not &e allowe" to start &y typing transaction7i" of the program. To 3eep trac3 of this you shoul" store calle" programs transaction i". This is a general re:uirement. In a""ition for program 2 you nee" to sa!e page "etails an" then at top you nee" to a"" IMS relate" fiel"s. So SP% "eclaration will loo3 li3e this5 91 SP#=#!E#> 95 SP#=$$ P') S9@94A )" P> 95 SP#=LL1 P') S9@94A )" P> 95 SP#=LL( P') S9@94A )" P> 95 SP#=%!#NS#)%'"N=)"DE P') ?@98A> 95 N"!K=#!E#> 19 )#$$'N3=P3 P') ?@98A> 95 P3 ,=S#+E> 19 S)!"$$='N0" "))*!S 5 %' ES> 15 S)!"$$=P#3E P') 9@91A> 15 S)!"$$=S%#!% P') ?@97A> 15 S)!"$$=END P') ?@97A> 95 0'$$E! P') ?@1,A> %ll the 2 programs are going to use this 0AA &ytes SP% area. )ea"ing SP%5 9irst *, call will retrie!e the SP% followe" &y *4 call+ which retrie!es the message. )#$$ ;)B$%D$'< D$'=3* '"=P)B SP#=#!E# .hen nothing is sen"+ you will get <;'= status co"e. So chec3 for this status co"e. %fter this issue following to retrie!e messages. This will &e in loop until en"7of7message which is status co"e <;D= )#$$ ;)B$%D$'< D$'=3N '"=P)B S3=#!E#
Page 89 of 89
.riting SP%5
)#$$ ;)B$%D$'< *S'N3 D$'='S!% '"=P)B SP#=#!E#> )#$$ ;)B$%D$'< *S'N3 D$'='S!% '"=P)B "*%P*%= ES3>
Transferring control5
)#$$ ;)B$%D$'< *S'N3 D$'=)-N3 #$%=P)B NS=DES% )#$$ ;)B$'D$'< *S'N3 D$'='S!% #$%=P)B SP#=#!E# )#$$ ;)B$%D$'< *S'N3 D$'='S!% #$%=P)B SN%= S3
andatory
Page 89 of 89
Em1lo%ee Listin6 E P $'S% N" N# E #DD! ===== ========= ======= ===== ========= ======== P08=*P P08=D"NN P0,= EN*
EN*IIIII
,ser must start this system with M 4, 0. By typing transaction i" MPT)4A0 1. /9O) M 4,O If user starts with /9O) %DDO+ then how to stop user to start pgmAA1 "irectly6
Solution 05 (By using switch message) 'hec3 for message length. If it is F+ it=s a !ali" start. But how to chec3 for calling program name so mo"ifie" swt7msg will &e5 $$ LL %!#NS#)%'"N 'D P0KE&
Transaction i" of the calling program 'reate one &lan3 fiel" on %DD screen. .hen pgmAA0 starts pgmAA1 store calling program=s transaction co"e into this "ar3 fiel". So now pgmAA1 can chec3 for transaction co"e of pgmAA0 in this "ar3 fiel" to chec3 for a !ali" start. If pgmAA1 is start &y typing /9O) %DDO then this fiel" will &e &lan3. $i3e this you can chec3 for the correct start of the program
Page 81 of 89
EN*
9rom IO7P'B get the $T )M an" loo3 into (S%M "ataset. 9irst time you won=t fin" it so write it into the "ataset. Display &lan3 M 4, screen. 4ow control goes to M 4, program. ,ser enters 0st option so control goes to pgmAA1. Before transferring control to pgmAA1 change the calling program=s transaction co"e to MPT)4A0 in (S%M "ataset. So now pgmAA1 can chec3 for this transaction co"e to see whether it=s a !ali" start or not. Same for the $IST program.
Menu Program5 3E%= SS#3E> 3E%=0!" =+S# > 3E%= S3> !EP$&=B#)K> !EP$='S!%=+S# < 'S!%= S3 %!#NS0E! !EP$='N%"=+S# 'S!%=#$%=DES%
Solution 25 %ll these things can &e pro!i"e" &y Scratch Pa" %rea+ facility pro!i"e" &y IMS. Our re:uirement of storage 9or M4 , an" %DD program5 G &ytes 9or $IST program5 G &ytes T 0AA &ytes In a""ition 0B &ytes will &e for5 SP%7$$ SP%7VV0 SP%7 VV1 SP%7T)%4
Page 8( of 89
91 SP#=#!E#> 95 SP#=$$ P') S9@94A )" P> 95 SP#=LL1 P') S9@94A )" P> 95 SP#=LL( P') S9@94A )" P> 95 SP#=%!#NS#)%'"N=)"DE P') ?@98A> 95 N"!K=#!E#> 19 )#$$'N3=P3 P') ?@98A> 95 P3 ,=S#+E> 19 S)!"$$='N0" "))*!S 5 %' ES> 15 S)!"$$=P#3E P') 9@91A> 15 S)!"$$=S%#!% P') ?@97A> 15 S)!"$$=END P') ?@97A> 95 0'$$E! P') ?@1,A>
E P%!N91
The content of this SP% will &e all &inary Keros. IMS loo3s at your message first since it is for the first time IMS creates this area+ puts transaction7i" o!er here. 'alling program will &e &lan3. .hich is accepta&le con"ition since it is a starting program. Ma3e it as a MPT)4A0. Suppose it is not a &inary Keros that in"icates pgmAA1 or pgmAA2 must ha!e calle" the M 4, program. So all these are !ali" !alues for pgmAA0 to start P-,g-am PgmAA0 :a2#es t, /e 51e5Be. Binary Keros MPT)4A0 MPT)4A1 MPT)4A2 Binary Keros MPT)4A0 MPT)4A1 Binary Veros MPT)4A0 MPT)4A2 $ema-B 9irst start 'alling itself 'alle" &y pgmAA1 'alle" &y pgmAA2 )aise an error 'alle" &y pgmAA0 'alling itself )aise an error 'alle" &y pgmAA0 'alling itself
PgmAA1
PgmAA2
B% 1ressin6 CLEAR +e% S.A associated *ith that terminal *ill (e deleted!
Page 8, of 89
Page 84 of 89
.hen SP% is create" first time &y IMS+ IMS pulls out the transaction co"e from the message an" puts it into SP% transaction co"e. That is if the message is5 $$ ( SP% will &e LL ( %!#NS=)"DE 8 P0KE& (
$$ (
LL1 (
LL( (
%!#NS=)"DE 8IIIIIIIIIIII>
/ou ha!e to ta3e care of this situation. (Message length D). So for this rea" SP%+ ta3e transaction7co"e put it into message. So now message is &ac3 to 01 characters length. )1e-e is a 4-,/2em i7 t-ansa5ti,n 5,.e is 2ess t1an D 51a-a5te-s . The thing is IMS parsing for transaction co"e stops only after G characters or when &lan3 is encountere". That=s the reason of ta3ing care for 3eeping transaction7i" G characters long. If you 3eep transaction co"e G characters long only chec3 for D characters length nee" to &e "one after writing SP% area.
Page 85 of 89
Some e#amples of transaction co"e less than G characters5 In4#t Message Message A7te- 9-iting t-ansa5ti,n 5,.e t, SPA $$ 1 LL 1 9 1 /ou ha!e to ta3e care of this C character length message 1 $ema-B /ou ha!e to ta3e care of this D character length message
$$ LL E 1 1
P %!N 9 1 9 1
Transactionco"e pf3ey G 1
$$ 1 1 B $$ LL E 1 9 1 1
LL 1 2
9 1 1
P%
P %!N
.ro6rams *ith S.A are con;ersational 1ro6rams .ro6rams *ithout S.A are non con;ersational 1ro6rams
.hen mo!ing &ac3 to IMS from any screen that is pressing P9 2 to e#it+ write following steps in the associate" section5 0. insert spaces to transaction co"e of SP% 1. insert that spa to IMS+ using IO P'B
Page 87 of 89
.hen this call gets e#ecute" 0. 1. 2. B. F. )estart5 )estart will "o the repositioning of the "ata&ase+ it will 3eep the memory content i"entical as of pre!ious run fail. So if chec3point is gi!en when c3ptrH0I+ nee"s to restart from 9%2FAA0I. Program is re:uire" to wor3 in two mo"es5 0. 4ormal )un 1. )estart )un Therefore nee"s to communicate with program to inform whether it=s a normal run or restart run IMS creates recor"s with chec3point i"entification. It will also contain repositioning information %ll this will &e attache" with chec3point i"entification. %ll this information will go into log %ll the up"ates to "ata&ase since the last chec3point will &e ma"e permanent
Page 88 of 89
Synta#5 )#$$ ;)B$%D$'< D$'=?!S% '"=P)B '"=#!E#=$EN ?!S%=#!E# #!E#1=$EN #!E#1 : : #!E#8=$EN #!E#8
It is same as chec3point call e#cept here 'EPT7ID7%) % that is @)ST7%) % will &e 01 &ytes A0 @)ST7%) %. AF 'EPT7ID AF 9I$$ )
InitialiKation with spaces is must @)ST call is written as a first call in your program. Program shoul" "etermine the mo"e of run &y chec3ing the 'EPT7ID fiel" of @)ST7%) %. If it is &lan3. It in"icates a 4ormal run. If it contains the chec3point7i" then it is a restart run. Therefore it must to put (%$, SP%' S at the time of "eclaration. @)ST call will rea" log &ac3war"s+ mo!es all area &ac3 to program wor3 area. %lso repositions the "ata&ase if it is a restart run.
Page 88 of 89
If want to ta3e chec3point after FAA up"ates5 Process Some up"ate acti!ities Increment up"ate counter If up"ate counter H FAA '%$$ <'B$TD$I= ,SI4* D$I7'-EP 5 chec3 for &lan3 status co"e an" SE status co"e SE status co"e is raise" when chec3point is ta3en &efore setting gi!en in % S. That is if in % S the entry is gi!en as IAA+ then % S will not honore" this chec3point. It will automatically ta3e the chec3point after IAA up"ates. 4ow this can &e o!erri""en thru ?'$ &y gi!ing P%' '-P H no parameter. TSO BM'%)' or BM'% S will allow you to "elete all the pre!ious chec3points To terminate program after F chec3points mention following in ?'$5 //%)'S/SI4 DD U P%' '-EPH4 T)M%9T )'EPHF
I 9)D )5 System $og. 'urrent up"ates are maintaine" o!er here. This is use" for 4ormal run .hen 'hec3point is gi!en an" program a&en"s+ I 9)D ) is mo!e" into IMS$O*). IMS uses IMS$O*) to restart. So for restart I 9)D ) &ecomes IMS$O*) an" I 9)D ) will &e use" for the current run. 9or normal run IMS$O*) is not re:uire". Only nee" to specify I 9)D ) This is only for D$/I Jo&s. 9or BMP I 9)D ) is not re:uire". It is "one &y control region (IMS startup an" shut"own)
Page 89 of 89