Title: Bind to Finish
1Bind to Finish
UKIUA Roadshow April 2004
- Steve Roberts Acebyte Ltd
- www.acebyteltd.demon.co.uk
2Abstract
- This session provides an overview of the
processes - involved in processing a run unit from a bind
- through to a finish. It examines the components
used - by the application and the DBMS when processing
- requests for data, looking at the breakdown of a
- Bind Run Unit, Bind Record and subsequent DML
- processing through to a finish.
3Content
- Application Components
- DBMS Components
- Access
- Binds
- DML Data Movement
- Finish
4Content
5Application - Components
- Subschema Components
- Subschema name
- Record, Set Area Names
- Record Definitions
- Subschema Control
- DML
- IDMS Interface Modules
6Subschema Components
01 SUBSCHEMA-SSNAME PIC X(8) VALUE
CUSTSS01 01 SUBSCHEMA-RECNAMES. 03
SR1054 PIC X(16) VALUE CUSTOMER. 03
SR1055 PIC X(16) VALUE ACCOUNT. 01 SUBSCHEMA-S
ETNAMES. 03 CUST-ACCT PIC X(16) VALUE
CUST-ACCT. 01 SUBSCHEMA-AREANAMES. 03
CUST-AREA PIC X(16) VALUE CUST-AREA. 03
ACCT-AREA PIC X(16) VALUE ACCT-AREA.
7Record Definitions
01 CUSTOMER. 03 CUST-ID PIC X(16). . . 01 ACC
OUNT. 03 ACCT-ID PIC 9(16). . .
8Subschema Control
01 SUBSCHEMA-CTRL. 03 PROGRAM-NAME PIC
X(8) VALUE SPACES. 03 ERROR-STATUS PIC
X(4) VALUE 1400. 03 DBKEY PIC S9(8) USAGE
COMP SYNC. 03 RECORD-NAME PIC X(16) VALUE
SPACES. 03 AREA-NAME PIC X(16) VALUE
SPACES. 03 ERROR-SET PIC X(16) VALUE
SPACES. 03 ERROR-RECORD PIC X(16) VALUE
SPACES. 03 ERROR-AREA PIC X(16) VALUE
SPACES. 03 IDBMSCOM-AREA PIC X(100) VALUE
LOW-VALUE. 03 IDBMSCOM REDEFINES
IDBMSCOM-AREA PIC X OCCURS 100. 03 DIRECT-DBK
EY PIC S9(8) USAGE COMP SYNC. 03 DML-SEQUENCE PIC
S9(8) USAGE COMP SYNC.
9DML
- BINDS
- Run Unit
- Records
- Data Manipulation
- Find/Get/Obtain
- Store/Modify/Erase
- Connect/Disconnect
- Recovery Control
- Commit/Finish/Rollback
10IDMS Interface Modules
- IDMSL Pre 12.0 IDMS (Pre 12.0)
- IDMSINTB IDMSB102
- IDMS
- IDMSNCLI
- CICS Interface Modules
- IDMSCINT
- IDMSINTC
- IDMSINTL
11IDMS IDML
- 12.0 and above IDMS module calls IDMSNCLI (Native
Client) - IDML and pre 12.0 IDMS modules call IDMSINTB
- INTB tries to load IDMSB102
- If found INTB processes the request
- If not found INTB calls IDMSNCLI to process
request - Processing is similar in CICS using INTC INTL
12IDMS IDML
- IDML Pre 12.0 IDMS
- When using the IDML or pre 12.0 IDMS batch
interface, - a copy of the applications SSC is stored in an
MVS - CSA paket at each request. On the CV side the
contents - are copied to an expanded version of SSC used by
CV - IDMS
- When using the now standard IDMS batch
interface - SSC is not copied into the paket. The interface
(NCLI) - stores specific data from SSC into a parameter
block - (CPS) into the paket. On the CV side the request
is rebuilt - from these parameters and SSC updated.
13Expanded DML
- IDMS Pre-compiler expands DML
- Expanded DML has standard format
- Expands to call to IDMS module
- Passes Parameter List to IDMS module
- 1st Parameter is always address of SSC
- 2nd Parameter is an address within IDBMSCOM
- Nth Parameters dependent on function
- IDMS module stores parameters in SSC
14Expanded DML - Examples
OBTAIN FIRST CUSTOMER WITHIN CUST-AREA. MOVE
0005 TO DML-SEQUENCE CALL IDMS USING
SUBSCHEMA-CTRL IDBMSCOM(19)
SR1054 CUST-AREA IDBMSCOM(43).
OBTAIN NEXT ACCOUNT WITHIN CUST-ACCT. MOVE
0006 TO DML-SEQUENCE CALL IDMS USING
SUBSCHEMA-CTRL IDBMSCOM(10)
SR1055 CUST-ACCT IDBMSCOM(43).
15Content
16DBMS - Components
- Subschema Control (Expanded Version)
- IDMSNSRV / IDMSDBMS / IDMSDBIO
- Subschema Load Module
- Run Unit (TBK/VB50 VIB)
- DMCL / DBNAME Table
- DB Buffers
- JNL Buffers
17DBMS Components
- IDMSNSRV
- Takes the request passed and passes the
parameters to IDMSDBMS using the VB50 - On completion of a request NSRV updates the SSC
block with status information from the VB50 - NSRV works with the expanded SSC
18Content
19Access - Local
- Local Access
- Refers to the fact that the application code
issuing the DML is in the same address space as
the DBMS itself, this includes - - Local Mode Batch
- DC Tasks
- UCF Tasks
- UCF access is local because the application runs
in the CV address space. However, UCF is really
remote access as it uses the same ESE/ERE/PAKET
mechanism (described later) to pass 3270
Datastreams (terminal data) NOT records
20Local Mode Batch DC/UCF Tasks
- Application and DBMS are in the same address
space - Application SSC and DBMS SSC are in the same
address space - Bind address is address of record in application
W-Storage - Record data is read and written to and from the
DB buffers to application W-Storage
21Access - Local
IDMS
IDMS
VB50 (Run Unit)
22Access - Remote
- Remote Access
- Refers to the fact that the application code
issuing the DML is in a different address space
to the DBMS, this includes - - CV Mode Batch
- CICS
- UCF
- As indicated before UCF in remote access terms is
used to run a local access task. The remote
access route is used to pass screen data and NOT
record data
23CV Mode Batch CICS
- Application and DBMS are in separate A/S
- Application SSC is in Application A/S
- DBMS SSC in CV A/S
- CSA Paket used to pass requests between A/Ss
- SSC or Equivalent passed via Paket
- Record Data Passed via Paket
- Record Bind Address
- Bind address stored in Bind Address Table in
Paket - All DBMS Records have bind Address set to
address of record buffer in Paket
24Access - Remote
Batch Address Space
CV Address Space
Batch ERUS
CICS ERUS
Application W-Stor DML
IDMS
IDMS
IDMS
IDMS
IDMS
CICS Address Space
IDMSDBMS
IDMSDBIO
DMCL
Subschema(s)
CINT
VB50 (Run Unit)
VB50 (Run Unit)
DB Buffers
25IDMS IDML
- IDMSNCLI
- Determines function from application SSC
- Builds request block
- Passes it via Paket
- Calls IDMSCONN to process SYSIDMS
- CV builds DBMS SSC from request block
- IDMSINTB
- Passes SSC as is in Paket
- CV copies passed SSC to DBMSs SSC
26CV Access
- At startup CV allocates in MVS CSA
- 1 ESE (External Services Element)
- n EREs (External Request Elements)
- Stores ESE address in IDMS SVC table
- Writes SVC Number and CV number to SYSCTL file
- This allows Batch and CICS to access CV
27Content
28Binds
- Bind Run Unit
- Establishes communication with DBMS and creates
the run unit - Allocates TBK VB50 to represent run unit
- Resolves the logical subschema load module with
the physical database - Subschema name must be present
- DBName is optional
29Binds
- The bind run unit causes the DBMS to resolve the
logical subschema with the physical DMCL using
the DBNAME table - At this point in the run unit the DBMS does not
known which areas will be used - It therefore has to resolve all areas it finds in
the subschema
30Binds
- Bind Record
- Establishes addressability for each record the
application may use - Bind address stored in VB50 record control block
- For Local Access bind address will be address of
the record in applications w-storage - For Remote Access bind address will be the
address of the paket record buffer
31CV Access Bind Run Unit
- When a Bind Run Unit is issued from a Batch job
it will attempt to open the SYSCTL file - If found it will attempt to communicate with CV
- If not found will load DBMS modules and run in
local mode - CICS Tasks issuing Bind Run Unit will either open
a SYSCTL or have the CV information linked into
the IDMSINTC module
32CV Access Bind Run Unit
- Gets SVC and CV from SYSCTL
- Issues SVC call to SVC to signon to CV
- SVC code locates the ESE and allocates an
available ERE and Paket - Posts ESEECB
- Application waits on ECB in its own address space
(LREECB)
33CV Access Bind Run Unit
- CV will allocate a task to represent the external
run unit - Allocate SSC
- Locate (or load) the subschema module
- Allocate TBX/VB50 control blocks to represent the
run unit - A BGIN record is built.
- If sysgen nojournal retrieval is set the BGIN is
not written to the journal until the run unit
actually performs an update.
34CV Access Bind Run Unit
- Issues SVC to indicate request complete
- CV Task waits on EREECB
- SVC will post LREECB to indicate request
completed - Interface (IDMSINTB or IDMSNCLI) copies or
updates applications SSC from the Paket - Passes control back to applications code
35CV Access
App A/S
Working Storage 01 CUSTOMER . 01 ACCOUNT . . SSC
MVS CSA
SYSCTL
Paket
SCV 211 CV 56
SSC / CPS BAT Buffer
36BIND Record
- DBMS needs to know where to read and write record
content. - Bind record passes the address of the record in
applications working storage - Local Batch and DC Mode Task
- Actual record address is stored in VSR51
- CV Batch CICS
- Actual record address is stored in Bind Address
Table in the paket - All record VSR51s hold the same paket record
buffer address
37Bind Address
- IDMSDBMS itself does not care where the bind
address is. IDMSDBMS simply moves the data to or
from the DB page to or from the record bind
address stored in the VB50 VSR51 control block. - For local access the data is read/written
directly to the applications working storage - For remote access
- DBMS reads/write data to/from the paket buffer
- the interface modules on the application side
move the data to or from the paket buffer to or
from the application working storage using the
bind address stored in the paket Bind Address
Table
38Bind Address
- When IDMSDBMS stores the bind address in the
VSR51 it also calculates the bind address of each
key in the record (i.e. Calckey, sortkey,
indexkey) and stores it in another VB50 control
block VCR55 - This allows IDMSDBMS to address key fields within
the record
39SUPABIND
- For remote access, all the VB50 record control
blocks (VSR51) will contain the same bind address
the address of the paket buffer - Therefore, a remote bind record request does not
actually do anything on the CV side, it only
stores the records address in the paket BAT - On the first functional call (non Bind Record),
DBMS checks the BAT. Those records for which a
bind has been issued it will bind all those
records to the paket record buffer address
40Content
41DML Data Movement
- Once the run unit has been established each DML
is passed through from the application to DBMS to
process - The request on the CV side is stored in the Run
Unit control block VB50 - IDMSDBMS interprets the request in the VB50 and
processes the request calling IDMSDBIO, Lock
management and Journal Management as and when
required
42DML Data Movement
- Local Access
- The request is passed through to the VB50 for
IDMSDBMS to process - If record data needs to be read or written to or
from the application, IDMSDBMS uses the records
bind address, which will be in the actual
applications W-storage. - IDMSDBMS doesnt care where the bind address
actually is, it simply uses the address it finds
in it VB50 record control block
43Data Movement
- Remote Access Application Side
- The request is passed into the paket (SSC or CPS
depending on interface used) - The record data from application w-storage is
stored into the paket record buffer - Issues SVC call to post EREECB
- Application A/S waits on ECB pointed to by the
ERE (usually refered to as LREECB)
44Data Movement
- Remote Access CV side
- The task established at bind run unit time is
waiting on EREECB. As we have just seen that ECB
has just been posted, so the task is eligible to
run - The task will update the CV side copy of SSC from
the paket SSC or CPS and re-build the parameter
list into the VB50 for IDMSDBMS to process
45Data Movement
- Remote Access CV Side
- IDMSDBMS works in same way as it would for local
access - It determines the request from the VB50
parameters - If it needs to read or write record data it uses
the bind address from the VSR51, it just so
happens that the address in this case is in the
paket, again IDMSDBMS doesnt care where the bind
address is
46Data Movement
- Remote Access CV Side
- When the request is complete, the CV interface
modules will update the paket SSC or CPS from the
CV copy of SSC - It will issue an SVC call to post the ECB
pointed to by the ERE (LREECB) to indicate
request is complete - CV Task waits on EREECB
47Data movement
- Remote Access Application Side
- The application was waiting on LREECB which has
been posted - The application interface modules either copy
paket SSC to application SSC or update
application SSC from the paket CPS - Copies record data from paket record buffer to
application w-storage using records bind address
in the paket BAT - Control is then passed back to the application
code itself
48Data Movement
App A/S
MVS CSA
CV A/S
Working Storage 01 CUSTOMER . 01 ACCOUNT . .
Tasks TCE TCE
ESE ERE ERE ERE ERE
VB50 VSR51 (CUSTOMER) Paket Buffer Addr VSR51
(ACCOUNT) Paket Buffer Addr
Database
Paket
BAT CUSTOMER ADDR ACCOUNT ADDR SSC . . BUFFER
DB Buffer Page Page Page
49Data Retrieval
- Obtain Calc Customer
- IDMSDBMS
- Determines the function from VB50
- 1st Parm Address of SSC
- 2nd Parm Address of offset within SSC
- Sets major code 03 in error status
- 3rd Parm for Obtain Calc
- address of field which holds the record name
- i.e. address points to the literal CUSTOMER
50Data Retrieval
- Obtain Calc Customer
- IDMSDBMS
- Using the Record Name
- Locates Record in Subschema
- Area Name Records page range
- Record ID
- Record length
- Prefix Length
- Address of Calc Key
51Data Retrieval
- Obtain Calc Customer
- IDMSDBMS
- Reads the calckey
- Calls IDMSCALC passing
- Records page range
- Calckey value
- IDMSCALC passes back the target page number
52Data Retrieval
- Obtain Calc Customer
- IDMSDBMS
- Calls DBIO for the Target Page
- Walks Calc Chain looking for match
- Record ID
- Calckey
- If not found
- Sets 26 minor code in error status
- Passes control back to caller
53Data Retrieval
- Obtain Calc Customer
- If record is found IDMSDBMS
- Moves the data portion from the database page to
the records bind address - Updates currency
- Sets 0000 error status
- Passes control back to caller
54Data Retrieval
- Obtain Calc Customer
- If the record is fragmented or compressed then
IDMSDBMS first constructs the record in the VB50
record buffer - It then moves the record from the VB50 record
buffer to the bind address
55Data Update
- Store Customer
- IDMSDBMS
- Determines the function from VB50
- 1st Parm Address of SSC
- 2nd Parm Address of offset within SSC
- Sets major code 12 in error status
- 3rd Parm for Store
- address of field which holds the record name
- i.e. address points to the literal CUSTOMER
56Data Update
- Store Customer
- IDMSDBMS
- Using the Record Name
- Locates Record in Subschema
- Storage Mode
- Area Name Records page range
- Record ID
- Record length
- Prefix Length
- Address of Calc Key
57Data Update
- Store Customer
- IDMSDBMS
- Reads the calckey
- Calls IDMSCALC passing
- Records page range
- Calckey value
- IDMSCALC passes back the target page number
58Data Update
- Store Customer
- IDMSDBMS
- Calls DBIO for the Target Page
- Locates Space for the record
- Sets minor code 11 if cannot find space
- Writes null BFOR image to journal buffer
- Moves the data from the bind address to the page
- Writes AFTR image to journal buffer
59Data Update
- Store Customer
- IDMSDBMS
- Builds Prefix Portion
- Using set currencies determines set position for
each automatic set (including Calc set) - Connects record into set
- Any sets which have manual connection are set to
high values - Any set in which it is the owner, it stores the
dbkey of the record itself (empty set) - Writes prefix BFOR / AFTR image for each record
affected by set connections
60Data Update
- Store Customer
- IDMSDBMS
- Updates currencies
- Sets error-status to 0000
- Passes control back to caller
- The update itself is not necessarily written at
this stage to the physical file, the update is
only to the DB buffer
61Update
- When an update DML is processed one or more DB
buffers will be updated - Each DB buffer is represented by a control block
called a BME - Each BME has
- Address of its Buffer
- Page number
- Must Write Switch
- VB50 List
- Journal Sequence Number
62Update
- When a page is updated in a buffer
- Must write switch (MWS) is set on
- VB50 address of run unit is stored
- Up to three run units can update a page in a
buffer
63Update
- If the updated buffer is selected to read another
page - MWS indicates the page currently in the buffer
must be written first - DBIO is called to write the page out
- DBIO first checks that journal images are written
- Then issues an I/O to write the page
- This is known as a forced write
- When complete the MWS is set off and VB50 list is
cleared - New page is read into the buffer
64Update
- The VB50 also contains a bit map which represents
all of the DB buffers in the DMCL - When the run unit updates a buffer the bit
representing the buffer is set on - The MWS, VB50 address and this buffer bit map are
important to what happens at commit or finish
processing
65Content
66Finish
- Finish processing is basically a commit process
followed by a termination process which deletes
the run unit control blocks and terminates
communication with the DBMS - Commit processing ensures that any updates made
by the run unit are physically written to the
database and ensures that those updates are
journalled correctly
67Finish
- Commit Processing has to
- Find the buffers updated by the Run Unit
- Checks if those buffers contain updates for the
run unit - Call DBIO to write the updated page
- DBIO will ensure any journal images for the
updates have been written - DBIO will issues an I/O to write the page
- Write an ENDJ (or COMT for a commit command) to
the journal to signal completion of a recovery
unit
68Finish
- Find Buffers Updated by the Run Unit
- VB50 has buffer bit map
- Each bit set on represents a buffer updated by
the run unit - Checks BME for each buffer updated
69Finish
- Check if buffer contains updates for the run unit
- Update has already been written if either
- MWS is off
- MWS is on BME does not hold run units VB50
address - Update has NOT been written if
- MWS is on BME has rununits VB50 address
- When this is the case DBIO is called to write the
page
70Finish
- Calls DBIO to write the page
- DBIO ensures any journal images for the updates
to the page have been written - The BME also holds the last journal sequence
number of the last update performed on the page - Each Journal Buffer Element (JBE) holds the
highest journal sequence number for journal
images in its buffer - DBIO checks for any JBEs with a highest sequence
number lower or equal to the sequence number held
in the buffers BME. - Any JBE found, its journal buffer must be written
before the DB page is written
71Finish
- Calls DBIO to write the page
- Issues I/O to write the page to the physical file
- Continues to check next buffer until all buffers
updated by the run unit have been checked and
written if needed
72Finish
- Writes to the journal to signal completion of
recovery unit - For a FINISH writes an ENDJ to journal buffer
- For a COMMIT writes a COMT to journal buffer
- Issue I/O to write journal buffer
- When I/O completes control passed by to
application
73Content
74Questions
?