Appendix B. Coding examples 241
B.1.2 Index segment
This method compares some field in the secondary index fields themselves to find a match. If
they match, then an index is not created.
Example: B-2 Index segment method
1 2 3 4 5 6 7
12345678901234567890123456789012345678901234567890123456789012345678901
|
TITLE 'SYSAA1ER INDEX MAINTENANCE ROUTINE'
**********************************************************************
* A P P L I C A T I O N N A M E *
* *
* THIS MODULE IS CALLED BY DL/I FROM THE SYSDAAP1 DATABASE. *
* IF THE WORK_ACTIVITY_CODE IS EITHER 'A' OR 'T' CREATE AN INDEX *
* ENTRY IN INDEX SYSDAAS1. *
* *
* REGISTER ASSIGNMENTS AT ENTRY TO SYSAA1ER: *
* R1 - PARTITION SPECIFICATION TABLE (PST) ADDRESS. *
* R2 - ADDRESS OF (PROPOSED OR EXISTING) INDEX SEGMENT. *
* R3 - ADDRESS OF INDEX MAINTENANCE ROUTINE PARMS SEGMENT. *
* R4 - ADDRESS OF INDEX SOURCE SEGMENT. *
* R13 - SAVE AREA ADDRESS. *
* R14 - RETURN TO IMS ADDRESS. *
* R15 - ENTRY POINT ADDRESS OF THE EXIT ROUTINE. *
* *
* REGISTER ASSIGNMENTS AT EXIT FROM SYSAA1ER: *
* R0 THROUGH R13 ARE RESTORED. *
* R14 - RETURN TO IMS ADDRESS. *
* R15 - 0 TO NOT SUPPRESS THE INDEX ENTRY. *
* - 4 TO SUPPRESS THE INDEX ENTRY. *
* *
**********************************************************************
* *
*LINKOPT: AMODE=31,RMODE=ANY,RENT,REUS *
* *
**********************************************************************
*
SYSAA1ER START
*
**********************************************************************
* REGISTER EQUATES *
**********************************************************************
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
242 IMS Performance and Tuning Guide
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
*
**********************************************************************
* SET UP THE ENVIRONMENT. *
**********************************************************************
*
INITIAL DS 0H
*
STM R14,R12,12(R13) SAVE REGISTERS 14 THRU 12
LR R12,R15 LOAD R12 WITH ENTRY ADDRESS
USING SYSAA1ER,R12 USE R12 AS BASE ADDR OF EXIT ROUTINE
USING SECINDEX,R2 USE R2 AS BASE ADDR OF INDEX SEGMENT
USING SECSOURX,R4 USE R4 AS BASE ADDR OF SOURCE SEGMENT
LA R15,4 LOAD 4 INTO R15 TO SUPPRESS INDEX
*
**********************************************************************
* CHECK TO SEE IF WE WANT TO SUPPRESS THE INDEX ENTRY. *
**********************************************************************
*
CHKL1 DS 0H
* IF WORK_ACTIVITY_CODE IS AN "A"
CLC SYSEAA1A,ATYP THEN WRITE INDEX
BE CREATESX ELSE
* CHECK SOME MORE
* IF WORK_ACTIVITY_CODE IS A "T"
CLC SYSEAA1A,TTYP THEN WRITE INDEX
BNE WRAPUP ELSE
* DO NOT WRITE INDEX
*
**********************************************************************
* CREATE INDEX ENTRY. *
**********************************************************************
*
CREATESX DS 0H
*
SR R15,R15 CREATE SPARSE INDEX (4 - 4 = 0)
*
**********************************************************************
* DO NOT CREATE INDEX ENTRY. *
**********************************************************************
*
WRAPUP DS 0H
*
ST R15,16(,R13) STORE R15 IN SAVE REGISTER R15
LM R14,R12,12(R13) RESTORE REGISTERS FOR RETURN
SPM R14 SET PROGRAM MASK
BR R14 BRANCH TO CALLING PROGRAM
EJECT
*
Appendix B. Coding examples 243
**********************************************************************
* PROGRAM INFORMATION AND THE LIKE. *
**********************************************************************
*
PGMINFO DS 0H
*
DC CL8'SYSAA1ER' PROGRAM NAME
DC CL9' &SYSDATE' DATE ASSEMBLED
DC CL9' &SYSTIME' TIME ASSEMBLED
*
**********************************************************************
* DEFINE WHAT WE ARE LOOKING FOR. *
**********************************************************************
*
ATYP DC CL01'A' THIS IS A "A" RECORD
TTYP DC CL01'T' THIS IS A "T" RECORD
EJECT
*
**********************************************************************
* DEFINE WHAT THE SECONDARY INDEX SEGMENT LOOKS LIKE. *
**********************************************************************
*
SECINDEX DSECT SECONDARY INDEX SEGMENT
SYSSAAS1 DS 0CL19 ACCOUNT ACTIVITY INDEX SEGMENT
SYSEAA11 DS CL008 FILL UP TO FIELD WE WANT
SYSEAA1A DS CL002 WORK_ACTIVITY_CODE
SYSEAA12 DS CL009 FILL UP TO THE END
*
**********************************************************************
* DEFINE WHAT THE SECONDARY INDEX SOURCE SEGMENT LOOKS LIKE. *
**********************************************************************
*
SECSOURX DSECT SECONDARY INDEX SOURCE SEGMENT
SYSSAA00 DS 0CL196 ACCOUNT ACTIVITY SEGMENT
SYSEAAF1 DS CL019 FILL UP TO FIELD WE WANT
SYSEAADE DS CL001 ACTIVITY_CODE
SYSEAAF2 DS CL176 FILL UP TO THE END
*
**********************************************************************
* EXIT *
**********************************************************************
*
*
END
244 IMS Performance and Tuning Guide

Get IMS Performance and Tuning Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.