Академический Документы
Профессиональный Документы
Культура Документы
Objectives
To develop an understanding of the processing available under IMS/DB.
To develop the ability to write programs that access and update IMS database.
Agenda
Introduction IMS DB Terminology IMS DB Coding Getting Started Additional Database Functions Additional Features Advanced Topics AIB Interface Recovery Functions Fast Path Appendices
Introduction To Databases
WHAT IS A DATABASE ? A collection of inter-related data stored together with controlled redundancy to serve one or more applications in an optimal fashion; the data are stored so that they are independent of the program which use the data ; a common and controlled approach is used in adding new data and modifying and retrieving existing data within the data base.
Customer Database Loan System Account DDA System Addr Addr2 Branch
Components Of A DBMS
The components which constitute a DBMS are as follows : Data security facility Restricted access to data Provides for recovery of data Allows multiple concurrent updates Interface Language Retrieves data randomly and sequentially Add and delete data on database Update existing data on database Database tool kit Create the database Backs up/recovers the database Expands/refines the database
Because the data relationships in a hierarchical structure are pre-defined., its major advantage is speed of access. The major disadvantage is the reduced flexibility inherent in a pre-defined structure. The IBM hierarchical product is IMS/DB.
Relational databases are much more flexible and are generally easy to use.However , The increased flexibility can result in slower access times .The IBM relational product is DB2
IMS DB Terminology
Hierarchical Database Terminology Characteristics of an IMS Database Database Definition (DBD) Program Communication Block (PCB) Program Specification Block (PSB) Application Control Block (ACB)
10
11
MVS MVS Access Module Databases Application Program DL/I Module DBDLIB PSBLIB
Control Block
12
Hierarchical Database
SEGMENT : Smallest unit of data that an application can retrieve form a database; contains one or more fields of data ROOT: The entry point to the database ; has no parent segment. PARENT: a segment which has a dependent segment beneath it. CHILD: A segment which is the dependent segment of a parent. TWIN: Multiple occurrence of a dependent segment. TWIN CHAIN :All twins of the same parent KEY: Unique identifier of a segment
13
14
Loan Database
ACCOUNT
15
FEES
ACCOUNT Segment : Account no-key Customer no. Current balance Total Interest Accrued Total Interest Repaid Total Principal Repaid BILLING Segment: Bill Date-key Payment amount Due FEES Segment : Unkeyed Fee Type Amount Fee
16
17
A maximum of 15 levels are allowed; a level can be defined as all segments that have the same number of segments above them. The root segment is always level one. Each immediate child of the root is level two and so on . IMS allows up to 255 different segment types in a single database.
18
DB Positioning
The sequential processing of an IMS Hierarchy is always top-to-bottom , left-to-right. IMS keeps track of its place in the database after every call. Before the first call , the position is prior to the first root segment. The current position if defined as the place just before the segment that DL/I would retrieve next during unrestricted sequential processing. After any read or write ,the position is after the segment just processed. It is important to keep database position in mind when processing a database sequentially. IMS moves only forward, never backward. If the program asks for a segment which has already been passed. IMS will not find the segment.
19
Database Terminology
DBD(Database Definition):Defines the physical structure of database.
PSB(Program Specification Block): Contains all the PCB for a specific program
ACB (Application Control Block): An internal control block containing DBD and PSB information.
20
IMS/Program Communication
.
MVS MVS Access Modules Databases DBD PCB Mask PCB (in PSB) DBDLIB PSBLIB DL/I Modules
Application Program
ACB
21 2009 Wipro Ltd - Confidential
Database Definition(DBD)
The DBD contains the name of the database and defines the actual tree structure.The information needed by application programmer includes: Database name Segment names Key field names, lengths and locations Search field names, lengths and locations The DBD contains the IMS and MVS access methods and defines how many datasets and DD statements are required . The DDNAMES for the database are also found in the DBDs. DBDs are assembled (DBDGEN) and reside in DBDLIBs. LOAN DATABASE DBD
22
Data Dictionary
A Data Dictionary acts as a repository for information about all data in an environment.
Some common data dictionary products are CA10, IBMs Data Dictionary and Data Manager
23
Data Dict.
DBD SRCE
DBD GEN
DBD LIB
24 2009 Wipro Ltd - Confidential
The PCB is the programs view of database .It defines the database to be accessed and the scope of the programs access. The PCB defines the Segment Sensitivity ( i.e. segments available to the program). If a PCB does not contain one or more of the segment in the database, the program is Not Sensitive to these segments. A programs view of the database may be the same or different than the physical view of the database.
25
26
27
IO-PCBs
There is another type of PCB, the IO-PCB (also called a TP-PCB). It is used in online transactions to process messages To/From the terminal and in batch programs to take checkpoint.
Additional TP PCB can be used to send messages to terminals other than the terminal which initiated the program.
28
Note: CMPAT = Y, To guarantee that the program using the PSB will always be
29
PSB-Database Views
Account PSB1 Rate Account PSB2 Billing Fees Account Payment
30 2009 Wipro Ltd - Confidential
PSB3
DATA DICT.
PSB SRCE
PSB GEN
PSB LIB
31 2009 Wipro Ltd - Confidential
DBDLIB
IMS DB Coding
Program ENTRY statement Communication with IMS PCB Masks IO-AREAS SSA Some IMS database access commands GN, GHN GNP
33
34
By making a call to IBM supplied program CBLTDLI / ASMTDLI / PLITDLI (most commonly used method) by Passing a PCB, or Passing an AIB By invoking the EXEC-DLI CICS interface by Passing a PCB, or Passing an AIB
35
Using CBLTDLI
CALL CBLTDLI USING PARM-COUNT FUNCTION PCB IO-AREA SSA. The program passes these parms to IMS describing the action to take palace and what to do with the results. Parm-count : How many parameters follow Function : What type of call to make PCB : Tells IMS what database to process and has return information from IO-AREA SSA : Tells IMS where to place the data(for retrieval) and where to find the : Segment Search Arguments steer IMS to correct segment by details such as segment name and key values
36
PARM-COUNT
The PARM-COUNT, a 4-byte binary field, is seldom used parameter which tells IMS how many parameters follow and is optional for COBOL. 01 PARM-COUNT PIC S9(8) COMP.
37
PCBs
The PCB describes the result of each call made to IMS. There should be a one-to-one relationship between the PCBs defined in the PSB and the PCBs defined in the program. The PCBs are listed on the ENTRY statement and then defined in the LINKAGE SECTION. Each PCB is an 01 level in the linkage section. While the order of the PCBs is critical on the ENTRY statement , the order of the PCBs in the linkage section is of no consequences. The PCB is physically outside the program; it resides in the IMS. The PCB is how IMS communicates with the program. The application program must interrogate the PCB to determine the success or failure of the call.
38
IMS PCB
.
DATA BASE
DBD
PSB PCB
PCB Mask
.
Pos 1-8 9-10 11-12 13-16 17-20 21-28 29-32 33-36 37-xx
Description Database Name Segment Level Status Code Processing Option Reserved For DL/I Segment Name Key Feedback Length No. Of Sensitive Segs. Key Feedback Area PCB Example
40
PCB Information
The status code is most important. It should ALWAYS be checked after EVERY call. The application program can never assume that the call was successful. The segment-level and the segment-name contain the level and the name of the last segment IMS processed. This can be interrogated to determine which segment in a hierarchical path does not exist. The key-feedback are contains the full key of the last segment processed. It can be interrogated if necessary. The remaining information in the PCB is of little value except during de-bugging. REMEMBER: IMS fills in the PCB with information; the application programmer NEVER moves anything to the PCB.
41
IO-Areas
The Io-area passed to IMS is the storage location for the segment to be processed. Io-areas are a two way communication. For retrieval calls, IMS places the segment retrieved in the Io-area. For update calls, the program must place updated segment in the Io-area and IMS will use it to update the database. The length of the Io-area is very important. IMS takes the segment length from the DBD, not form the Io-area; if the Ioarea in the program is too short, IMS will overlay the subsequent storage after Io-area, Its ok if the Io-area is too long; IMS will ignore the extra positions. To update or delete a segment in IMS, the application program must first read and hold the segment . Then the application program can update or delete it.
42
43
Unqualified SSA
.
POS 1-8
DESCRIPTION
Qualified SSA
.
DESCRIPTION SEGMENT NAME LEFT PARANTHESES KEY NAME FROM DBD RELATIONAL OPERATOR VALUE OF KEY FIELD MUST BE LENGTH OF KEY RIGHT PARANTHESES
45
Relational Operators
Relational operators define the equation for the segment access. The valid operators are as follows. EQUAL: = OR = OR EQ GREATER THAN: > OR > OR GT LESS THAN : < OR < OR LT GREATER THAN OR EQUAL TO : >= OR => OR GE LESS THAN OR EQUAL TO : <= OR =< OR LE NOT EQUAL TO : /= OR =/ OR NE
46
PIC X(8) VALUE 'ACCOUNT'. PIC X ALUE '('. PIC X(8) VALUE 'ACCOUNT#'. VALUE 'EQ'. PIC X(6) VALUE '123456'. PIC X ALUE ')'.
NOTE: Field lengths must be exact. IMPORTANT : For better efficiency use Fully qualified calls, and Relational operator of equal.
47
48
IMS Functions
Segments in an IMS database can be Retrieved in one of two ways. Sequential processing: The data base is processed in sequence from some starting point. The order of the retrieval of the segments is determined by their physical order on the database. Random processing: The database is not retrieved in any order. The application program asks for a specific segment identified by some field in the segment (usually the key) In addition to retrieval, an application can Add, Change or Delete segments.
49
Sequential Processing
The segment retrieved is always based on the prior segment retrieved; the search for the next segment starts at the current position.
The segment is retrieved based on several factors: The hierarchy of the database. The qualification coded in the application. The segments which have been defined in the PCB, i.e., segment sensitivity.
50
GN : Get Next - To retrieve the next segment in the database. GNP: Get Next Within Parent - To retrieve the next dependent segment of this parent. GHN: Get Hold Next - To retrieve and hold (for update) the next segment. GHNP: Gete Hold Next Within Parent - To retrieve and hold (for update) the next dependent segment of this parent. An unqualified get next retrieves the next sensitive segment in the hierarchy. A qualified next retrieves the next sensitive segment matching the search criteria. IMS chooses to place a hold based on the processing options in the PCB. Ex GN With CBLTDLI
51
GHN The only change needed to read the record and hold it for update is to change the function from GN to GHN. CALL 'CBLTDLI' USING WS-GHN LOAN-PCB ACCOUNT-AREA ACCOUNT-UNQUAL-SSA. This call would read the next account segment on the database; the segment is held for possible update.
52
After every call, IMS returns a status code in the PCB that describes the success or failure or the call. The status code should be tested after EVERY call to IMS. The application program should test for expected status codes; if an unexpected status code is encountered, the program should abend. Before the application program abends, it should display the PCB, AIB or DIB and a descriptive message.
53
Three types of IMS status codes : Informational : The status code returned by the IMS is neither good nor bad; the application program must determine if the result is good or bad. For example end-of-file status. Program Error : The call itself was not attempted because the information passed to DL/I is invalid. This is always an abend condition and should only be encountered during testing. For example the segment name is misspelled. IO Error : The call was attempted but an IO Error was encountered. An unusual occurrence, should cause an abend.
54
Informational status codes: BLANKS - The call was successful GA - During unqualified sequential processing, IMS crossed to a higher level GB - End of database (file) was reached. GE - No segment was found which matches the criteria specified. GK - During unqualified sequential processing, IMS crossed to a different the same level Program Error Status Codes: AD - The function code is invalid AK - The field name does not match the name in the DBD AJ - The SSA is coded incorrectly I/O error status Codes: AI - Open error; probably a missing DD statement.
of the hierarchy
segment type at
55
Parentage
GNP and GHNP sequentially process the database but limit the segments to dependent segments of the established parent. Parentage is said to be set at the parent segment. The sequential search for segments begins at the current position and stops at the dependent segment of the parent. Parentage must have been set prior to issuing the GNP/GHNP request. Hold function is not needed for EXEC DLI. Parentage can be set in two ways: By retrieving a parent segment: parentage is set at the last segment retrieved. By using command codes.
Ex : GNP WITH CBLTDLI
56
Parentage Contd..
GHNP The only change needed to read the record and hold it for update is to change the function from GNP to GHNP. CALL 'CBLTDLI' USING WS-GHNP LOAN-PCB ADVANCE-AREA ADVANCE-UNQUAL-SSA. This call would read and hold the next advance segment which is a child of the account segment.
57
Scheduling A PSB
When using EXEC DLI command in a CICS transaction, before any database may be accessed, the application must first schedule the PSB. EXEC DLI SCHD PSB (psbname) END-EXEC SYSSERVE, an optional parameter requests DLI to establish the first PCB as the IO-PCB. This is necessary to issue system service requests. Scheduling is only necessary for a CICS transaction. BMPs do not schedule a PSB.
58
Terminating A PSB
The TERM command may used to terminate the PSB in a CICS transaction. The TERM command causes all database updates to be committed. The TERM command is optional - returning to CICS has the same effect as the TERM. The TERM command is useful when the application needs to schedule a different PSB. Before a new PSB may be scheduled, the current PSB must be released. TERM should be avoided : It causes a CICS sync point future backouts will only process to this point It causes additional logging to occur.
Instead, let the CICS RETURN end the PSB whenever possible.
59
PSB Scheduling
A PSB remains scheduled until the transaction returns to CICS, or until a TERM request is made. A PSB remains scheduled across programs: Called via CICS LINK, when the linked program returns to the caller, the PSB is still scheduled Called via CICS XCTL, when the XCTL program receives control, the PSB is still scheduled; the first CICS RETURN command terminates the PSB.
However, the programs will be simpler if all DL/I requests are contained in a single module.
Ex: Putting It All Together (CBLTDLI)
60
Getting Started
61
Creating A Database
Steps to create an IMS database : Design the database Gen the DBD, PSB, ACB Build datasets for the database Load the database with a load PSB Code the program Code the JCL Test the program with BTS Test the program without BTS
62
While building a database, MVS datasets must be defined. IMS physically stores information in each record that enables IMS to process the datasets as a database. This is the second parameter on the ACCESS parameter on the DBD statement DBD NAME = BMALOAN1, ACCESS=(HDAM,VSAM), RMNAME=(DFSHDC40,001,00000135), PASSWD=NO Most IMS databases are defined as VSAM datasets (can also be a flat sequential file i.e. QSAM). The MVS access method determines how the datasets must be created (using DISP=(NEW,CATLG)). IDCAMS or coding X X X
63
The definition of a VSAM dataset is done using the IBM utility, IDCAMS. IDCAMS requires several parameters which it uses to define the VSAM components, or cluster. The definition of these parameters is critical. The IMS DBDGEN provides a sample of the IDCAMS control cards containing the parameters to create a VSAM cluster which will house the database. Sample IDCAMS job to create the IMS database for our loan DBD.
Ex: DELEET/DEFINE JCL
64
The database must be loaded after allocating the dataset. Database can be loaded by: Using a utility program to add and delete a dummy segment; this initializes the database, allowing update programs to add segments without using a load PSB Writing an application program (typically done in conversion situations) Using IMS reload utility to load from an existing database backup.
The first two options require a PSB with the processing option of L for load. The IMS reload utility does not require a load PSB, but assumes that the database already exists (it must have been initially created sometime with option 1 or 2.)
65
IMS utility program DFSDDLT0 is the most commonly used utility program for loading database. It is provided by IBM with IMS product and is therefore available in all IMS environments. The purpose of DFSDDLT0 is to manipulate IMS databases. It allows the application programmer to issue DL/I calls via control statements. Additionally it provides these features: Compares the results of database calls with expected results Builds a dataset containing segment images and PCB information
66
JCL
PRINTOUT
DASD
LOG
67
IMS TM
IMS CTRL
EMH MSGQ MSDB
DLI
DBRC
IFP
MPR BMP
MSQG DEDB
IMS DB
RECON
68
IMS DBCTL
DBRC
BMP
BMP
IMS programs can be run two ways: under IMSs control, as a BMP, or as a stand-alone batch job, known as DLI. BMP jobs have these features: Run in conjunction with an IMS control region, an MVS started task that controls all online and BMP programs Require no DD statements for the databases; the IMS control region contains the knowledge of the databases. Require an ACB gen to process. Require the IMS DBDLIB in the JCL ONLY when GSAM databases are being used Does not require the allocation of a log dataset, as there is one log dataset of all of IMS BMP jobs must run on the machine which is processing the IMS control region. This is controlled by job class. Most installations have specific job classes for BMP jobs.
70
DLI jobs have these features: Run as stand-alone jobs with no communication or knowledge of the online IMS system Require DD statements for all databases Can be run with an ACB, or with the DBD and PSB (IMS will dynamically create the ACB at execution time) Require the DBDLIB or ACBLIB DD statement Require the allocation of a log dataset if recovery is to be performed
71
72
The execution type parameter defines how the program should be processed: BMP, DLI, or DBB. BMP specifies that the program will be run as BMP.
DLI and DBB both specify that the program will be run as DLI, but DBB informs IMS that an ACB gen has been done with DBB, IMS uses the ACB instead of the DBD and PSB.
73
IMS DD Statements
DFSRESLB - Defines the dataset containing the IMS system software. IMSLOGR - Defines the input IMS log dataset for restart. IEFRDER - Defines the dataset in which IMS records log records. IMS - Defines the DBD and PSB libs. OR IMSACB - Defines the ACB lib (for DBB execution). DFSVSAMP - Defines buffer allocations for databases with VSAM access method; must allow for the largest control interval of any database being accessed. In addition, you need all the usual JCL statements for any non-IMS datasets including STEPLIB, SYSUDUMP, and so on.
74
Samples
Sample DLI Execution JCL Sample BMP Execution JCL
75
76
Random Processing
With random processing, the segment is always retrieved directly; database position has no impact on the call. The retrieval moves forward, backward, or stays in the same place. The segment is retrieved based on two factors: When a key is specified, the segment returned matches that key When only the segment name is used, IMS returns the first segment of that type When no qualification is specified, IMS returns the first segment in the database
77
GU(Get Unique) - To retrieve a specific(unique) segment in the database. GHU(Get Hold Unique) - To retrieve a specific segment in the database, and to hold the segment for possible update. Remember that when using EXEC DLI, no hold is necessary. EXAMPLE: GU USING CBLTDLI
78
GHU
The only change needed to read the record and hold it for update is to change the function from GU to GHU. CALL CBLTDLI USING WS-GHU LOAN-PCB ACCOUNT-AREA ACCOUNT-SSA. This call would read and hold for the update the account segment whose key is 560011. Remember that when issuing GU calls, your database position does not matter. IMS will calculate the location of the segment and find it (if it exists!). Example: Putting All Together (CBLTDLI)
79
Adding Segments
Segments are added to an IMS database by using the insert call, ISRT. IMS puts the segment in the proper position in the database, based on the value in the key field of the io-area. When inserting a child, or dependent, segment, the key of the parent may be or may not be provided. If the parent is not qualified, the segment will be inserted at the current database position, as a child of the last parent processed. If the parent is qualified, the segment will be inserted as a child of the specified parent, regardless of the database position. The type of segment to be inserted must always be specified. IMS takes The information from the io-area. IMS will use the information in the io-area to create the new segment on the database and will use the segment length from the DBD. Example: Sample Insert Calls With CBLTDLI
80
Changing Segments
Segments on an IMS database can be changed by using the replace call, REPL. When replacing any segment, the application must have first read and held the segment for update (GHU, GHN, GHNP). No qualification is allowed on a replace. IMS replaces the segment which has been held. IMS will use the information in the io-area to change the existing segment on the database and will use the segment length from the DBD. The key field on a segment can never be changed. To change the key, the program must add a new segment and delete the old one. Example: Sample Replace Calls With CBLTDLI
81
Removing Segments
Segments on an IMS database can be removed by using the delete call, DLET. Before deleting any segment, the target segment must have first read and held for update (GHU, GHN,GHNP). Like the replace, no key is allowed on a delete. IMS deletes the segment which has been held. When a parent segment is deleted, all dependent segments are always deleted automatically even if the application program is not sensitive to the dependent segments in the PCB of the PSB. Example: Sample Delete Calls With CBLTDLI
82
DA An attempt to modify the key field on a replace or delete call DJ An attempt to replace/delete a segment that had not been held II An attempt insert a duplicate
83
IMS supports the use of variable length segments. Variable length segments are specified in the DBD: SEGM NAME=BILLING,PARENT=ACCOUNT,BYTES=(150,100)
Here, the max segment size is 150, the min is 100. When variable length segments are defined, the segment data must begin with a 2 byte binary field that contains the length field. For read functions, IMS returns the length of the segment in the length field. For update function, the application program must set the length field. For native IMS calls, no other change is necessary to process variable length segments.
84
Path calls Retrieving first and last dependent segments Setting parentage Null command codes.
85
Command codes are used to : Expand the scope of database calls or to more precisely define the segments to be accessed. Process a leg (or path) of a database record Retrieve the first or last record in a twin chain Set parentage.
Command codes are coded in either qualified or unqualified SSAs. They can be used with all functions except delete.
86
Note: The * in position 9 separates the segment name from the command code and is required. There can be multiple command codes. A blank is required for termination.
87
XX + 1
RIGHT PARENTHESES
88
A null command code is available which means no command code. It is used as a placeholder in those programs which dynamically change the command code during processing.
It allows the programmer to turn command codes on and off. The null command code is a -.
89
Path Calls
Path calls are used to retrieve or update an entire path of the hierarchy, or a portion of a path. A path call is requested by using the D Command Code.
90
Command Code D
The D command code is used to make a path call. A path call processes down a path of the hierarchy. A path call is used when the program needs to process several segments in the hierarchical path. The program can retrieve, insert and update segments in the path with one call to IMS. The program can selectively update segments in the path using a different command code. For full function database, path call processing requires a special processing option for the data base in the PSB.
91
A retrieval path call, (GU, GHU, GN, or GHN), is used to read some or all segments in a hierarchical path. DL/I places the segments in the io-area, one after the other, left to right. The io-area must be at least as long as the sum of the lengths of the segments to be retrieved. To retrieve a segment in the path, code a D in the command code of the SSA; to skip a segment in the path, code a - in the command code of the SSA. DL/I will always retrieve the lowest level segment in the path; hence, no D command code is required on the lowest level. Path calls are more efficient that coding several calls to retrieve segments in a path. However, care must be taken: if the length of a higher level segment changes, you must change the length of the io-area to accommodate it. Example: Retrieval PATH Call
92
An insert path call, ISRT, is used to insert an entire path of segments, or selected segments in a path, in one database call.
DL/I expects the segment in the io-area to be one after the other, left to right. The segments must be in the order of the path, and each segment must be exactly as long as defined in the DBD. The entire path must be inserted. To insert a path of segments, code a D in the command code of the SSA of the first segment to be inserted. Example: Insert PATH Call
93
A replace path call, REPL, is used to replace an entire path of segments at once. DL/I expects the segments in the io-area to be one after the other, left to right. The segments must be in order of the path, and each segment must be exactly as long as defined in the DBD. The entire path does not have to be replaced.
The command code N is used to indicate segments that are not to be updated. The SSAs for the REPL must be unqualified. DL/I will not update segments whose SSA have the command code N.
94
It is generally more efficient to use path calls; one call to IMS can accomplish what might take several calls. However, there is a trade-off. The application program becomes less data independent. Considering that the program has all the segment io-areas concatenated together in one big io-area, what happens if the length of a segment in the middle of the path changes?
95
96
Setting Parentage
Parentage can be set using the command code P. The P command code can be used with GN, GU, and GNP and can be defined at only one level, parentage will be set at the lowest level. Parentage is set at the segment level indicated by the command code. Without the command code, parentage would be set at the lowest level retrieved. If the level which had the P command code definition was satisfied, parentage is set; if not, no parentage is set, and any subsequent GNP calls will receive a status code of GP, parentage not set. Parentage will remain in effect until another call with a P command code until any GU, GN, GHU, or GHN. Example: Set PARENTAGE
97
The key of a segment may be specified using a C command code instead of an SSA. The C command code specifies the concatenated key as follows: WORKING-STORAGE SECTION. 01 ACCOUNT-SSA. 05 FILLER 05 FILLER 05 CC-ACCOUNT 05 FILLER 05 ACCT-KEY 05 FILLER 01 ACCOUNT-IO-AREA 01 GU
VALUE ACCOUNT. PIC X VALUE *. PIC X VALUE C. PIC X VALUE ( . PIC X(6) VALUE 101205. PIC X VALUE ). PIC X (200). PIC X(4) VALUE GU. PIC X(8)
98
LINKAGE-SECTION 01 01 IO-PCB LOAN-PCB. 05 FILLER 05 STATUS-CODE PROCEDURE DIVISION. ENTRY DLITCBL USING IO-PCB LOAN-PCB. CALL CBLTDLI USING GU LOAN-PCB ACCOUNT-IO-AREA ACCOUNT-SSA. PIC XX. PIC X(10). PIC X.
99
Advanced Topics
Database Position
Secondary Indexes
100
The database position is determined : For successful calls: Before any calls are made, the position is before the first segment in the database. After GU, GN, and GNP, the position is after the segment just retrieved. After ISRT, the position is after the segment just added. For DLET, the position is after the segment just deleted. After REPL, no change to position. After CHKP, the position is back to the beginning of the database. For unsuccessful calls: After GU, GN, GNP, and ISRT, The position is after the last segment which satisfied the call. After DLET, and REPL there is no change to position.
101
This can be accomplished in one of the two ways: Defining multiple PCBs for the same database. IMS maintains its position for each PCB.
Defining a PCB with multi-positioning option. IMS maintains several positions in the one database in different paths. The first option is preferred to the second.
102
Multi-positioning PCB
With a multi-positioning PCB, IMS maintains a separate database position for each hierarchical path in one database record.
Multi-positioning is specified on the PCB in the PSB: PCB TYPE = DB,NAME=BMLOAN1,PROCOPT=A, KEYLEN = 16,POS = M X
103
1990052501 PAYMENT
FEES
CALL
MULTI
SINGLE
123451
An unqualified GN, causes IMS to lose all positions except that of the segment just read.
105
There are several types of IMS databases which can be defined by the DBA. Each type has its own access method. The access method determines the characteristics of the database. Database order the order in which the root segments are stored (Sequenced and non-sequenced). A non-sequenced access method means that if the roots are sequentially retrieved, they will be in no particular order; with sequenced access method, roots are retrieved in ascending sequence. Database structure how database are physically structured. For example, the sequenced access methods have an index database which keeps track of root segments. Database relationship management how the relationships between segments are maintained. For example, some access methods require that the dependent segments be stored physically adjacent to the parents. The access method is defined in the DBD.
106
HDAM (Hierarchical, Direct Access Method) is the most commonly used. It is the most efficient method for random processing. The key of the root is randomized (converted to some number by an algorithm) and the random number is used to determine the address of the record in the database. Its features are: The database are unordered. Sequential processing at the root level will result in no predictable sequence of data; the records will be retrieved in the order in which their keys randomized. The database structure consists of one or more dataset groups. Each dataset group is an MVS dataset which contains all occurrences of one or more segment types. There must be at least one dataset group; the DBAs choose the number of dataset groups as part of their performance tuning and the dataset groups are defined in the DBD.
107
The relationships of the segments are maintained via pointers. IMS maintains pointers from one segment to the next in the hierarchy. As a result, IMS does not need to store dependent segments with their parents. DASD space is immediately reusable; the space occupied by segments which are deleted is available for immediate use. An HDAM database is usually implemented as a VSAM ESDS.
108
HIDAM (Hierarchical, Indexed, Direct Access Method) combines the random processing of HDAM with an index to order the database. It is the most efficient method for sequential processing which requires the database to be ordered. IMS maintains an index which contains the key of the root and its address. Its features are: The database are ordered. Sequential processing at the root level will result in the database records being retrieved in ascending sequence based on the key value. Two DBDs are required; one DBD is for the data area and one is for the index area. The index itself can be processed as database. The database structure consists of two MVS datasets; the database (or prime area) and the index dataset. As in HDAM, the relationships of the the segments are maintained via pointers.
109
DASD space is immediately reusable; the space occupied by segments which are deleted is available for immediate use.
A HIDAM database is usually implemented as a VASM KSDS for the index database and an ESDS for the prime database.
110
HISAM (Hierarchical, Indexed, Sequential Access Method) is another ordered database access method. It is most commonly used for low insert activity. Its features are: The databases are ordered. Sequential processing at the root level will result in the database records being retrieved in ascending sequence based on the key value. The database segments are stored sequentially. A parent and all its children will be sorted in physical sequence. An overflow area is maintained for the addition of segments, and pointers are used when a dependent segment is stored in the overflow area. DASD space is not immediately reusable; a re-organization utility must be run against the database before the space occupied by deleted segments can be used. A HISAM database is implemented as a VSAM KSDS for the prime area and an ESDS for overflow.
111
GSAM is a special IMS access method that allows IMS applications to process ordinary MVS sequential files as an IMS database. These applications can run as batch or BMPs. GSAM is treated like a sequential, nonhierarchical database. It has no segments, no keys, and no parentage. The program does not have to define the file, open or close it, and can process it using the standard IMS CALL interface. In addition, IMS automatically repositions the file for the program during restart processing. There are two MVS access methods that support the GSAM database: BSAM for DASD, tape, or unit record datasets. Record format can be blocked or unblocked fixed-length, variablelength or undefined. VSAM ESDS for DASD datasets. Record format can be blocked or unblocked fixed-length or variable-length.
112
IMS automatically OPENs the GSAM database when the program issues the first call to it and CLOSEs it when the program ends. It may be useful to explicitly OPEN and CLSE the GSAM database. The program should explicitly CLSE GSAM after loading it if, in the same step, the program reads it as input: CALL CBLTDLI USING CLSE GSAM-PCB.
113
IF GSAM is an output database and the program doesnt ISRT any records, the database is not created. Subsequently attempts to read the database will result in an error. To avoid this, the program should explicitly OPEN the database: CALL CBLTDLI USING OPEN GSAM-PCB. The only function codes available for GSAM are GN for reading and ISRT for adding segments: CALL CBLTDLI USING WS-GN GSAM-PCB SEGMENT-AREA. CALL CBLTDLI USING WS-ISRT GSAM-PCB SEGMENT-AREA.
114
An example of a GSAM DBD: DBD NAME=BMAGSAM,ACCESS=(GSAM,BSAM) DATASET DD1=BMAGS001,SIZE=00000,RECFM=FB DBDGEN FINISH END An example of PSB referencing the above GSAM database: PCB TYPE=DB,NAME=BMALOAN1. . PCB TYPE=GSAM,NAME=BMAGSAM,PROCCOPT=G PSSBGEN LANG=COBOL,PSBNAME=BMA001,COMPAT=YES
115
The Data Entry Data Base is a high-capacity direct access organization. The DEDB features are: The database records are unordered; unique keys are required. A randomizing module is used to locate the root of the database record, using its unique key. Segment relationships are maintained by pointers. The database consists of one or more areas; each area is a separate VSAM ESDS; each area can hold a maximum of 4 gigabytes; up to 240 areas can be defined. Initialization, backup and recovery are performed at the area level.
DEDBs support full hierarchical structures up to 15 levels deep and up to 127 segment types.
116
One of the key features of the DEDB is its ability to be partitioned into areas. Each area is a separate physical dataset and can be manipulated as if it were a separate database. Records are placed into areas of the DEDB based on the randomization of the key. Unlike dataset groups, which contain all occurrences of specific segment types, area contain entire database records. Areas must be preformatted using a DEDB utility program. The database can then be loaded by an application program doing insert calls. A feature called dataset replication provides high data availability. Multiple copies of an area, (up to seven) can be maintained simultaneously by Fast Path. If I/O error occurs in one area, no other area is affected. Backup and recovery can be performed at the area level; the DEDB utilities are run at the area level.
117
ACCOUNT
BILLING
ADVANCE
FEES
ACCOUNT
BILLING
ADVANCE
PAYMENT
INTEREST RATE
BILLING
ADVANCE
PAYMENT
FEES
118
ORDER
DATABASE STRUCTURE UNORDERED ONE ESDS/ DS GROUP ORDERED INDEX-KSDS PRIMEESDS/GP ORDERED KSDS/ESDS ORDER WRITTEN RANDOM MVS QSAM ONE ESDS/AREA
2009 Wipro Ltd - Confidential
Secondary Indexes
Databases often require multiple types of processing. For example, one online program may need to process a database in sequence, while all others need random access. A facility called secondary indexing exists which can be used to provide multiple access routes to one database.
Some of the functions that secondary indexes can be used for are as follows: Retrieval of database records in an alternate sequence Retrieval of a segment based on a condition in one of its dependent segments Ordering of a non-ordered database.
120
The segment to be retrieved via the secondary index is called the target segment. The segment used to build the secondary index is called the Source segment. The target is retrieved based upon data in the source segment. The secondary index itself is actually a database. The segments in the index database are called pointer segments.
ACCOUNT
TARGET SEGMENT
BILLING
ADVANCE
PAYMENT
RATE
Any segment within a hierarchy can be specified as the target of a secondary index. When the source segment is not a root, the hierarchy is in effect, inverted. A secondary index is not implemented as its own database and must be a VSAM dataset. The source and target segment can be the same segment.
122
ACCOUNT
TARGET SEGMENT SOURCE SEGMENT
BILLING
ADVANCE
PAYMENT
RATE
The Secondary index pointer segment is built from these fields on the source segment: Customer Number, Account Number. By accessing via the secondary the accounts will now be in order by customer number and account number. FEES index, SOURCE SEGMENT
123
124
125
Steps: Define the secondary index DBD; use the LCHILD statement to establish the relationship between the secondary index and the target segment. In the original database DBD under the SEGM statement for the target segment: Use the LCHILD statement to establish the relationship between the target segment and the secondary index. Use XDFLD statement to define which fields from the source segment will be used to build the secondary index (pointer segments).
126
In the PSB, it must be defined that the secondary index will be used. This is the PROCSEQ, or processing sequence parameter and must be set to the secondary index DBD name. In the application program itself, the SSA must use the XDFLD name instead of the key-field name. PCB TYPE = DB, NAME=BPGLOAN2,PROCOPT=G, X KEYLEN=21,PROCSEQ=BPLOAN1 SENSEG NAME=ACCOUNT,PARENT= 0 SENSEG NAME=BILLING,PARENT=ACCOUNT SENSEG NAME=FEES,PARENT=BILLING SENSEG NAME=ADVANCE,PARENT=ACCOUNT SENSEG NAME=PAYMENT,PARENT=ACCOUNT SENSEG NAME=RATE,PARENT=ACCOUNT PCB TYPE=DB,NAME=BMAGSAM,PRODUCT=G PSBGEN LANG=ASSEM,PSBNAME=BPG002,CMPT=YES
127
The secondary index database can itself be processed. It is possible to have IMS replicate information from the source segment into the pointer segment.this is known as duplicate data. By using duplicate data, it may be possible to eliminate the prime database altogether in some simple queries.
The application program sees the entire data portion of the pointer segment. This includes the search, subsequence and duplicate data fields.
The index database should never be updated directly. All updates should be done to the prime database and IMS will maintain the index. Ex: Loan Secondary Index DBD
128
LANG=ASSEM,PSBNAME=BPG22,CMPAT=YES
129
When a secondary index has a target segment that is not the root, the processing sequence changes: The target segment becomes the root. All depends on the target stay on the right of the hierarchy. All parents of the target become dependents of the target and are placed on the left in the hierarchy. The target segment and its parents cannot be inserted or deleted in this view of the database. This new view of the database is called a secondary data structure and the database processing sequence is called the secondary processing sequence. To process using the secondary data structure, a PCB is used that defines the new structure. From the application programs perspective, accessing the secondary data structure is exactly the same as if it were the physical structure.
130
ACCOUNT ACCOUNT
BILLING
ADVANCE INTEREST ADVANCE BILLING PAYMENT TARGET SEGMENT INTEREST RATE SOURCE SEGMENT PAYMENT TARGET SEGMENT RATE
SOURCE SEGMENT
FEES
ADVANCE SECONDARY
BILLING FEES
131
BILLING
ADVANCE
PAYMENT
RATE
IMS provides the capability to suppress the generation of secondary index segments (if required). A value can be defined on the XDFLD statement that IMS will use when updating the secondary index. If the contents of the secondary index field are equal to the null parameter, no pointer segment will be created in the secondary index for this source segment. Another option to suppress the generation of secondary index pointers is to write a user exit and request its execution by coding EXTRN=userexit on the XDFLD segment. IMS will then pass control to the user exit before updating the secondary index. Ex: Loan Database DBD with Sparse Index Ex. Secondary Index Using CBLTDLI
132
To retrieve a segment based on multiple criteria, the selection criteria are combined in the SSA. Criteria can be combined using two Boolean operators:
133
SECONDARY RETRIEVE SEGMENTS IN SECONDARY INDEX SEQUENCE RETRIEVE TARGET BASED ON VALUE IN SECONDARY INDEX RETRIEVE SEGMENT BASED ON KEY VALUE PROCESS SECONDARY INDEX AS STANDALONE DATABASE PROCESS USING SECONDARY STRUCTURE
INDEX GN
PROCESSING PTIONS UNQUALIFIED (PROCESQ IN PSB) XDFLD (PROCSEQ IN PSB) SEQUENCE FIELD PCB = SECONDARY INDEX PCB = SECONDARY INDEX
GU
GU GN/GU
GN/GU
134
Use of the AIB allows the application program to reference PCBs by name. The name of a database PCB is defined in the PSB: Example PCBNAME = LOANS assigns the name of LOANS to this PCB. The application can then reference the PCB by name, instead of by position in the PSB. LIST = YES requests that the PCB be included in the parameter list to the application. The IO-PCB may be referenced via the name IOPCB. These PCBS are known as named PCBs.
135 2009 Wipro Ltd - Confidential
136
To use the AIB interface in existing applications: Modify the PSB to define names for the PCBs Define an AIB in the application program working storage For xxxTDLI Replace call to xxxTDLI with call to DFSAIBLI Replace PCB in call parameter list with AIB as defined in the applications working storage For EXEC DLI Replace USING PCB(number) with AIB(aibname) Evaluate the return and reasons codes in the AIB to determine the success or failure of the call.
137
When LIST = YES is specified for a PCB, IMS updates the PCB with the results of the call, as well as the AIB. In this scenario, the PCB status code may be evaluated to determine the success or failure of the call.
NOTE : The return code for end-of database (status-code = GB), is 2304.
138
AIB Definition
Field
Definition
Updated by?
Appl
Description
AIB-IDENTIFIER
AIB eye-catcher
AIB-LENGTH
Appl
Appl Appl
Field
Definition
Updated by?
Appl
Description
REQUESTED-OUTPUT-AREALENGTH
For data retrievals (GU, etc.), the length of the requested data
ACTUAL-OUTPUT-AREA-LENGTH
PIC S9(8) COMP. PIC X(12). PIC S9(8) COMP. PIC S9(8) COMP.
IMS
Filler AIB-RETURN-CODE
AIB-REASON-CODE
IMS
140
Field
Definition
Updated by?
Description
Filler AIB-RESOURCE-ADDR
PIC X(4). PIC S9(8) IMS. Address of the PCB named in the call.
Filler
PIC X(48).
141
INQY Function
The INQY function is used to obtain information regarding the PCBs, status of the databases, the run-time environment or the address of a PCB. The type of information requested is identified via the sub function: Null alternate PCB DBQUERY ENVIRON FIND PROGRAM Information such as the status of the IO-PCB or a named Availability status of the database Information on the run-time environment Address of a specific PCB The name of the program being executed.
For all AIB calls, a return code of zero reflects that the call was successful. Example: INQY With DFSAIBLI
142
Recovery Functions
Checkpoint
Restart
143
IMS Checkpoint
Enq Table
144
App. Program
Buffers
Cleared
DL / I
Log File Enq Table
Before/After Images
Database
145
All database updates as reversible, or uncommitted, until the application notifies IMS that all updates are permanent or committed. This is known as a synchronization point; IMS synchronizes all database updates for the program. The application commits by issuing a checkpoint call. At the time of the checkpoint, three actions take place:
IMS commits all the database updates and releases the records for the checkpoint IMS sends a message to the operator containing the ID of the checkpoint IMS writes a log record containing checkpoint information, before and after the checkpoint id.
Until the application issues the checkpoint, all segments which have been updated are enqueued meaning any other programs attempting to access them will be forced to wait. If no checkpoints are taken, the commit will occur when the program completes.
146
Checkpoint Frequency
The frequency of checkpoint is determined based on one of several factors: A specified time interval A specified number of database records were processed A specified number of database updates were done
Option second is the most common one. DEDB databases have another option for determining the check point frequency, the unit of the work(UOW) boundary.
147
UOW Boundaries
When a BMP is processing a DEDB, it is possible to have IMS notify the application when a UOW boundary is crossed. Defining the crossing of a boundary as the checkpoint interval triggers the application program to issue a checkpoint. This approach has two major advantages: Database position is not lost; (In full-function database processing, issuing a all database position) Database position is not lost when an FR status code (NBA exhausted) is checkpoint causes the loss of returned.
148
To receive notification of the crossing of a UOW boundary, the PSB must have a processing option of P. (PROCOPT = P for full function means Path call.) With a processing option of P defined on the PSB, Fast Path returns a status code of GC whenever a BMP issues a get call to a root segment which would cause a UOW boundary to be crossed. The segment is NOT returned. The application can choose to: Ignore the GC status and re-issue the same call to retrieve the segment. Issue a checkpoint and re-issue the same call to retrieve the segment.
149
Checkpoint Information
While issuing a checkpoint call, the following information must be provided to IMS: The ID of the checkpoint, an 8 character field which uniquely identifies the checkpoint. It is application program generated and usually consists of a combination of the program name and a counter, eg., BMA05001. Up to seven areas of working storage in the application program, that the program needs recovered in the event of a restart. IMS will save these storage areas on the log file when the check point is taken. The length of the largest IMS database io-area used by the program.
When a checkpoint is issued, all database position is lost. IMS sets the position to the start of the database. The application program re-establish position after a checkpoint call. This is done by issuing a GU to the last segment accessed before the checkpoint.
150
ABEND
Abend, Rollback
Appl. Program DL / I
Cleared
Buffers
Database Unchanged
151
IMS Restart
Restart
Appl. Program DL / I
Checkpoint information
Log File
IMS Repositions
152
The IMS restart call allows a program which has not completed to be started again, beginning at the last checkpoint. This is especially useful in long-running programs.
When a restart is issued the following actions take place: IMS places the checkpoint ID in a field designated by the application program. IMS repositions all databases to the last check point. IMS refreshes the application programs checkpoint areas.
153
Checkpoint Call
CALL CBLTDLI USING WS-CHKP IO-PCB IO-AREA-LEN(length of largest db io-area) IO-AREA ( 8 digit checkpoint id) WS-LENGTH-n (length of ws area) WS-AREA-n (ws area to be saved) Up to seven areas of working storage can be checkpointed. Note: In IMS V5, the IO-AREA-LEN is no longer needed and is a placeholder to maintain compatibility. Any storage address may be specified.
154
Restart Call
CALL CBLTDLI USING WS-XRST IO-PCB IO-AREA-LEN(length of largest db io-area) XRST-AREA (12 digit checkpoint area, initialized to spaces) WS-LENGTH-n (length of ws area) WS-AREA-n (ws area to be saved) The WS length and areas must match the checkpoint WS length and areas. Note: In IMS V5, the IO-AREA-LEN is no longer needed.
155
It is quite easy! Follow a few SIMPLE rules: The first call to IMS must be an XRST call. The next call to IMS should be a CHKP call. Check the XSRT-AREA; if it is spaces, no restart has occurred. Continue on. If it is not spaces, a restart has occurred. You are now positioned where you were at the time the last checkpoint was taken.
Thats it!
156
Design Considerations
Two types of IMS programs: Database-driven programs The programs which sequentially read an IMS database; it is said the database drives the processing. These programs may or may not create MVS output files which are defined as GSAM databases. File-driven programs The programs which use an input file to randomly process an IMS databases. A GSAM database must drive a restartable program.
It is customary to take an initial checkpoint at the beginning of the program, before processing any databases. Also take care to ensure that the restart will work after the initial checkpoint as well as after subsequent checkpoints.
157
Database-Driven Programs
Database driven program sequentially process an IMS database. After every checkpoint call, position in the database is lost (unless the checkpoint was after a GC status code was received; the program must reposition itself to continue processing. Repositioning is accomplished in the steps: Save the key of the last record processed before the checkpoint. Issue the checkpoint call. Use the saved key to issue a GU to the same record. Continue processing with a GN. The restart logic is as follows: IMS repositions the databases as of the last checkpoint call. Continue processing by doing a GN.
For the initial checkpoint: Initialize the key save-area to spaces; in the reposition routine. If the key save-area is spaces, bypass the GU call.
158
File-Driven Programs
File-driven programs sequentially process an input file, or GSAM database. The GSAM is used to randomly process an IMS database. When a GSAM file is used, position is never lost. Therefore, there is no need to reposition.
Restart logic: Issue the restart call. If the restart-id is not spaces, continue processing with a GN.
159
Testing Checkpoint Restart First, the program should be tested thoroughly as it would normally execute. The program must be forced to abend. Restart the program. The results of the restart should be compared to the result of the test with no restart. Make sure that no records were dropped, that none were duplicated, and that all counts and totals are accurate. How to abend a program? Modify data one of the segments to contain invalid packed data, causing an OC7. Set the time on the step to one second, causing a time out. If all else fails, add a statement that will divide some number by zero, causing an OCB.
160
161
Thats the only requirement for programs run as BMP. One of the major differences between BMP and DLI, is that in DLI, the application programmer is responsible for the IMS log file; the log file is used by IMS when a program is executing. IMS uses it to record the before and after images of segments, program checkpoint areas and checkpoint id information. That is the IEFRDER dataset. All BMPS (and online transactions) share the log file associated with the control region. DLI programs must create their own log file. This is sequential dataset which must be kept to use as input in the event of a restart.
162
163
Test the program with no abends. Save all output files. Make a copy of the database or unload it. (Test 1). Retest the program forcing an abend. Then restart the program. Make a copy of the database or unload it. (Test 2)
Compare results: Compare all output files from test 1 to test 2. Compare all reports, totals and counts. Compare the databases.
164
PSB name must be added to the IMS system definition. Any batch file used by the program must be converted to GSAM. Do GSAM PSB changes. Identify all program variables that are required to retain values in the event of a restart. Code the checkpoint/restart WORKING-STORAGE variables. Make changes to the LINKAGE SECTION for the GSAM files, and for the IO-PCB if necessary. Modify the ENTRY or PROCEDURE DIVISION USING statement to include IO-PCB/GSAM PCBs. Make Procedure Division changes for CKPT/XRST calls. Modify the JCL to run as a BMP.
165
This does not mean that the program doesnt need checkpoints. * If a BMP does not updates, it need to take checkpoints. IMS resources must be released or the BMP runs the risk of crashing the entire IMS system.
166
DEDBs require the definition of special buffers: Normal Buffer Allocation (NBA). Overflow Buffer Allocation (OBA). The fastpath buffers are used to hold updated DEDB Cls prior to commit processing. For BMPs, the NBA and OBA are defined in the execution statement of the JCL. The NBA should be large enough to hold all database updates prior to syncpoint. Fastpath uses the overflow buffers when no more NBA buffers are available; the overflow buffers should be used only on an exception basis. If overflow buffers are continually being allocated, the normal buffer allocation should be increased. For a BMP: //EXEC PGM=DFSRRCOOO, //PARM=(BMP,PGM,PSB,,,,,,,NBA,OBA)
167
FW : When the normal buffers are exhausted for a BMP, Fast Path returns a status code of FW.
The FW status code is merely a warning. The application program may choose to : Issue a checkpoint to release buffers. Ignore the warning.
When FW status codes are being issued frequently. The application should be modified to issue checkpoints more often. The NBA buffer allocation should be increased.
168
FR : When the normal buffer allocation is exhausted, Fast Path uses overflow buffers. When there are simply not enough buffers to continue processing, IMS returns a status code of FR and rolls out all changes since the last checkpoint or syncpoint. At this point, the program has two options: Terminate and restart with more buffers. Issue checkpoints more frequently.
The FR status code has an additional impact: because of the rollback of the changes to the last checkpoint or syncpoint, all database position will be lost except against DEDBs with PROCOPT=P or H, in the latter case, position is reestablished after the last commit process.
169
FD : The FD status is returned when two Fast Path processes are in contention. Fast Path chooses one to process and returns a status of FD and rolls out all changes since the last checkpoint. At this point, the program has two options: Abend. Continue processing (a retry), and hope that the program in contention has completed processing.
The long term solution is to evaluate why the two programs are in a deadly embrace situation and redesign one of the programs to avoid it.
170
FS : The FS status code is returned when the DEDB area is out of space. This status can be returned on a database ISRT or GU messages call.
The FS is returned to a BMP on the ISRT call for a root, direct dependent or sequential dependent segment.
The only response is to abend and expand the area; note, the independent overflow part can be expanded with the database online but the area must be offline.
171
FH : The FH status code is returned when the DEDB area is unavailable. This status code can be returned on a database access or checkpoint call.
When an FH status code is returned as a result of a CKKP call, IMS rolls out all updates to the last syncpoint.
The only response is to abend and bring up the database or area or have alternative coding.
172
Some uses for DEDB area selection are: Limiting batch processes, (BMP), to specific areas to facilitate parallel processing. Limiting online processes, (MPP, IFP), to specific areas for performance improvement.
The facility to select area for processing is known as range control. Range control is accomplished through the use of control statements. To implement range control: The PSB must identify the areas to be selected. The range control statements must be defined. A DD statement must be added to the JCL(//DFSCTL).
173
PSB Requirements
The PSB must assign a name or label to the areas to be selected. This is done on the PCB statement in one of two ways: PCB=BPGLOAN1,PROCOPT=A,KEYLEN=16,PCBNAME=PCB1 X SENSEG ... Or PCB1 PCB=BPGLOAN1,PROCOPT=A,KEYLEN=16 X SENSEG ... DEDB DBD DBD NAME=BPGLOAN1,ACCESS=DEDB, X RMNAME=RMODULE A1 AREA DD1=BPGAREA1,ROOT=(5,2),UOW=(15,4) A2 AREA DD1=BPGAREA2,ROOT=(5,2),UOW=(15,4) A3 AREA DD1=BPGAREA3,ROOT=(5,2),UOW=(15,4)
174
Range control statements are placed in the execution JCL to specify the areas to be processed. SETR DB=BPGLOAN1,PCB=PCB1,AREA=(A1) KEYWORD DEFINITIONS: DB=dbdname Identifies the database to which the selection applies. PCB=pcbname The PCB name to which the selection applies; this name must AREA=(areaname1,areaname2,) Identifies the area(s) to be selected; range areaname3. Example : //DFSCTL DD * SETR DB=BPGLOAN1,PCB=PCB1,AREA=(A1-A3) /*
175