IMS DB Application Programming - IBM Manual
IMS DB Application Programming - IBM Manual
SC27-1286-00
IMS Version 8
SC27-1286-00
Note Before using this information and the product it supports, be sure to read the general information under Notices on page xi.
First Edition (October 2002) This edition applies to Version 8 of IMS (product number 5655-C56) and to all subsequent releases and modifications until otherwise indicated in new editions. Copyright International Business Machines Corporation 1974, 2002. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Notices . . . . . . Programming Interface Trademarks . . . . Product Names. . . . . . . . Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi . xiii . xiii . xiv
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Summary of Contents . . . . . . . . . . . . . . . . . . . . . . xv Prerequisite Knowledge . . . . . . . . . . . . . . . . . . . . . . xv Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Syntax Diagrams . . . . . . . . . . . . . . . . . . . . . . . . xvi How to Send Your Comments . . . . . . . . . . . . . . . . . . . xviii Change Indicators . . . . . . . . . . . . . . . . . . . . . . . xviii Summary of Changes . . . . . . . . . . . . . . . . . . . . . xix Changes to This Book for IMS Version 8 . . . . . . . . . . . . . . . xix Library Changes for IMS Version 8 . . . . . . . . . . . . . . . . . xix
| |
Chapter 3. Defining Application Program Elements Formatting DL/I Calls for Language Interfaces . . . Application Programming for Assembler Language . . Application Programming for C Language . . . . . Application Programming for COBOL . . . . . . . Application Programming for Pascal . . . . . . . Application Programming for PL/I . . . . . . . . Relationship of Calls to PCBs . . . . . . . . . Specifying the I/O PCB Mask . . . . . . . . . Specifying the DB PCB Mask . . . . . . . . . Specifying the AIB Mask . . . . . . . . . . . Specifying the AIB Mask for ODBA Applications . . .
Copyright IBM Corp. 1974, 2002
iii
Specifying the UIB (CICS Online Programs Only) . Specifying the I/O Areas . . . . . . . . . . Segment Search Arguments . . . . . . . . GSAM Data Areas . . . . . . . . . . . . The AIBTDLI Interface. . . . . . . . . . . Specifying the Language Specific Entry Point . . PCB Lists . . . . . . . . . . . . . . . The AERTLDI interface . . . . . . . . . . Language Environment . . . . . . . . . . Special DL/I Situations. . . . . . . . . . . Chapter 4. Writing DL/I CIMS Call . . . . . CLSE Call . . . . . DEQ Call . . . . . DLET Call . . . . . FLD Call . . . . . . GN/GHN Call . . . . GNP/GHNP Call . . . GU/GHU Call . . . . ISRT Call . . . . . OPEN Call . . . . . POS Call . . . . . REPL Call . . . . . Calls for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . 96 . . 99 . . 100 . . 104 . . 105 . . 106 . . 109 . . 110 . . 111 . . 112 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 115 117 117 119 120 122 127 129 132 135 136 140 143 144 144 145 147 148 150 151 153 157 163 165 166 167 168 168 170 171 174 176 177 177
Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 5. Writing DL/I Calls for System APSB Call . . . . . . . . . . . . CHKP (Basic) Call . . . . . . . . . CHKP (Symbolic) Call . . . . . . . . DPSB Call . . . . . . . . . . . . GMSG Call . . . . . . . . . . . . GSCD Call . . . . . . . . . . . . ICMD Call . . . . . . . . . . . . INIT Call . . . . . . . . . . . . . INQY Call . . . . . . . . . . . . LOG Call . . . . . . . . . . . . PCB Call (CICS Online Programs Only) . RCMD Call . . . . . . . . . . . . ROLB Call . . . . . . . . . . . . ROLL Call . . . . . . . . . . . . ROLS Call . . . . . . . . . . . . SETS/SETU Call. . . . . . . . . . SNAP Call . . . . . . . . . . . . STAT Call . . . . . . . . . . . . SYNC Call . . . . . . . . . . . . TERM Call (CICS Online Programs Only) XRST Call . . . . . . . . . . . .
Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 6. Monitoring Your Position in the Database . . . . . . . . . 181 Understanding Current Position in the Database . . . . . . . . . . . . 181 Current Position after Unsuccessful Calls . . . . . . . . . . . . . . . 186 Chapter 7. Multiple Qualification Statements . . Overview of Multiple Qualification Statements . . . Example using Multiple Qualification Statements . . Multiple Qualification Statements for HDAM, PHDAM, . . . or . . . . . . . . . DEDB . . . . . . . . . . . . . . . . . . . . . . . . 191 191 192 193
iv
Chapter 8. Multiple Processing . . . . Multiple Positioning . . . . . . . . . Advantages of Using Multiple Positioning . Using Multiple DB PCBs . . . . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
Chapter 9. Secondary Indexing and Logical Relationships . . . . . . . 203 How Secondary Indexing Affects Your Program . . . . . . . . . . . . 203 Processing Segments in Logical Relationships . . . . . . . . . . . . . 206 Chapter 10. Processing GSAM Databases Accessing GSAM Databases . . . . . . GSAM Record Formats . . . . . . . . GSAM I/O Areas . . . . . . . . . . . GSAM Status Codes . . . . . . . . . Symbolic CHKP and XRST with GSAM . . GSAM Coding Considerations . . . . . . Origin of GSAM Data Set Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 211 214 215 215 216 216 217 221 221 222 223 229 230 238 239
Chapter 11. Processing Fast Path Databases Fast Path Database Calls . . . . . . . . MSDBs and DEDBs: Overview . . . . . . Processing MSDBs and DEDBs . . . . . . Restrictions on Using Calls for MSDBs . . . Processing DEDBs (IMS, CICS with DBCTL) . Restrictions on Using Calls for DEDBs. . . . Fast Path Coding Considerations. . . . . .
Chapter 12. Recovering Databases and Maintaining Database Integrity 241 Issuing Checkpoints . . . . . . . . . . . . . . . . . . . . . . 241 Restarting Your Program and Checking for Position . . . . . . . . . . . 241 Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) 242 Reserving Segments for the Exclusive Use of Your Program. . . . . . . . 248
Chapter 14. Sample Execs Using REXXTDLI . . . . SAY Exec: For Expression Evaluation . . . . . . . . PCBINFO Exec: Display PCBs Available in Current PSB . PART Execs: Database Access Example . . . . . . . DOCMD: IMS Commands Front End . . . . . . . . IVPREXX: MPP/IFP Front End for General Exec Execution
Contents
Chapter 16. Command Codes Reference . . . . . . . . . . . . . . 293 Chapter 17. CICS-DL/I User Interface Block Return Codes . . . . . . . 295 Not-Open Conditions . . . . . . . . . . . . . . . . . . . . . . 296 Invalid Request Conditions . . . . . . . . . . . . . . . . . . . . 296
Appendix C. The Database Resource Adapter (DRA) Thread Concepts . . . . . . . . . . . . . . Sync Points . . . . . . . . . . . . . . . . The DRA Startup Table . . . . . . . . . . . . Enabling the DRA for a CCTL . . . . . . . . . . Enabling the DRA for the ODBA Interface . . . . . Processing CCTL DRA Requests . . . . . . . . . Processing ODBA Calls . . . . . . . . . . . . CCTL-Initiated DRA Function Requests . . . . . . PAPL Mapping Format . . . . . . . . . . . . Terminating the DRA . . . . . . . . . . . . . Designing the CCTL Recovery Process . . . . . . CCTL PerformanceMonitoring DRA Thread TCBs . .
vi
Figures
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. Application View of DB/DC Environment . . . . . . . . . . . . . . . . . . . . . . 10 Application View of DBCTL Environment . . . . . . . . . . . . . . . . . . . . . . 11 DL/I Program Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 The Structure of a Call-Level CICS Online Program . . . . . . . . . . . . . . . . . . 14 Normal Relationship between Programs, PSBs, PCBs, DBDs, and Databases . . . . . . . . 19 Relationship between Programs and Multiple PCBs (Concurrent Processing). . . . . . . . . 19 Medical Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 PATIENT Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 ILLNESS Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 TREATMNT Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 BILLING Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 PAYMENT Segment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 HOUSHOLD Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Teller Segment in Fixed Related MSDB . . . . . . . . . . . . . . . . . . . . . . 22 Branch Summary Segment in Dynamic Related MSDB . . . . . . . . . . . . . . . . . 22 Account Segment in Nonrelated MSDB . . . . . . . . . . . . . . . . . . . . . . 23 Qualified SSA Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Segment with a Noncontiguous Sequence Field . . . . . . . . . . . . . . . . . . . 25 D Command Code Example. . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Unqualified SSA with Command Code . . . . . . . . . . . . . . . . . . . . . . . 27 Qualified SSA with Command Code . . . . . . . . . . . . . . . . . . . . . . . . 27 U Command Code Example. . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Processing for the Passbook Example . . . . . . . . . . . . . . . . . . . . . . . 39 Moving the Subset Pointer to the Next Segment after Your Current Position . . . . . . . . . 40 Retrieving the First Segment in a Chain of Segments . . . . . . . . . . . . . . . . . 41 Unconditionally Setting the Subset Pointer to Your Current Position . . . . . . . . . . . . 42 Conditionally Setting the Subset Pointer to Your Current Position . . . . . . . . . . . . . 43 Sample Assembler Language Program . . . . . . . . . . . . . . . . . . . . . . . 48 Sample Call-Level Assembler Language Program (CICS Online) . . . . . . . . . . . . . 50 Sample C Language Program . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Sample COBOL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Sample Call-Level OS/V COBOL program (CICS Online) . . . . . . . . . . . . . . . . 60 Sample Pascal Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Sample PL/I Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Sample Call-Level PL/I Program (CICS Online). . . . . . . . . . . . . . . . . . . . 68 Defining the UIB, PCB Address List, and the PCB Mask for VS COBOL II . . . . . . . . . . 97 Defining the UIB, PCB Address List, and the PCB Mask for OS/VS COBOL . . . . . . . . . 98 The COBOL DLIUIB Copy Book . . . . . . . . . . . . . . . . . . . . . . . . . 98 Defining the UIB, PCB Address List, and the PCB Mask for PL/I . . . . . . . . . . . . . 99 Defining the UIB, PCB Address List, and the PCB Mask for Assembler Language . . . . . . . 99 Hierarchic Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Log Record Formats for COBOL, C, Assembler, Pascal and PL/I Programs . . . . . . . . . 164 I/O Area for SNAP Operation Parameters . . . . . . . . . . . . . . . . . . . . . 172 Current Position Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Hierarchy after Deleting a Segment . . . . . . . . . . . . . . . . . . . . . . . 184 Hierarchy after Deleting a Segment and Dependents . . . . . . . . . . . . . . . . . 184 Hierarchy after Adding New Segments and Dependents . . . . . . . . . . . . . . . . 186 DL/I Positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Multiple Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Multiple Positioning Hierarchy. . . . . . . . . . . . . . . . . . . . . . . . . . 196 Single and Multiple Positioning Hierarchy . . . . . . . . . . . . . . . . . . . . . 197 Dependent AND Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Independent AND Example . . . . . . . . . . . . . . . . . . . . . . . . . . 205
vii
54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90.
Patient and Item Hierarchies . . . . . . . . . . . . . . . . . Concatenated Segment . . . . . . . . . . . . . . . . . . . //IMS DD Statement Example. . . . . . . . . . . . . . . . . FSA Structure . . . . . . . . . . . . . . . . . . . . . . Sample PCB Specifying View=MSDB . . . . . . . . . . . . . . Processing a Long Chain of Segment Occurrences with Subset Pointers . Some Examples of Setting Subset Pointers . . . . . . . . . . . Some More Examples of Setting Subset Pointers . . . . . . . . . How Subset Pointers Divide a Chain into Subsets . . . . . . . . . Unqualified SSA with Subset Pointer Command Code . . . . . . . . Qualified SSA with Subset Pointer Command Code . . . . . . . . SETS and ROLS Calls Working Together . . . . . . . . . . . . JCL Code Used to Run the IVPREXX Sample Exec . . . . . . . . IMS Adapter for REXX Logical Overview Diagram . . . . . . . . . Exec To Do Calculations . . . . . . . . . . . . . . . . . . PDF EDIT Session on the SAY Exec . . . . . . . . . . . . . . Example Output from the SAY Exec . . . . . . . . . . . . . . Example Output of PCBINFO Exec on a PSB without Database PCBs. . Example Output of PCBINFO Exec on a PSB with a Database PCB. . . PCBINFO Exec Listing . . . . . . . . . . . . . . . . . . . Example Output of PARTNUM Exec . . . . . . . . . . . . . . Example Output of PARTNAME Exec . . . . . . . . . . . . . . PARTNUM Exec: Show Set of Parts Near a Specified Number . . . . PARTNAME Exec: Show Parts with Similar Names . . . . . . . . . Output from = > DOCMD . . . . . . . . . . . . . . . . . . Output from = > DOCMD /DIS NODE ALL;? . . . . . . . . . . . Output from = > DOCMD /DIS NODE ALL;CID>0 . . . . . . . . . Output from = > DOCMD /DIS NODE ALL;TYPE=SLU2 . . . . . . . Output from = > DOCMD /DIS TRAN ALL;ENQCT>0 & RECTYPE=T02 . Output from = > DOCMD /DIS LTERM ALL;ENQCT>0 . . . . . . . DOCMD Exec: Process an IMS Command . . . . . . . . . . . . Example JCL Code for DD Statement Definition . . . . . . . . . . Example JCL Code for DFSDDLT0 in a BMP . . . . . . . . . . . ODBA Two-Phase Sync-Point Processing . . . . . . . . . . . . Copying the DRA Startup/Router Routine into a CCTL Load Library. . . DRA Component Structure with a CCTL . . . . . . . . . . . . . DRA Component Structure with the ODBA Interface . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
207 208 220 224 228 230 231 231 232 233 233 246 256 257 275 276 276 276 276 277 278 278 279 280 281 281 281 282 282 282 283 341 341 355 357 358 359
viii
Tables
1. 2. 3. 4. 5. 6. 7. 8. 9. | 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. | 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. Command Codes for DL/I Calls . . . . . . . . . . . . . . . . Call Relationship to PCBs . . . . . . . . . . . . . . . . . . I/O PCB Mask . . . . . . . . . . . . . . . . . . . . . . . DB PCB Mask . . . . . . . . . . . . . . . . . . . . . . . AIB Fields . . . . . . . . . . . . . . . . . . . . . . . . AIB Fields for ODBA Applications Use . . . . . . . . . . . . . . Relational Operators . . . . . . . . . . . . . . . . . . . . I/O PCB and Alternate PCB Information Summary . . . . . . . . . Using LANG= Option in a Language Environment for PL/I Compatibility . Unqualified POS Call: Keywords and Map of the I/O Area Returned . . GMSG Support by Application Region Type . . . . . . . . . . . ICMD Support by Application Region Type . . . . . . . . . . . . INIT DBQUERY: Examples for ASMTDLI, CBLTDLI, CTDLI, and PASTDLI INIT DBQUERY: I/O Area Example for PLITDLI . . . . . . . . . . INIT I/O Area Examples for ASMTDLI, CBLTDLI, CTDLI, and PASTDLI . INIT I/O Area Examples for PLITDLI . . . . . . . . . . . . . . INIT I/O Area Examples for ASMTDLI, CBLTDLI, CTDLI, and PASTDLI . INIT I/O Area Examples for PLITDLI . . . . . . . . . . . . . . INQY ENVIRON Data Output . . . . . . . . . . . . . . . . . Subfunction, PCB, and I/O Area Combinations for the INQY Call . . . . RCMD Support by Application Region Type . . . . . . . . . . . SNAP Operation Parameters . . . . . . . . . . . . . . . . . Results of Single and Multiple Positioning with DL/I Calls . . . . . . GSAM DB PCB Mask . . . . . . . . . . . . . . . . . . . Summary of GSAM Calls . . . . . . . . . . . . . . . . . . Summary of Fast Path Database Calls . . . . . . . . . . . . . Subset Pointer Command Codes and Calls . . . . . . . . . . . Qualified POS Call: Keywords and Map of I/O Area Returned . . . . . Comparison of ROLB, ROLL, and ROLS . . . . . . . . . . . . IMS Adapter for REXX Parameter Types and Definitions . . . . . . . REXXIMS Extended Commands. . . . . . . . . . . . . . . . Summary of DB Calls . . . . . . . . . . . . . . . . . . . Summary of System Service Calls . . . . . . . . . . . . . . . Summary of Command Codes . . . . . . . . . . . . . . . . Command Codes and Calls . . . . . . . . . . . . . . . . . Return Codes in UIBFCTR . . . . . . . . . . . . . . . . . . Return Codes in UIBDLTR if UIBFCTR='0C' (NOTOPEN) . . . . . . Return Codes in UIBDLTR if UIBFCTR='08' (INVREQ) . . . . . . . Summary of DFSDDLT0 Control Statements . . . . . . . . . . . ABEND Statement . . . . . . . . . . . . . . . . . . . . . CALL FUNCTION Statement . . . . . . . . . . . . . . . . . CALL DATA Statement . . . . . . . . . . . . . . . . . . . OPTION DATA Statement . . . . . . . . . . . . . . . . . . FEEDBACK DATA Statement . . . . . . . . . . . . . . . . . DL/I Call Functions . . . . . . . . . . . . . . . . . . . . CALL FUNCTION Statement (Column-Specific SSAs) . . . . . . . . CALL FUNCTION Statement with DFSDDLT0 Call Functions . . . . . COMMENT Statement . . . . . . . . . . . . . . . . . . . COMPARE DATA Statement . . . . . . . . . . . . . . . . . COMPARE AIB Statement . . . . . . . . . . . . . . . . . . COMPARE PCB Statement . . . . . . . . . . . . . . . . . IGNORE Statement . . . . . . . . . . . . . . . . . . . . OPTION Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 . 85 . 86 . 90 . 92 . 94 . 100 . 110 . 112 . 137 . 150 . 152 . 154 . 154 . 155 . 155 . 156 . 156 . 160 . 162 . 167 . 172 . 197 . 212 . 217 . 221 . 222 . 235 . 243 . 260 . 262 . 289 . 290 . 293 . 293 . 295 . 295 . 295 . 301 . 303 . 304 . 307 . 309 . 310 . 310 . 322 . 323 . 325 . 326 . 328 . 329 . 332 . 333
ix
PUNCH CTL Statement . . . . . . . . . STATUS Statement . . . . . . . . . . WTO Statement. . . . . . . . . . . . WTOR Statement . . . . . . . . . . . Example of Events in a Multithreading System CCTL Single-Phase Sync-Point Processing. . CCTL Two-Phase Sync-Point Processing . . Information Provided for the Schedule Process: Information Provided at UOR Termination: . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
Notices
This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the users responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to: IBM World Trade Asia Corporation Licensing 2-31 Roppongi 3-chome, Minato-ku Tokyo 106, Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs
Copyright IBM Corp. 1974, 2002
xi
and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: IBM Corporation J46A/G4 555 Bailey Avenue San Jose, CA 95141-1003 U.S.A. Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The licensed program described in this information and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement, or any equivalent agreement between us. Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-level systems and there is no guarantee that these measurements will be the same on generally available systems. Furthermore, some measurement may have been estimated through extrapolation. Actual results may vary. Users of this document should verify the applicable data for their specific environment. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. All statements regarding IBMs future direction or intent are subject to change or withdrawal without notice, and represent goals and objectives only. This information is for planning purposes only. The information herein is subject to change before the products described become available. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: This information contains sample application programs in source language, which illustrates programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing, or distributing application programs conforming to IBMs application programming interfaces.
xii
Each copy or any portion of these sample programs or any derivative work, must include a copyright notice as follows: (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. Copyright IBM Corp. _enter the year or years_. All rights reserved. If you are viewing this information softcopy, the photographs and color illustrations may not appear.
Trademarks
The following terms are trademarks of the IBM Corporation in the United States or other countries or both:
BookManager C/370 C/MVS CICS CICS/ESA DB2 IMS/ESA IBM Language Environment IMS Library Reader MVS MVS/ESA OS/390 RACF SAA z/OS
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States, other countries or both.
Notices
xiii
Other company, product, and service names may be trademarks or service marks of others.
Product Names
In v v v this book, the following licensed programs have shortened names: C/C++ for MVS/ESA is referred to as either C/MVS or C++/MVS. COBOL for MVS & VM is referred to as COBOL. DB2 for MVS/ESA is referred to as DB2.
v Language Environment for MVS & VM is referred to as Language Environment. v PL/I for MVS & VM is referred to as PL/I.
xiv
Preface
This book is a guide to application programming in an IMS Database Manager (IMS DB) environment. It covers basic information on coding DL/I calls for DB programs. The book is designed to provide guidance for application programmers who use the IMS DB environment to create and run application programs. Portions of this book are for programmers who use IMS from a Customer Information Control System (CICS) environment. This book also contains information on the DBCTL environment. DBCTL is generated by IMS DB, contains no data communication components, and is designed to function as a database manager for non-IMS transaction management systems. This edition is available in hardcopy, PDF and BookManager formats. This book is available on the IMS Version 8 Licensed Product Kit (LK3T-7092). You can also get the most current versions of the PDF and BookManager formats by going to the IMS Web site at www.ibm.com/software/data/ims and linking to the Library page.
Summary of Contents
This book has four parts: v Part 1, Writing Application Programs on page 1 provides basic information on coding DL/I calls for IMS DB programs. v Part 2, IMS Adapter for REXX on page 251 provides information that you can use to interactively develop REXX EXECs under TSO/E and execute them in IMS MPPs, BMPs, IFPs, or batch regions. v Part 3, For Your Reference on page 287 provides additional information you need to write your application program. v Part 4, Appendixes contains appendixes on several subjects including sample exit routines, sample applications, and use of the DL/I test program (DFSDDLT0).
Prerequisite Knowledge
IBM offers a wide variety of classroom and self-study courses to help you learn IMS. For a complete list, see the IMS home page on the World Wide Web at: www.ibm.com/ims. Before using this book, you should understand the concepts of application design presented in IMS Version 8: Application Programming: Design Guide, which assumes you understand basic IMS concepts and the various environments. This book is an extension to IMS Version 8: Application Programming: Design Guide. The IMS concepts explained in this manual are limited to those concepts that are pertinent to developing and coding application programs. You should also know how to use assembler language, C language, COBOL, Pascal, or PL/I. CICS programs can be written in assembler language, C language, COBOL, PL/I, and C++.
xv
Terminology
In this manual, the term external subsystems refers to subsystems that are not CCTL subsystems, unless indicated otherwise. One example of an external subsystem is DB2. For definitions of terminology used in this manual and references to related information in other manuals, see IMS Version 8: Master Index and Glossary.
Syntax Diagrams
The following rules apply to the syntax diagrams used in this book: Arrow symbols Read the syntax diagrams from left to right, from top to bottom, following the path of the line. Indicates the beginning of a statement. Indicates that the statement syntax is continued on the next line. Indicates that a statement is continued from the previous line. Indicates the end of a statement.
Diagrams of syntactical units other than complete statements start with the symbol and end with the symbol. Conventions v Keywords, their allowable synonyms, and reserved parameters, appear in uppercase for MVS and OS/2 operating systems, and lowercase for UNIX operating systems. These items must be entered exactly as shown. v Variables appear in lowercase italics (for example, column-name). They represent user-defined parameters or suboptions. v When entering commands, separate parameters and keywords by at least one blank if there is no intervening punctuation. v Enter punctuation marks (slashes, commas, periods, parentheses, quotation marks, equal signs) and numbers exactly as given. v Footnotes are shown by a number in parentheses, for example, (1). v A symbol indicates one blank position. Required items Required items appear on the horizontal line (the main path).
REQUIRED_ITEM
If an optional item appears above the main path, that item has no effect on the execution of the statement and is used only for readability.
xvi
optional_item REQUIRED_ITEM
Multiple required or optional items If you can choose from two or more items, they appear vertically in a stack. If you must choose one of the items, one item of the stack appears on the main path.
REQUIRED_ITEM required_choice1 required_choice2
If choosing one of the items is optional, the entire stack appears below the main path.
REQUIRED_ITEM optional_choice1 optional_choice2
Repeatable items An arrow returning to the left above the main line indicates that an item can be repeated.
REQUIRED_ITEM
repeatable_item
If the repeat arrow contains a comma, you must separate repeated items with a comma.
, REQUIRED_ITEM repeatable_item
A repeat arrow above a stack indicates that you can specify more than one of the choices in the stack. Default keywords IBM-supplied default keywords appear above the main path, and the remaining choices are shown below the main path. In the parameter list following the syntax diagram, the default choices are underlined.
default_choice REQUIRED_ITEM optional_choice optional_choice
IMS-specific syntax information Fragments Sometimes a diagram must be split into fragments. The fragments are represented by a letter or fragment name, set off like this: | A |. The fragment follows the end of the main diagram. The following example shows the use of a fragment.
Preface
xvii
STATEMENT
item 1
item 2
A:
item 3 item 4 KEYWORD item 5 item 6
Substitution-block Sometimes a set of several parameters is represented by a substitution-block such as <A>. For example, in the imaginary /VERB command you could enter /VERB LINE 1, /VERB EITHER LINE 1, or /VERB OR LINE 1.
/VERB <A> LINE line#
Parameter endings Parameters with number values end with the symbol '#', parameters that are names end with 'name', and parameters that can be generic end with '*'.
/MSVERIFY MSNAME msname SYSID sysid#
The MSNAME keyword in the example supports a name value and the SYSID keyword supports a number value.
Change Indicators
Technical changes are indicated in this publication by a vertical bar (|) to the left of the changed text.
xviii
Summary of Changes
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
xix
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Organizational Changes
Organizational changes to the IMS Version 8 library include changes to: v IMS Version 8: Application Programming: Database Manager v IMS Version 8: Application Programming: Transaction Manager v IMS Version 8: Messages and Codes, Volume 1 The chapter titled DL/I Return and Reason Codes has been moved from the IMS Version 8: Application Programming: Database Manager and IMS Version 8: Application Programming: Transaction Manager to IMS Version 8: Messages and Codes, Volume 1. The chapter titled DL/I Status Codes will now only appear in IMS Version 8: Messages and Codes, Volume 1.
Accessibility Enhancements
Accessibility features help a user who has a physical disability, such as restricted mobility or limited vision, to use software products successfully. The major accessibility features in z/OS products, including IMS, enable users to: v Use assistive technologies such as screen-readers and screen magnifier software v Operate specific or equivalent features using only the keyboard v Customize display attributes such as color, contrast, and font size
Accessible Documentation
Online documentation for IMS Version 8 is available in BookManager format, which is an accessible format. All BookManager functions can be accessed by using a keyboard or keyboard shortcut keys. BookManager also allows you to use screen readers and other assistive technologies. The BookManager READ/MVS product is included with the OS/390 base product, and the BookManager Library Reader (for workstations) is available on the IMS Licensed Product Kit (CD), which is available for downloading from IBM at www.ibm.com.
xx
Chapter 3. Defining Application Program Elements . . . . . . . . . . 71 Formatting DL/I Calls for Language Interfaces . . . . . . . . . . . . . 71 Application Programming for Assembler Language . . . . . . . . . . . . 72
Copyright IBM Corp. 1974, 2002
Format . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . Example DL/I Call Formats . . . . . . . . . . . . . . . Application Programming for C Language . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . I/O Area . . . . . . . . . . . . . . . . . . . . . . Example DL/I Call Formats . . . . . . . . . . . . . . . Application Programming for COBOL . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . Example DL/I Call Formats . . . . . . . . . . . . . . . Application Programming for Pascal . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . Example DL/I Call Formats . . . . . . . . . . . . . . . Application Programming for PL/I . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . Example DL/I Call Formats . . . . . . . . . . . . . . . Relationship of Calls to PCBs . . . . . . . . . . . . . . . Specifying the I/O PCB Mask . . . . . . . . . . . . . . . Specifying the DB PCB Mask . . . . . . . . . . . . . . . Specifying the AIB Mask . . . . . . . . . . . . . . . . . Specifying the AIB Mask for ODBA Applications . . . . . . . . . AIB Examples . . . . . . . . . . . . . . . . . . . . Specifying the UIB (CICS Online Programs Only) . . . . . . . . Specifying the I/O Areas . . . . . . . . . . . . . . . . . Segment Search Arguments . . . . . . . . . . . . . . . SSA Coding Rules . . . . . . . . . . . . . . . . . . SSA Coding Restrictions . . . . . . . . . . . . . . . . SSA Coding Formats . . . . . . . . . . . . . . . . . GSAM Data Areas . . . . . . . . . . . . . . . . . . . GSAM DB PCB Masks . . . . . . . . . . . . . . . . GSAM RSAs . . . . . . . . . . . . . . . . . . . . The AIBTDLI Interface. . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . Defining Storage for the AIB . . . . . . . . . . . . . . Specifying the Language Specific Entry Point . . . . . . . . . Assembler Language . . . . . . . . . . . . . . . . . C Language . . . . . . . . . . . . . . . . . . . . COBOL . . . . . . . . . . . . . . . . . . . . . . Pascal . . . . . . . . . . . . . . . . . . . . . . PL/I . . . . . . . . . . . . . . . . . . . . . . . Interface Considerations . . . . . . . . . . . . . . . . PCB Lists . . . . . . . . . . . . . . . . . . . . . . Format of a PCB List . . . . . . . . . . . . . . . . . Format of a GPSB PCB List . . . . . . . . . . . . . . PCB Summary . . . . . . . . . . . . . . . . . . . The AERTLDI interface . . . . . . . . . . . . . . . . . Overview. . . . . . . . . . . . . . . . . . . . . . Defining Storage for the AIB. . . . . . . . . . . . . . . Language Environment . . . . . . . . . . . . . . . . . The CEETDLI interface to IMS . . . . . . . . . . . . . . LANG= Option on PSBGEN for PL/I Compatibility with Language Environment . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 72 . 73 . 74 . 74 . 74 . 75 . 77 . 77 . 77 . 77 . 78 . 79 . 80 . 80 . 81 . 82 . 82 . 82 . 83 . 84 . 85 . 86 . 89 . 92 . 94 . 96 . 96 . 99 . 100 . 100 . 101 . 101 . 104 . 105 . 105 . 105 . 105 . 106 . 106 . 106 . 106 . 107 . 107 . 108 . 108 . 109 . 109 . 109 . 109 . 110 . 110 . 111 . 111 . 111
. . . . 112
Special DL/I Situations. . . . . . . . . . . . Application Program Scheduling against HALDBs . Mixed-Language Programming . . . . . . . Language Environment Routine Retention . . . Extended Addressing Capabilities of MVS/ESA. . Preloaded Programs . . . . . . . . . . .
. . . . . .
. . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
112 112 113 113 114 114 115 115 115 116 116 117 117 117 117 117 117 118 118 118 119 119 119 119 120 120 120 120 121 121 122 122 123 124 126 126 127 127 127 127 128 129 129 130 130 131 131 132 132 132 132 133 135 135 136
Chapter 4. Writing DL/I Calls for Database Management CIMS Call . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . CLSE Call . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . DEQ Call . . . . . . . . . . . . . . . . . . Format (Full Function) . . . . . . . . . . . . . Format (Fast Path DEDB) . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . Restrictions . . . . . . . . . . . . . . . . . DLET Call . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . FLD Call . . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . FSAs . . . . . . . . . . . . . . . . . . . GN/GHN Call . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage, Get Next (GN) . . . . . . . . . . . . . Usage, Get Hold Next (GHN) . . . . . . . . . . Usage, HDAM, PHDAM, or DEDB Database with GN . Restriction . . . . . . . . . . . . . . . . . GNP/GHNP Call . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage, Get Next in Parent (GNP) . . . . . . . . Usage, Get Hold Next in Parent (GHNP) . . . . . . GU/GHU Call . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage, Get Unique (GU) . . . . . . . . . . . . Usage, Get Hold Unique (GHU) . . . . . . . . . Restriction . . . . . . . . . . . . . . . . . ISRT Call . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . Usage. . . . . . . . . . . . . . . . . . . OPEN Call . . . . . . . . . . . . . . . . . . Format . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . .
Usage. . . POS Call . . Format . . Parameters . Usage. . . Restrictions. REPL Call . . Format . . Parameters . Usage. . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
136 136 136 137 139 139 140 140 140 141 143 144 144 144 144 144 145 145 145 145 145 146 147 147 147 147 147 147 148 148 148 149 150 150 150 150 151 151 151 151 151 152 153 153 153 153 153 157 157 158 158 158 163 163 163
Chapter 5. Writing DL/I APSB Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . CHKP (Basic) Call . . Format . . . . . Parameters . . . . Usage. . . . . . CHKP (Symbolic) Call . Format . . . . . Parameters . . . . Usage. . . . . . Restrictions. . . . DPSB Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . GMSG Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . Restrictions. . . . GSCD Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . Restriction . . . . ICMD Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . Restrictions. . . . INIT Call . . . . . . Format . . . . . Parameters . . . . Usage. . . . . . Restrictions. . . . INQY Call . . . . . Format . . . . . Parameters . . . . Usage. . . . . . Restrictions. . . . LOG Call . . . . . Format . . . . .
Calls for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . PCB Call (CICS Online Programs Only) . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . RCMD Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . ROLB Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Restrictions. . . . . . . . . . . ROLL Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restriction . . . . . . . . . . . ROLS Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . SETS/SETU Call. . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . SNAP Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . STAT Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . SYNC Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . TERM Call (CICS Online Programs Only) Format . . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . . XRST Call . . . . . . . . . . . . Format . . . . . . . . . . . . Parameters . . . . . . . . . . . Usage. . . . . . . . . . . . . Restrictions. . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
163 164 164 165 165 165 165 165 166 166 166 166 167 167 167 167 168 168 168 168 168 168 168 168 169 169 169 170 170 170 170 171 171 171 171 174 174 174 174 174 175 176 176 176 176 176 176 177 177 177 177 177 177 177 178 180
Chapter 6. Monitoring Your Position in the Database Understanding Current Position in the Database . . . Position after Retrieval Calls . . . . . . . . . Position after DLET . . . . . . . . . . . . . Position after REPL. . . . . . . . . . . . . Position after ISRT . . . . . . . . . . . . . Current Position after Unsuccessful Calls . . . . . . Position after an Unsuccessful DLET or REPL Call . Position after an Unsuccessful Retrieval or ISRT Call Chapter 7. Multiple Qualification Statements . . Overview of Multiple Qualification Statements . . . Example using Multiple Qualification Statements . . Multiple Qualification Statements for HDAM, PHDAM, Chapter 8. Multiple Processing . . . . . . . Multiple Positioning . . . . . . . . . . . . Advantages of Using Multiple Positioning . . . . How Multiple Positioning Affects Your Program. Resetting Position with Multiple Positioning . . Using Multiple DB PCBs . . . . . . . . . . . . . . . . . . . or . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
181 181 182 183 185 185 186 186 187 191 191 192 193 195 195 198 198 200 200 203 203 203 204 206 206 206 208 209 211 211 211 213 214 214 215 215 216 216 217 218 218 219 219 219 221 221 222 222 223 223 223
. . . . . . . . . DEDB . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 9. Secondary Indexing and Logical Relationships How Secondary Indexing Affects Your Program . . . . . SSAs with Secondary Indexes . . . . . . . . . . . Multiple Qualification Statements with Secondary Indexes What DL/I Returns with a Secondary Index . . . . . . Status Codes for Secondary Indexes . . . . . . . . Processing Segments in Logical Relationships . . . . . . How Logical Relationships Affect Your Programming . . Status Codes for Logical Relationships . . . . . . .
Chapter 10. Processing GSAM Databases . . . . . . . Accessing GSAM Databases . . . . . . . . . . . . . PCB Masks for GSAM Databases . . . . . . . . . . Retrieving and Inserting GSAM Records . . . . . . . . Explicitly Opening and Closing a GSAM Database . . . . GSAM Record Formats . . . . . . . . . . . . . . . GSAM I/O Areas . . . . . . . . . . . . . . . . . . GSAM Status Codes . . . . . . . . . . . . . . . . Symbolic CHKP and XRST with GSAM . . . . . . . . . GSAM Coding Considerations . . . . . . . . . . . . . Origin of GSAM Data Set Characteristics . . . . . . . . . DD Statement DISP Parameter for GSAM Data Sets . . . Using Extended Checkpoint Restart for GSAM Data Sets . . Use of Concatenated Data Sets by GSAM . . . . . . . Suggested Method for Specifying GSAM Data Set Attributes DLI or DBB Region Types and GSAM . . . . . . . . . Chapter 11. Processing Fast Path Databases . . Fast Path Database Calls . . . . . . . . . . MSDBs and DEDBs: Overview . . . . . . . . MSDBs . . . . . . . . . . . . . . . . DEDBs . . . . . . . . . . . . . . . . Processing MSDBs and DEDBs . . . . . . . . Updating Segments in an MSDB or DEDB: REPL,
Commit-Point Processing in MSDBs and DEDBs . . . VSO Considerations . . . . . . . . . . . . . Data Locking for MSDBs and DEDBs . . . . . . . Restrictions on Using Calls for MSDBs . . . . . . . Processing DEDBs (IMS, CICS with DBCTL) . . . . . Processing DEDBs with Subset Pointers . . . . . . Retrieving Location with the POS Call (for DEDB Only) Commit-Point Processing in a DEDB . . . . . . . Crossing a UOW Boundary (P Processing Option) . . Crossing the UOW Boundary (H Processing Option) . Data Locking . . . . . . . . . . . . . . . . Restrictions on Using Calls for DEDBs. . . . . . . . Direct Dependent Segments . . . . . . . . . . Sequential Dependent Segments . . . . . . . . . Fast Path Coding Considerations. . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
227 228 228 229 230 230 234 237 237 237 238 238 238 238 239
Chapter 12. Recovering Databases and Maintaining Database Integrity Issuing Checkpoints . . . . . . . . . . . . . . . . . . . . Restarting Your Program and Checking for Position . . . . . . . . . Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) Backing Out to a Prior Commit Point: ROLL, ROLB, and ROLS . . . Backing Out to an Intermediate Backout Point: SETS, SETU, and ROLS Reserving Segments for the Exclusive Use of Your Program. . . . . . Resource Lock Management . . . . . . . . . . . . . . . .
Chapter 1. How Application Programs Work with the IMS Database Manager
Your application program uses Data Language I (DL/I) to communicate with the IMS Database Manager (IMS DB). This chapter provides an overview of the database management process. In this Chapter: v Application Program Environments v The Application Programming Interface on page 9 v Getting Started with DL/I on page 12 v Getting Started with DL/I (for CICS Online Users) on page 13 v v v v v v v Getting Started with DL/I via the ODBA Interface on page 15 DL/I Calls on page 16 High Availability Large Databases on page 18 Sample Hierarchies on page 19 SSA Overview on page 23 Command Codes on page 28 IVP Sample Application on page 43
Application programming techniques and the application programming interface are explained here as they apply to the IMS DB. Related Reading: v If your installation uses the IMS Transaction Manager (IMS TM), refer to the IMS Version 8: Application Programming: Transaction Manager for information on transaction management functions. v Information on DL/I EXEC commands is in the IMS Version 8: Application Programming: EXEC DLI Commands for CICS and IMS.
The online environment can be used to access other types of external subsystems using the External Subsystem Attach facility (ESAF). It lets application programs obtain data from external subsystems such as DB2. All DL/I database management calls and most system service calls are supported in DB/DC. For more information on calls supported in DB/DC, see Chapter 15, Summary of DM and System Service Calls on page 289. The IMS DB portion of the IMS DB/DC environment can be used separately to provide database management capabilities for coordinator controllers (CCTLs). The IMS DB portion is called the DBCTL environment. Related Reading: For more information on IMS DB/DC environments, refer to IMS Version 8: Administration Guide: Database Manager or IMS Version 8: Administration Guide: System.
10
Most DL/I database management calls and system service calls are supported in DBCTL. They are listed in Chapter 15, Summary of DM and System Service Calls on page 289. IMS application programs in the DBCTL environment can run in non-message-driven BMP regions. Application programs for DBCTL are the same as IMS DB application programs. However, DBCTL application programs cannot issue DL/I calls for communications or access MSDBs. DBCTL BMPs can access DL/I, DEDB, and GSAM databases. The DBCTL environment can also be used to attach to an external subsystem, such as DB2, using the External Subsystem Attach facility (ESAF). The DBCTL environments ability to attach to external subsystems provides a BMP access to DB2 databases. Programs running under a CCTL do not have access to external subsystems or GSAM through the DRA interface. Related Reading: For more information on IMS DBCTL environments, refer to IMS Version 8: Administration Guide: Database Manager or IMS Version 8: Administration Guide: System.
Chapter 1. How Application Programs Work with the IMS Database Manager
11
Notes to Figure 3: 1. Program entry. IMS passes control to the application program with a list of associated PCBs. 2. PCB or AIB. IMS describes the results of each DL/I call using the AIBTDLI interface in the application interface block (AIB) and, when applicable, the program communication block (PCB). To find the results of a DL/I call, your
12
Chapter 1. How Application Programs Work with the IMS Database Manager
13
Notes to Figure 4: 1. I/O area. IMS passes segments to and from the program in the programs I/O area. 2. PCB. IMS describes the results of each DL/I call in the database PCB mask. 3. User Interface Block (UIB). The UIB provides the program with addresses of the PCBs and return codes from the CICS-DL/I interface. 4. Program entry. CICS passes control to the application program during program entry. Do not use an ENTRY statement as you would in a batch program. 5. Schedule the PSB. This identifies the PSB your program is to use and passes the address of the UIB to your program. 6. Issue DL/I Calls. You issue DL/I calls to read and update the database. 7. Check the return code in the UIB. You should check the return code after issuing any DL/I call for database processing, including the PCB or TERM call. Do this before checking the status code in the PCB. 8. Check the status code in the PCB. You should check the status code after issuing any DL/I call for database processing. The code gives you the results of your DL/I call. 9. Terminate the PSB. This terminates the PSB and commits database changes. PSB termination is optional, and if it is not done, the PSB is released when your program returns control to CICS. 10. Return to CICS. This returns control to either CICS or the linking program. If control is returned to CICS, database changes are committed, and the PSB is terminated.
14
8. Check the return code in the AIB. You should check the return code after issuing any DL/I call for database processing. Do this before checking the status code in the PCB. 9. Check the status code in the PCB. If the AIB return code indicates (Return Code X'900'), then you should check the status code after issuing any DL/I call for database processing. The code gives you the results of your DL/I call. Logic Flow for SRMS 1. Commit database changes. No DL/I calls, including system service calls such as LOG or STAT, may be made between the commit and the termination of the DPSB. 2. Terminate the DPSB. 3. Terminate the ODBA interface. 4. Return to environment that initialized the application. Logic Flow for MRMS 1. Terminate the PSB. 2. Terminate the ODBA interface. 3. Commit changes. 4. Return to environment that initialized the application.
Chapter 1. How Application Programs Work with the IMS Database Manager
15
DL/I Calls
DL/I Calls
A DL/I call consists of a call statement and a list of parameters. The parameters provide information that IMS needs to execute the call. This information consists of the call function, the name of the data structure that IMS uses for the call, the data area in the program into which IMS returns data, and any condition that the retrieved data must meet. You can issue calls to perform database management calls (DB calls) and to obtain IMS DB system service (system service calls):
DB Call Functions
The DL/I calls for database management are: CLSE DEQ DLET FLD GHN GHNP GHU GN GNP GU ISRT OPEN POS REPL GSAM Close Dequeue Delete Field Get Hold Next Get Hold Next in Parent Get Hold Unique Get Next Get Next in Parent Get Unique Insert GSAM Open Position Replace
16
DL/I Calls
RCMD ROLB ROLL ROLS SETS SETU SNAP STAT SYNC TERM XRST Retrieve Command Roll Back Roll Roll Back to SETS Set a Backout Point SET Unconditional Collects diagnostic information Statistics Synchronization Terminate Extended Restart
Related Reading: v DL/I calls are described in detail in Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143. v Reference tables for the calls appear in Chapter 15, Summary of DM and System Service Calls on page 289 and System Service Call Summary on page 290.
Exceptional Conditions
Some status codes do not mean that your call was successful or unsuccessful; they just give information about the results of the call. Your program uses this information to determine what to do next. The meanings of these status codes depend on the call. In a typical program, status codes that you should test for apply to the get calls. Some status codes indicate exceptional conditions for other calls, and you should provide routines other than error routines for these situations. For example, AH means that a required SSA is missing, and AT means that the user I/O area is too long.
Chapter 1. How Application Programs Work with the IMS Database Manager
17
Error Routines
If your program detects an error after checking for blanks and exceptional conditions in the status code, it should branch to an error routine and print as much information as possible about the error before terminating. Determining which call was being executed when the error occurred, what parameters were on the IMS call, and the contents of the PCB will be helpful in understanding the error. Print the status code, as well to help with problem determination. Two kinds of errors can occur in your program: programming errors and system or I/O errors. Programming errors, are usually your responsibility to find and fix. These errors are caused by things like an invalid parameter, an invalid call, or an I/O area that is too long. System or I/O errors are usually resolved by the system programmer or the equivalent specialist at your installation. Because every application program should have an error routine, and because each installation has its own ways of finding and debugging program errors, you probably have your own standard error routines.
18
Figure 5. Normal Relationship between Programs, PSBs, PCBs, DBDs, and Databases
Figure 6 shows concurrent processing, which means use of multiple PCBs for the same database.
Sample Hierarchies
The examples in this book use the medical hierarchy shown in Figure 7 on page 20 and the bank hierarchy shown in Figure 14 on page 22 through Figure 16 on page 23. The medical hierarchy is used with full-function databases and Fast Path DEDBs. The bank hierarchy is an example of an application program used with main storage databases (MSDBs). To understand the examples, familiarize yourself with the hierarchies and segments that each hierarchy contains.
Chapter 1. How Application Programs Work with the IMS Database Manager
19
Sample Hierarchies
The figures that follow show the layouts of segments in the hierarchy. The number below each field is the length in bytes that has been defined for that field. v PATIENT Figure 8 shows the PATIENT segment. It has three fields: patient number (PATNO), patient name (NAME), and the patients address (ADDR). PATIENT has a unique key field: PATNO. PATIENT segments are stored in ascending order of their patient numbers. The lowest patient number in the database is 00001. The highest patient number is 10500.
v ILLNESS Figure 9 shows the ILLNESS segment. It has two fields: the date when the patient came to the clinic with the illness (ILLDATE) and the name of the illness (ILLNAME). The key field is ILLDATE. Because it is possible for a patient to come to the clinic with more than one illness on the same date, this key field is nonentity; that is, more than one ILLNESS segment can have the same (equal) key field value. Usually someone in the installation, such as a database administrator (DBA), decides the sequence in which IMS should store multiple segments with equal keys or any individual segment with no key field. The DBA can use the RULES keyword of the SEGM statement of the DBD to specify this. For segments with equal keys or no keys, the RULES keyword determines where the segment is inserted. Where RULES=LAST, ILLNESS segments that have an equal key are stored on a first-in first-out basis among those with equal keys. ILLNESS segments with unique keys are stored in ascending order on the date field, regardless of RULES. ILLDATE is specified in the format YYYYMMDD.
v TREATMNT Figure 10 on page 21 shows the TREATMNT segment. It contains four fields: the date of the treatment (DATE), the medicine that was given to the patient (MEDICINE), the quantity of the medicine that the patient was given (QUANTITY), and the name of the doctor who prescribed the treatment (DOCTOR). The key field of the TREATMNT segment is DATE. Because a
20
Sample Hierarchies
patient may receive more than one treatment on the same date, DATE is a nonentity key field. TREATMNT, like ILLNESS, has been specified as having RULES=LAST. TREATMNT segments with equal date keys are also stored on a first-in-first-out basis. DATE is specified in the same format as ILLDATEYYYYMMDD.
v BILLING Figure 11 shows the BILLING segment. It has only one field, which is the amount of the current bill. BILLING has no key field.
v PAYMENT Figure 12 shows the PAYMENT segment. It also has only one field, which is the amount of the payments for the month. The PAYMENT segment has no key field.
v HOUSHOLD Figure 13 shows the HOUSHOLD segment, which contains the names of the members of the patients household and indicates how each is related to the patient. RELNAME is the key field.
21
Sample Hierarchies
Related MSDBs
One type of data that you can store in a fixed related MSDB is summary data about a particular teller at a bank. For example, you can have an identification code for the tellers terminal. Then you can keep a count of that tellers transactions and balance for the day. This segment contains three fields: TELLERID TRANCNT TELLBAL | A two-character code that identifies the teller The number of transactions the teller has processed The balance for the teller
Figure 14 shows what the segment for this type of application looks like.
Some of the characteristics of fixed related MSDBs are: v You can only read and replace segments. You cannot delete or insert segments. In the bank teller example, a teller only replaces values in segments. You never need to add or delete segments. v Each segment is assigned to one logical terminal. Only the owning terminal can change a segment, but other terminals can read the segment. In the bank teller example, you do not want tellers to update the information about other tellers. Tellers are responsible for their own transactions. v The name of the logical terminal that owns the segment is the segments key. Unlike non-MSDB segments, however, the key is not a field of the segment. It is used as a means of storing and accessing segments. v A logical terminal can own only one segment in any one MSDB. The type of data that you might store in a dynamic related MSDB is summary data about the activity of all the bank tellers at one branch. For example, this segment contains: BRANCHNO TOTAL TRANCNT DEPBAL WTHBAL The identification number for the branch The bank branchs current balance The number of transactions for the branch on that day The deposit balance giving the total dollar amount of deposits for the branch The withdrawal balance, giving the dollar amount of the withdrawals for the branch
Dynamic related MSDBs have the same characteristics as fixed related MSDBs except: v The owning logical terminal can delete and insert segments.
22
Sample Hierarchies
v The MSDB can have a pool of unassigned segments. This kind of segment is assigned to a logical terminal when the logical terminal inserts it, and is returned to the pool when the logical terminal deletes it.
Nonrelated MSDBs
A nonrelated MSDB is used to store data that is updated by several terminals, such as data that a number of people must access and update during the same time period. For example, you might store data about individuals bank accounts in a nonrelated MSDB segment. The following information is data that your program might need to access. This segment contains the following fields: ACCNTNO BRANCH TRANCNT BALANCE | The account number The name of the branch where the account is The number of transactions for this account this month The current balance
Figure 16 shows what the segment for this application looks like.
The characteristics of nonrelated MSDBs are: v Segments are not owned by terminals as they are in related MSDBs. Therefore, IMS programs and Fast Path programs can update these segments. Updating them is not restricted to the owning logical terminal. v Your program cannot delete or insert segments. v Segment keys can be the name of a logical terminal. A nonrelated MSDB exists with terminal-related keys. The segments are not owned by the logical terminals, and the logical terminal name is used to identify the segment. v If the key is not the name of a logical terminal, it can be any value, and it is in the first field of the segment. Segments are loaded in key sequence.
SSA Overview
Segment Search Arguments (SSAs) specify information for IMS to use in processing a DL/I call. A DL/I call with one or more SSAs is a qualified call, and a DL/I call without SSAs is an unqualified call. Definitions: Unqualified SSA Qualified SSA Contains only a segment name. Includes one or more qualification statements that name a segment occurrence. The C command and a segment occurrences concatenated key can be substituted for a qualification statement.
You can use SSAs to select segments by name and to specify search criteria for specific segments. Specific segments are described by adding qualification statements to the DL/I call. You can further qualify your calls by using command codes.
Chapter 1. How Application Programs Work with the IMS Database Manager
23
SSA Overview
Figure 17 shows you the structure of a qualified SSA. Figure 20 on page 27 shows you the structure of an unqualified SSA using command codes. Finally, Figure 21 on page 27 shows you the structure of a qualified SSA that uses command codes.
Unqualified SSAs
An unqualified SSA gives the name of the segment type that you want to access. In an unqualified SSA, the segment name field is 8 bytes and must be followed by a 1-byte blank. If the actual segment name is fewer than 8 bytes long, it must be padded to the right with blanks. An example of an unqualified SSA follows:
PATIENT
Qualified SSAs
| | | | To qualify an SSA, you can use either a field or the sequence field of a virtual child. A qualified SSA describes the segment occurrence that you want to access. This description is called a qualification statement and has three parts. Figure 17 shows the structure of a qualified SSA.
Using a qualification statement enables you to give IMS information about the particular segment occurrence that you are looking for. You do this by giving IMS the name of a field within the segment and the value of the field you are looking for. The field and the value are connected by a relational operator (R.O. in Figure 17) which tells IMS how you want the two compared. For example, to access the PATIENT segment with the value 10460 in the PATNO field, you could use this SSA:
PATIENT (PATNO = 10460)
The qualification statement is enclosed in parentheses. The first field contains the name of the field (Fld Name in Figure 17) that you want IMS to use in searching for the segment. The second field contains a relational operator. The relational operator can be any one of the following: v Equal, represented as = = EQ v Greater than, represented as > > GT v Less than, represented as < < LT v Greater than or equal to, represented as >=
24
SSA Overview
=> GE v Less than or equal to, represented as <= =< LE v Not equal to, represented as = = NE The third field (Fld Value in Figure 17 on page 24) contains the value that you want IMS to use as the comparative value. The length of Fld Value must be the same length as the field specified by Fld Name. You can use more than one qualification statement in an SSA. Special cases exist, such as in a virtual logical child segment when the sequence field consists of multiple fields. Related Reading: For more information on multiple qualification statements, see Chapter 7, Multiple Qualification Statements on page 191.
If the first sequence field is not included in a scattered sequence field in an SSA, IMS treats the argument as a data field specification, rather than as a sequence field. Related Reading: For more information on the virtual logical child segment, refer to IMS Version 8: Administration Guide: Database Manager.
Chapter 1. How Application Programs Work with the IMS Database Manager
25
SSA Overview
Using SSAs does not necessarily reduce system overhead, such as internal logic and I/Os, required to obtain a specific segment. To locate a particular segment without using SSAs, you can issue DL/I calls and include program logic to examine key fields until you find the segment you want. By using SSAs in your DL/I calls, you can reduce the number of DL/I calls that are issued and the program logic needed to examine key fields. When you use SSAs, IMS does this work for you. Recommendations: v Use qualified calls with qualified SSAs whenever possible. SSAs act as filters, returning only the segments your program requires. This reduces the number of calls your program makes, which provides better performance. It also provides better documentation of your program. Qualified SSAs are particularly useful when adding segments with insert calls. They ensure that the segments are inserted where you want them to go. v For the root segment, specify the key field and an equal relational operator, if possible. Using a key field with an equal-to, equal-to-or-greater-than, or greater-than operator lets IMS go directly to the root segment. v For dependent segments, it is desirable to use the key field in the SSA, although it is not as important as at the root level. Using the key field and an equal-to operator lets IMS stop the search at that level when a higher key value is encountered. Otherwise IMS must search through all occurrences of the segment type under its established parent in order to determine whether a particular segment exists. v If you often must search for a segment using a field other than the key field, consider putting a secondary index on the field. For more information on secondary indexing, see Chapter 9, Secondary Indexing and Logical Relationships on page 203. Example: Suppose you want to find the record for a patient by the name of Ellen Carter. As a reminder, the patient segment in the examples contains three fields: the patient number, which is the key field; the patient name; and the patient address. The fact that patient number is the key field means that IMS stores the patient segments in order of their patient numbers. The best way to get the record for Ellen Carter is to supply her patient number in the SSA. If her number is 09000, your program uses this call and SSA:
GU&$tab;PATIENT (PATNO = 09000)
If your program supplies an invalid number, or if someone has deleted Ellen Carters record from the database, IMS does not need to search through all the PATIENT occurrences to determine that the segment does not exist. However, if your program does not have the number and must give the name instead, IMS must search through all the patient segments and read each patient name field until it finds Ellen Carter or until it reaches the end of the patient segments.
26
SSA Overview
Example: Suppose your program codes a D command code on a GU call that retrieves segment F and all segments in the path to F in the hierarchy shown in Figure 19.
The call function and the SSAs for the call look like this:
GU A C E F *D *D *D
| | |
A command code consists of one letter. Code the command codes in the SSA after the segment name field. Separate the segment name field and the command code with an asterisk, as shown in Figure 20.
Your program can use command codes in both qualified and unqualified SSAs. However, command codes cannot be used by MSDB calls. If the command codes are not followed by qualification statements, they must each be followed by a 1-byte blank. If the command codes are followed by qualification statements, do not use the blank. The left parenthesis of the qualification statement follows the command code instead, as indicated in Figure 21. If your program uses command codes to manage subset pointers in a DEDB, enter
the number of the subset pointer immediately after the command code. Subset pointers are a means of dividing a chain of segment occurrences under the same parent into two or more groups or subsets. Your program can define as many as eight subset pointers for any segment type. Using an application program, your program can then manage these subset pointers. This process is described in detail in Processing DEDBs with Subset Pointers on page 230.
Chapter 1. How Application Programs Work with the IMS Database Manager
27
Command Codes
Command Codes
This section describes the command codes used for DL/I calls and it is divided into two subsections. v General Command Codes for DL/I Calls covers the C, D, F, L, N, P, Q, U, V, and null command codes, which are used with full-function databases and DEDBs. v DEDB Command Codes for DL/I on page 38 covers the M, R, S, W, and Z command codes, which are used only with DEDBs. See Table 1 for all the command codes and their usage. Restriction: Command codes cannot be used by MSDB calls.
Table 1. Command Codes for DL/I Calls Command Code C D F L M N P Q R S
1 1 1
Usage Supplies concatenated key in SSA Retrieves or inserts a sequence of segments Starts search with first occurrence Locates last occurrence Moves subset pointer forward to the next segment Prevents replacement of a segment on a path call Establishes parentage of present level Enqueues segment Retrieves first segment in the subset Sets subset pointer unconditionally Maintains current position Maintains current position at present level and higher Sets subset pointer conditionally Sets subset pointer to 0 Reserves storage positions for program command codes in SSA
U V W1 Z1 - (null) Note:
28
Command Codes
Example: Suppose you wanted to satisfy the following request: Did Joan Carter visit the clinic on March 3, 1993? Her patient number is 07755. The key field of the PATIENT segment is the patient number, and the key field of the ILLNESS segment is the date field, so the concatenated key is 0775519930303. You issue a GU call with the following SSA to satisfy the request:
GU ILLNESS *C(0775519930303)
Using the C command code is sometimes more convenient than a qualification statement because it is easier to use the concatenated key than to move each part of the qualification statement to the SSA area during program execution. Using the segments concatenated key is the equivalent of giving all the SSAs in the path to the segment qualified on their keys. Example: Suppose that you wanted to answer the following request: What treatment did Joan Carter, patient number 07755, receive on March 3, 1993? Using qualification statements, you would specify the following SSAs with a GU call:
GU PATIENT (PATNO EQ07755) ILLNESS (ILLDATE EQ19930303) TREATMNT
Using a C command code, you can satisfy the previous request by specifying the following SSAs on a GU call:
GU ILLNESS *C(0775519930303) TREATMNT
If you need to qualify a segment by using a field other than the key field, use a qualification statement instead of the C command code. Only one SSA with a concatenated key is allowed for each call. To return segments to your program in the path to the segment specified by the concatenated key, you can use unqualified SSAs containing the D command code. Example: If you want to return the PATIENT segment for Joan Carter to your I/O area, in addition to the ILLNESS segment, use the following call:
GU PATIENT *D ILLNESS *C(0775519930303)
You can use the C command code with the object segment for a Get call, but not for an ISRT call. The object segment for an ISRT call must be unqualified.
Chapter 1. How Application Programs Work with the IMS Database Manager
29
Command Codes
Related Reading: For more information on using the P processing option, see the description of PSB generation in IMS Version 8: Utilities Reference: System. Retrieving a Sequence of Segments: When you use the D command code with retrieval calls, IMS places the segments in your I/O area. The segments in the I/O area are placed one after the other, left to right, starting with the first SSA you supplied. To have IMS return each segment in the path, you must include the D command code in each SSA. You can, however, include intervening SSAs without the D command code. You do not need to include the D command code on the last segment in the path, because IMS always returns the last segment in the path to your I/O area. The D command code has no effect on IMSs retrieval logic. The only thing it does is cause each segment to be moved to your I/O area. The segment name in the PCB is the lowest-level segment that is retrieved or the last level that is satisfied in the call in the case of a GE (not-found) status code. Higher-level segments with the D command code are placed in the I/O area. If IMS is unable to find the lowest segment your program has requested, it returns a GE (not-found) status code, just as it does if your program does not use the D command code and IMS is unable to find the segment your program has requested. This is true even if IMS reaches the end of the database before finding the lowest segment your program requested. If IMS reaches the end of the database without satisfying any levels of a path call, it returns a GB status code. However, if IMS returns one or more segments to your I/O area (new segments for which there was no current position at the start of the current call), and if IMS is unable to find the lowest requested segment, IMS returns a GE status code, even if it has reached the end of the database. The advantages of using the D command code are significant, even if your program is not sure that it will need the dependent segment returned by D. For example, suppose that after examining the dependent segment, your program still needs to use it. Using the D command, your program has the segment if you need it, and your program is not required to issue another call for the segment. Example: As an example of the D command code, suppose your program has this request: Compute the balance due for each of the clinics patients by subtracting the payments received from the amount billed; print bills to be mailed to each patient. To process this request for each patient, your program needs to know the patients name and address, what the charges are for the patient, and the amount of payment the patient has made. Issue this call until your program receives a GE status code indicating that no more patient segments exist:
GN PATIENT *D BILLING *D PAYMENT
Each time you issue this call, your I/O area contains the patient segment, the billing segment, and the payment segment for a particular person. Inserting a Sequence of Segments: With ISRT calls, your program can use the D command code to insert a path of segments simultaneously. Your program need not
30
Command Codes
include D for each SSA in the path. Your program just specifies D on the first segment that you want IMS to insert. IMS inserts the segments in the path that follow. Example: Suppose your program has the following request: Judy Jennison visited the clinic for the first time. Add a record that includes PATIENT, ILLNESS, and TREATMNT segments. After building the segments in your I/O area, issue an ISRT call with the following SSAs:
ISRT PATIENT *D ILLNESS TREATMNT
Not only is the PATIENT segment added, but the segments following the PATIENT segment, ILLNESS and TREATMNT, are also added to the database. You cannot use the D command code to insert segments if a logical child segment in the path exists.
31
Command Codes
DBD, the F command code overrides this, and IMS inserts the new segment occurrence as the first occurrence of that segment type. Using the F command code to override the RULES specification on the DBD applies only to the path (either logical or physical) that you are using to access the segment for the ISRT call. For example, if you are using the physical path to access the segment, the command code applies to the physical path but not to the logical path. For clarification of using command codes with the RULES specification, ask the database administrator at your installation. Example: Suppose that you specified RULES=HERE in the DBD for the TREATMNT segment. You want to satisfy the following request: Mary Martin visited the clinic today and visited a number of different doctors. Add the TREATMNT segment for Dr. Smith as the first TREATMNT segment for the most recent illness. First you build a TREATMNT segment in your I/O area:
19930302ESEDRIX 0040SMITH
Then you issue an ISRT call with the following SSAs. This adds a new occurrence of the TREATMNT segment as the first occurrence of the TREATMNT segment type among those with equal keys.
ISRT PATIENT (PATNO ILLNESS *L TREATMNT*F = 06439)
This example applies to HDAM or PHDAM root segments and to dependent segments for any type of database.
32
Command Codes
In this example, assume that RULES=LAST is specified in the DBD for the database on ILLNESS. Issue the call below to retrieve this information:
GU PATIENT (PATNO ILLNESS *L = 10345)
The first SSA gives IMS the number of the particular patient. The second SSA asks for the last occurrence (in this case, the first occurrence chronologically) of the ILLNESS segment for this patient. Inserting a Segment as the Last Occurrence: Use L with ISRT only when the segment has no key or a non unique key, and the insert rule for the segment is either FIRST or HERE. Using the L command code overrides both FIRST and HERE for HDAM or PHDAM root segments and dependent segments in any type of database. Using the L command code to override the RULES specification on the DBD applies only to the path (either logical or physical) that you are using to access the segment for the ISRT call. For example, if you are using the physical path to access the segment, the command code applies to the physical path but not to the logical path. For clarification of using command codes with the RULES specification, ask your database administrator.
REPL
Restriction: If you use D and N command codes together, IMS retrieves the segment but does not replace it. The N command code applies only to REPL calls, and IMS ignores it if you include the code in any other call.
Chapter 1. How Application Programs Work with the IMS Database Manager
33
Command Codes
If IMS cannot fully satisfy the call that uses P (for example, IMS returns a GE status code), but the level that includes P is satisfied, P is still valid. If IMS cannot fully satisfy the call including the level that contains P, IMS does not set any parentage. You would receive a GP (no parentage established) if you then issued a GNP. If you use P with a GNP call, IMS processes the GNP call with the parentage that was already set by preceding calls. IMS then resets parentage with the parentage you specified using P after processing the GNP call. Example: If you want to send a current bill to all of the patients seen during the month, the determining value is in the ILLNESS segment. You want to look at only patients whose ILLNESS segments have dates after the first of the month. For patients who have been to the clinic during the month, you need to look at their addresses and the amount of charges in the BILLING segment so that you can print a bill. For this example, assume the date is March 31, 1993. Issue the two calls below to process this information:
GN GNP PATIENT *PD ILLNESS (ILLDATE >=19930301) BILLING
After you locate a patient who has been to the clinic during the month, you issue the GNP call to retrieve that patients BILLING segment. Then you repeat the GN call to find each patient who has been to the clinic during the month, until IMS returns a GB status code.
34
Command Codes
treats the Q command code as a 2-byte string, where the second byte must be a letter (A-J). If the second byte is not a letter (A-J), IMS returns the status code AJ. Example: Suppose a customer wants to place an order for items 1, 2, and 3, but only if 50 item 1s, 75 item 2s, and 100 item 3s are available. Before placing this order, the program must examine all three item segments to determine whether an adequate number of each item is available. You do not want other application programs to change any of the segments until your program has determined this and, if possible, placed the order. To process this request for full function, your program uses the Q command code when it issues the Get calls for the item segments. When you use the Q command code in the SSA, you assign a lock class immediately following the command code in the SSA.
GU GU GU PART ITEM PART ITEM PART ITEM X 1 X 2 X 3 *QA *QA *QA
Exception: For Fast Path, the second byte of the lock class is not interpreted as lock class A. After retrieving the item segments, your program can examine them to determine whether an adequate number of each item are on hand to place the order. Assume 100 of each item are on hand. Your program then places the order and updates the database accordingly. To update the segment, your program issues a GHU call for each segment and follows it immediately with a REPL call:
GHU REPL GHU REPL GHU REPL ITEM ITEM ITEM ITEM ITEM ITEM 1 1 with the value 50 2 2 with the value 25 3 3 with the value 0
Using the DEQ Call with the Q Command Code: When you use the Q command code and the DEQ call, you reserve and release segments. For full function, to issue a DEQ call against an I/O PCB to release a segment, you place the letter designating the segments lock class in the first byte of an I/O area. Then, you issue the DEQ call with the name of the I/O area that contains the letter. A DEDB DEQ call is issued against a DEDB PCB. Because Fast Path does not support lock class, a DEDBDEQ call does not require that a lock class be specified in the I/O area. Restriction: The EXEC DL/I interface does not support DEDB DEQ calls, because EXEC DL/I disallows a PCB for DEQ calls. Retrieving Segments with Full-Function DEQ Calls: The DEQ call releases all segments that are retrieved using the Q command code, except: v Segments modified by your program, until your program reaches a commit point v Segments required to keep your position in the hierarchy, until your program moves to another database record v A class of segments that has been locked again as another class
Chapter 1. How Application Programs Work with the IMS Database Manager
35
Command Codes
If your program only reads segments, it can release them by issuing a DEQ call. If your program does not issue a DEQ call, IMS releases the reserved segments when your program reaches a commit point. By releasing them with a DEQ call before your program reaches a commit point, you make them available to other programs more quickly. Retrieving Buffers with Fast Path DEQ Calls: DEQ calls cause Fast Path to release a buffer that satisfies one of the following conditions: v The buffer has not been modified, or the buffer does not protect a valid root position. v The buffer has been protected by a Q command code. Fast Path returns an FW status code when no buffers can be released for a DEQ call. Any CI locking or segment-level locking performed with a Q command code is protected from other applications until a DEQ call is issued or a commit point is reached. Considerations for Root and Dependent Segments (Full Function Only): If you use the Q command code on a root segment, other programs in which the PCB does not have update capability can access the database record. Programs in which the PCB has update capability cannot access any of the segments in that database record. If you use the Q command code on a dependent segment, other programs can read the segment using one of the Get calls without the hold. If your program accesses shared databases, and if any of the segments in that block are reserved with the Q command code, application programs in other IMS systems cannot update anything in that block. The Q command code does not hold segments from one step of a conversation to another. Related Reading: For more information on the relationship between the Q command code and the DEQ call, see Reserving Segments for the Exclusive Use of Your Program on page 248.
As IMS satisfies each level in a retrieval or ISRT call, a position on the segment occurrence that satisfies that level is established. The U command code prevents position from being moved from a segment during a search of its hierarchic dependents. If the segment has a unique sequence field, using this code is equivalent to qualifying the SSA so that it is equal to the current value of the key field. When a call is being satisfied, if position is moved to a level above that at which the U code was issued, the code has no effect for the segment type whose parent changed position. U is especially useful when unkeyed dependents or non unique keyed segments are being processed. The position on a specific occurrence of an unkeyed or non unique keyed segment can be held by using this code. Example: Suppose you want to find out about the illness that brought a patient named Mary Warren to the clinic most recently, and about the treatments she received for that illness. Figure 22 shows the PATIENT, ILLNESS, and TREATMNT segments for Mary Warren.
36
Command Codes
To retrieve this information, retrieve the first ILLNESS segment and the TREATMNT segments associated with that ILLNESS segment. To retrieve the most recent ILLNESS segment, you can issue the following GU call:
GU PATIENT (PATNO ILLNESS *L = 05810
After this call, IMS establishes a position at the root level on the PATIENT segment with the key 05810 and on the last ILLNESS segment. Because other ILLNESS segments with the key 19860412 may exist, you can think of this one as the most recent ILLNESS segment. You might want to retrieve the TREATMNT segment occurrences that are associated with that ILLNESS segment. You can do this by issuing the GN call below with the U command code:
GN PATIENT *U ILLNESS *U TREATMNT
In this example, the U command code indicates to IMS that you want only TREATMNT segments that are dependents of the ILLNESS and PATIENT segments on which IMS has established position. Issuing the above GN call the first time retrieves the TREATMNT segment with the key of 19860412. Issuing the GN call the second time retrieves the TREATMNT segment with the key 19860418. If you issue the call a third time, IMS returns a not-found status code. The U command code tells IMS that, if it does not find a segment that satisfies the lower qualification under this parent, it cannot continue looking under other parents. If the U command code was not in the PATIENT SSA, the third GN call causes IMS to move forward at the root level in an attempt to satisfy the call. If you supply a U command code for a qualified SSA, IMS ignores the U. If used in conjunction with command code F or L, the U command code is disregarded at the level and all lower levels of SSAs for that call.
Chapter 1. How Application Programs Work with the IMS Database Manager
37
Command Codes
Did Joan Carter, patient number 07755, receive any treatment on March 3, 1993? Using qualified SSAs, specify the following call:
GU PATIENT (PATNO = 07755) ILLNESS (ILLDATE =19930303) TREATMNT
If you have position established on the PATIENT segment for patient number 07755 and on the ILLNESS segment for March 3, 1993, you can use your position to retrieve the TREATMNT segments in which you are interested. You do this by specifying the V command code as follows:
GN PATIENT ILLNESS *V TREATMNT
Using the V command code for a call is like establishing parentage and issuing a subsequent GNP call, except that the V command code sets the parentage for the call it is used with, not for subsequent calls. For example, to satisfy the previous request, you could have set parentage at the ILLNESS segment level and issued a GNP to retrieve any TREATMNT segments under that parent. With the V command code, you specify that you want the ILLNESS segment to be used as parentage for that call. You can specify the V command code for any parent segment. If you use the V command code with a qualified SSA, it is ignored for that level and for any higher level that contains a qualified SSA.
Using the null command code lets you use the same set of SSAs for more than one purpose. However, dynamically modifying SSAs makes debugging more difficult.
Sample Application
The examples in this section are based on one sample applicationthe recording of banking transactions for a passbook (savings account) account. The transactions are written to a database as either posted or unposted, depending on whether they were posted to the customers passbook. For example, when Bob Emery does business with the bank but forgets to bring in his passbook, an application program writes the transactions to the database as unposted. The application program sets a subset pointer to the first unposted transaction, so it can be easily accessed later. The next time Bob remembers to bring in his passbook, a program posts the transactions.
38
Command Codes
The program can directly retrieve the first unposted transaction using the subset pointer that was previously set. After the program has posted the transactions, it sets the subset pointer to 0. An application program that updates the database later will be able to tell that no unposted transactions exist. Figure 23 summarizes the processing that is performed when the passbook is unavailable and when it is available.
39
Command Codes
GU A B (AKEY *R1M1
If the current segment is the last in the chain, and you use an M command code, IMS sets the pointer to 0.
Figure 24. Moving the Subset Pointer to the Next Segment after Your Current Position
As shown by Figure 25 on page 41, this call retrieves segment B5. To continue processing segments in the chain, you can issue GN calls as you would if you were not using subset pointers.
40
Command Codes
If the subset does not exist (subset pointer 1 has been set to 0), IMS returns a GE status code, and your position in the database will be immediately following the last segment in the chain. Using the passbook example, the GE status code tells you that no unposted transactions exist.
You can specify only one R command code for each SSA. If you use more than one R in an SSA, IMS returns an AJ status code to your program. You can use R with other command codes, except F and Q. Other command codes in an SSA take effect after the R command code has been processed, and after position has been successfully established on the first segment in the subset. If you use the L and R command codes together, the last segment in the segment chain is retrieved. (If the subset pointer that was specified with the R command code, IMS returns a GE status code instead of the last segment in the segment chain.) Do not use the R and F command codes together. If you do, you will receive an AJ status code. The R command code overrides all insert rules, including LAST.
After you issue this call, instead of pointing to segment B5, subset pointer 1 points to segment B6, as shown in Figure 26 on page 42.
Chapter 1. How Application Programs Work with the IMS Database Manager
41
Command Codes
Figure 26. Unconditionally Setting the Subset Pointer to Your Current Position
As shown by Figure 27, this call sets subset pointer 1 to segment B5. If unposted transactions already exist, the subset pointer is not changed.
42
Command Codes
Figure 27. Conditionally Setting the Subset Pointer to Your Current Position
After this call, subset pointer 1 is set to 0, which indicates to a program that subsequently updates the database that no unposted transactions exist.
43
Command Codes
| | | | | | | | | | DFSIVA3 DFSIVA6 A Conversational MPP that accesses an HDAM/VSAM database. Transaction input and output is through MFS screens. A Batch or BMP program that accesses a HIDAM/OSAM database. The program uses GSAM to receive its transaction input and to display its transaction output.
These programs are fully installed and executed by the IVP. The IMS EXEC library also includes the REXX exec named DFSSUT04 EXEC. Use this exec to process any unexpected return codes or status codes. Related Reading: A full description of the IVP Sample Application is in the IMS Version 8: Installation Volume 1: Installation Verification.
44
Programming Guidelines
The number, type, and sequence of the IMS requests your program issues affects the efficiency of your program. A program that is poorly designed can still run if it is coded correctly. IMS will not find design errors for you. The suggestions that follow will help you develop the most efficient design possible for your application program. When you have a general sequence of calls mapped out for your program, look over the guidelines on sequence to see if you can improve it. An efficient sequence of requests results in efficient internal IMS processing. As you write your program, keep in mind the guidelines explained in this section. They will help you to write efficient and error-free programs. v Use the simplest call. Qualify your requests to narrow the search for IMS. v Use the request or sequence of requests that will give IMS the shortest path to the segment you want. v Use as few requests as possible. Each DL/I call your program issues uses system time and resources. You may be able to eliminate unnecessary calls by: Using path requests if you are replacing, retrieving, or inserting more than one segment in the same path. If you are using more than one request to do this, you are issuing unnecessary requests. Changing the sequence so that your program saves the segment in a separate I/O area, and then gets it from that I/O area the subsequent times it needs the segment. If your program retrieves the same segment more than once during program execution, you are issuing unnecessary requests. Anticipating and eliminating needless and nonproductive requests, such as requests that result in GB, GE, and II status codes. For example, if you are issuing GN calls for a particular segment type, and you know how many occurrences of that segment type exist, do not issue the GN that results in a GE status code. Keep track of the number of occurrences your program retrieves, and then continue with other processing when you know you have retrieved all the occurrences of that segment type. Issuing an insert request with a qualification for each parent, rather than issuing Get requests for the parents to make sure that they exist. If IMS returns a GE status code, at least one of the parents does not exist. When you are inserting segments, you cannot insert dependent segments unless the parent segments exist. v Keep the main section of the program logic together. For example, branch to conditional routines, such as error and print routines in other parts of the program, instead of branching around them to continue normal processing.
45
Programming Guidelines
v Use call sequences that make good use of the physical placement of the data. Access segments in hierarchic sequence as often as possible, and avoid moving backward in the hierarchy. v Process database records in order of the key field of the root segments. (For HDAM and PHDAM databases, this order depends on the randomizing routine that is used. Check with your DBA for this information.) v Avoid constructing the logic of the program and the structure of commands or calls in a way that depends heavily on the database structure. Depending on the current structure of the hierarchy reduces the programs flexibility. v Minimize the number of segments your program locks. You may need to take checkpoints to release the locks on updated segments and the lock on the current database record for each PCB your program uses. Each PCB used by your program has the current database record locked at share or update level. If this lock is no longer required, issuing the GU call, qualified at the root level with a greater-than operator for a key of X'FF' (high values), releases the current lock without acquiring a new lock. Using PCBs with a processing option of get (G) results in locks for the PCB at share level. This allows other programs that use the get processing option to concurrently access the same database record. Using a PCB with a processing option that allows updates (I, R, or D) results in locks for the PCB at update level. This does not allow any other program to concurrently access the same database record. Related Reading: For more information about segment locking, see Reserving Segments for the Exclusive Use of Your Program on page 248.
46
Checkpoint Considerations
v The type of Checkpoint call to use (basic or symbolic) v The identification to assign to each Checkpoint call, regardless of whether the Checkpoint call is basic or symbolic v If you are going to use the symbolic Checkpoint call, which areas of your program to checkpoint
Segment Considerations
v Whether the segment is fixed length or variable length v The length of the segment (the maximum length, if the segment is variable length) v The names of the fields that each segment contains v Whether the segment has a key field. If it does, is the key field unique or non unique? If it does not, what sequencing rule has been defined for it? (A segments key field is defined in the SEQ keyword of the FIELD statement in the DBD. The sequencing rule is defined in the RULES keyword of the SEGM statement in the DBD.) v The segments field layouts: The byte location of each field The length of each field The format of each field
Sample Programs
This section contains sample programs written in assembler language, C language, COBOL, Pascal, and PL/I. The programs are examples of how to code DL/I calls and data areas. They are not complete programs. Before running them, you must modify them to suit the requirements of your installation.
Chapter 2. Writing Your Application Programs
47
3 4
5 6
48
10
11
ASSEMBLER LANGUAGE INTERFACE Figure 28. Sample Assembler Language Program (Part 2 of 2)
Notes to Figure 28 on page 48: 1. The entry point to an assembler language program can have any name. Also, you can substitute CBLTDLI for ASMTDLI in any of the calls. 2. When IMS passes control to the application program, register 1 contains the address of a variable-length fullword parameter list. Each word in this list contains the address of a PCB that the application program must save. The high-order byte of the last word in the parameter list has the 0 bit set to a value of 1 which indicates the end of the list. The application program subsequently uses these addresses when it executes DL/I calls. 3. The program loads the address of the DETAIL DB PCB. 4. The program issues a GU call to the DETAIL database using a qualified SSA (SSANAME). 5. The program loads the address of the HALDB master PCB. 6. The next three calls that the program issues are to the HALDB master. The first is a GHU call that uses an unqualified SSA. The second is an unqualified GHN call. The REPL call replaces the segment retrieved using the GHN call with the segment in the MSTSEGIO area. You can use the parmcount parameter in DL/I calls in assembler language instead of the VL parameter, except for in the call to the sample status-code error routine. 7. The RETURN statement loads IMS registers and returns control to IMS. 8. The call functions are defined as four-character constants. 9. The program defines each part of the SSA separately so that it can modify the SSAs fields. 10. The program must define an I/O area that is large enough to contain the largest segment it is to retrieve or insert (or the largest path of segments if the program uses the D command code). This programs I/O areas are 100 bytes each.
49
Figure 29. Sample Call-Level Assembler Language Program (CICS Online) (Part 1 of 2)
50
* * *
* *
9,10
Figure 29. Sample Call-Level Assembler Language Program (CICS Online) (Part 2 of 2)
Notes to the example: 1. The program must define an I/O area that is large enough to contain the largest segment it is to retrieve or insert (or the largest path of segments if the program uses the D command code). 2. The DLIUIB statement copies the UIB DSECT, which is expanded as shown under Specifying the UIB (CICS Online Programs Only) on page 96. 3. A fullword must be defined for each DB PCB. The assembler language program can access status codes after a DL/I call by using the DB PCB base addresses. 4. This is an unqualified SSA. For qualified SSAs, define each part of the SSA separately so that the program can modify the SSAs fields. 5. This call schedules the PSB and obtains the PSB address. 6. This call retrieves a segment from the database.
51
7. CICS online programs must check the return code in the UIB before checking the status code in the DB PCB. 8. The REPL call replaces the data in the segment that was retrieved by the most recent Get Hold call. The data is replaced by the contents of the I/O area referenced in the call. 9. This call releases the PSB. 10. The RETURN statement loads IMS registers and returns control to IMS.
52
/* /* /*
*/ */ */
8 9 10 11 12 13
Notes to Figure 30: 1. The env(IMS) establishes the correct operating environment and the plist(IMS) establishes the correct parameter list when invoked under IMS. The ims.h header file contains declarations for PCB layouts, __pcblist, and the ctdli routine. The PCB layouts define masks for the PCBs that the program uses as structures. These definitions make it possible for the program to check fields in the PCBs. The stdio.h header file contains declarations for sprintf (used to build up the SSA). 2. After IMS has loaded the application programs PSB, IMS gives control to the application program through this entry point. 3. The C run-time sets up the __pcblist values. The order in which you refer to the PCBs must be the same order in which they have been defined in the PSB. (Values other than 10 and 20 can be used, according to the actual key lengths needed.) These declarations can be done using macros, such as:
#define IO_PCB (IO_PCB_TYPE *) (__pcblist[0]) #define mast_PCB (__pcblist[1]) #define detail_PCB (__pcblist[2])
This example assumes that an I/O PCB was passed to the application program. When the program is a batch program, CMPAT=YES must be specified on the PSBGEN statement of PSBGEN so that the I/O PCB is included. Because the I/O PCB is required for a batch program to make system service calls, CMPAT=YES should always be specified for batch programs. 4. Each of these areas defines one of the call functions used by the batch program. Each character string is defined as four alphanumeric characters, with a value assigned for each function. (If the [4]s had been left out, 5 bytes would have been reserved for each constant.) You can define other constants in the same way. Also, you can store standard definitions in a source library and include them by using a #include directive.
Chapter 2. Writing Your Application Programs
53
8. This call retrieves data from the database. It contains a qualified SSA. Before you can issue a call that uses a qualified SSA, initialize the data field of the SSA. Before you can issue a call that uses an unqualified SSA, initialize the segment name field. Unlike the COBOL, PL/I, and Pascal interface routines, ctdli also returns the status code as its result. (Blank is translated to 0.) So, you can code:
switch (ctdli(....)) { case 0: ... /* everything ok */ break; case AB: .... break; case IX: ... break; default:
You can pass only the PCB pointer for DL/I calls in a C program. 9. This is another call with a qualified SSA. 10. This call is an unqualified call that retrieves data from the database. Because it is a Get Hold call, it can be followed by REPL or DLET. 11. The REPL call replaces the data in the segment that was retrieved by the most recent Get Hold call. The data is replaced by the contents of the I/O area that is referenced in the call. 12. The end of the main routine (which can be done by a return statement or exit call) returns control to IMS. 13. IMS provides a language interface module (DFSLI000), which gives a common interface to IMS. This module must be made available to the application program at link-edit time.
54
PICTURE XXXX VALUE GU . PICTURE XXXX VALUE GHU . PICTURE XXXX VALUE GHN . PICTURE XXXX VALUE GHN . PICTURE XXXX VALUE GNP . PICTURE XXXX VALUE GHNP. PICTURE XXXX VALUE REPL. PICTURE XXXX VALUE ISRT. PICTURE XXXX VALUE DLET. PICTURE S9(5)VALUE +4 COMPUTATIONAL. PICTURE X(08) VALUE PICTURE X VALUE . PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE X(08) X X(08) X(02) X(06) X X(08) X X(08) X(02) X(06) X VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE . 2
PICTURE X(10). PICTURE XX. PICTURE X(20). PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE PICTURE X(8). XX. XX. XXXX. S9(5) COMPUTATIONAL. X(8). S9(5) COMPUTATIONAL. S9(5) COMPUTATIONAL. XX. X(8). XX. XX. XXXX. S9(5) COMPUTATIONAL. X(8). S9(5) COMPUTATIONAL. S9(5) COMPUTATIONAL. XX. 5
55
10 11 12
Notes to Figure 31: 1. You define each of the DL/I call functions the program uses with a 77-level or 01-level working storage entry. Each picture clause is defined as four alphanumeric characters and has a value assigned for each function. If you want to include the optional parmcount field, you can initialize count values for each type of call. You can also use a COBOL COPY statement to include these standard descriptions in the program. 2. A 9-byte area is set up for an unqualified SSA. Before the program issues a call that requires an unqualified SSA, it moves the segment name to this area. If a call requires two or more SSAs, you may need to define additional areas. 3. A 01-level working storage entry defines each qualified SSA that the application program uses. Qualified SSAs must be defined separately, because the values of the fields are different. 4. A 01-level working storage entry defines I/O areas that are used for passing segments to and from the database. You can further define I/O areas with 02-level entries. You can use separate I/O areas for each segment type, or you can define one I/O area that you use for all segments. 5. A 01-level linkage section entry defines a mask for each of the PCBs that the program requires. The DB PCBs represent both input and output databases. After issuing each DL/I call, the program checks the status code through this linkage. You define each field in the DB PCB so that you can reference it in the program. 6. This is the standard procedure division statement of a batch program. After IMS has loaded the PSB for the program, IMS passes control to the application program. The PSB contains all the PCBs that are defined in the PSB. The coding of USING on the procedure division statement references each of the PCBs by the names that the program has used to define the PCB masks in the linkage section. The PCBs must be listed in the order in which they are defined in the PSB.
56
57
4,5
* * * *
10
* * * *
11,12
Notes to example: 1. You define each of the DL/I call functions the program uses with a 77-level or 01-level working storage entry. Each picture clause is defined as four alphanumeric characters and has a value assigned for each function. If you
58
59
3 4
5,6 7
10
Figure 32. Sample Call-Level OS/V COBOL program (CICS Online) (Part 1 of 2)
60
11
* *
12,13
Figure 32. Sample Call-Level OS/V COBOL program (CICS Online) (Part 2 of 2)
Notes to Figure 32: 1. You define each of the DL/I call functions the program uses with a 77-level or 01-level working storage entry. Each picture clause is defined as four alphanumeric characters and has a value assigned for each function. If you want to include the optional parmcount field, you can initialize count values for each type of call. You can also use the COBOL COPY statement to include these standard descriptions in the program. 2. A 9-byte area is set up for an unqualified SSA. Before the program issues a call that requires an unqualified SSA, it can either initialize this area with the segment name or move the segment name to this area. If a call requires two or more SSAs, you may need to define additional areas. 3. An 01-level working storage entry defines I/O areas that are used for passing segments to and from the database. You can further define I/O areas with 02-level entries. You can use separate I/O areas for each segment type, or you can define one I/O area to use for all segments. 4. The linkage section must start with a definition of this type to provide addressability to a parameter list that will contain the addresses of storage that is outside the working storage of the application program. The first 02-level definition is used by CICS to provide addressability to the other fields in the list. A one-to-one correspondence exists between the other 02-level names and the 01-level data definitions in the linkage section. 5. The COPY DLIUIB statement will be expanded as shown in Figure 38 on page 98. 6. The UIB returns the address of an area that contains the PCB addresses. The definition of PCB pointers is necessary to obtain the actual PCB addresses. Do not alter the addresses in the area. 7. The PCBs are defined in the linkage section. 8. The PCB call schedules a PSB for your program to use. 9. This unqualified GHU call retrieves a segment from the database and places it in the I/O area that is referenced by the call. Before issuing the call, the program must initialize the key or data value of the SSA so that it specifies the particular segment to be retrieved. 10. CICS online programs should test the return code in the UIB before testing the status code in the DB PCB.
61
Establishing Addressability in a COBOL Program: The Optimization Feature (CICS Online Only)
If you use the OS/VS COBOL compiler (5740-CB1) with the OPTIMIZE feature, you must use the SERVICE RELOAD compiler control statement in your program to ensure addressability to areas that are defined in the LINKAGE SECTION. If you use the IBM COBOL for MVS & VM (or VS COBOL II) compiler, the SERVICE RELOAD statement is not required. The format of the SERVICE RELOAD statement is:
SERVICE RELOAD fieldname
fieldname is the name of a storage area defined in a 01-level statement in the LINKAGE SECTION. Use the SERVICE RELOAD statement after each statement that modifies addressability to an area in the LINKAGE SECTION. Include the SERVICE RELOAD statement after the label if the statement might cause a branch to another label. If you specify NOOPTIMIZE when compiling your program, you do not need to use the SERVICE RELOAD statement. However, use this statement to ensure that the program will execute correctly if it is compiled using the OPTIMIZE option. For more information on using the SERVICE RELOAD statement, see CICS/ESA Application Programmers Reference.
62
6 7
63
10
11 12 13 14
Notes to Figure 33: 1. Define the name of the Pascal compile unit. 2. Define the data types that are needed for the PCBs used in your program. 3. Define the PCB data type that is used in your program. 4. Declare the procedure heading for the REENTRANT procedure that is called by IMS. The first word in the parameter list should be an INTEGER, which is reserved for VS Pascals usage. The rest of the parameters are the addresses of the PCBs that are received from IMS. 5. Define the data types that are needed for the SSAs and I/O areas. 6. Declare the variables used for the I/O areas. 7. Define the constants, such as function codes and SSAs that are used in the PASTDLI DL/I calls. 8. Declare the IMS interface routine by using the GENERIC directive. GENERIC identifies external routines that allow multiple parameter list formats. A GENERIC routines parameters are declared only when the routine is called. 9. This call retrieves data from the database. It contains a qualified SSA. Before you can issue a call that uses a qualified SSA, you must initialize the data field of the SSA. Before you can issue a call that uses an unqualified SSA, you must initialize the segment name field. 10. This is another call that has a qualified SSA. 11. This call is an unqualified call that retrieves data from the database. Because it is a Get Hold call, it can be followed by a REPL or DLET call. 12. The REPL call replaces the data in the segment that was retrieved by the most recent Get Hold call; the data is replaced by the contents of the I/O area that is referenced in the call. 13. You return control to IMS by exiting from the PASCIMS procedure. You can also code a RETURN statement to exit at another point. 14. You must link-edit your program to the IMS language interface module, DFSLI000, after compiling your program.
64
65
DCL 1
*/ */ */
7 8 9 10 11
12
Notes to Figure 34: 1. After IMS has loaded the application programs PSB, IMS gives control to the application program through this entry point. PL/I programs must pass the pointers to the PCBs, not the names, in the entry statement. The entry statement lists the PCBs that the program uses by the names that it has assigned to the definitions for the PCB masks. The order in which you refer to the PCBs in the entry statement must be the same order in which they have been defined in the PSB. The example in Figure 34 on page 65 assumes that an I/O PCB was passed to the application program. When the program is a batch program, CMPAT=YES must be specified on the PSBGEN statement of PSBGEN so that the I/O PCB is included. Because the I/O PCB is required for a batch program to make system service calls, CMPAT=YES should always be specified for batch programs. 2. Each of these areas defines one of the call functions used by the batch program. Each character string is defined as four alphanumeric characters,
66
7. This call retrieves data from the database. It contains a qualified SSA. Before you can issue a call that uses a qualified SSA, initialize the data field of the SSA. Before you can issue a call that uses an unqualified SSA, initialize the segment name field. Check the status code after each DL/I call that you issue. Although you must declare the PCB parameters that are listed in the entry statement to a PL/I program as POINTER data types, you can pass either the PCB name or the PCB pointer in DL/I calls in a PL/I program. 8. This is another call that has a qualified SSA. 9. This is an unqualified call that retrieves data from the database. Because it is a Get Hold call, it can be followed by REPL or DLET. 10. The REPL call replaces the data in the segment that was retrieved by the most recent Get Hold call; the data is replaced by the contents of the I/O area referenced in the call. 11. The RETURN statement returns control to IMS. 12. IMS provides a language interface module (DFSLI000) which gives a common interface to IMS. This module must be link-edited to the program. If you use the IMS-supplied procedures (IMSPLI or IMSPLIGO), IMS link-edits the language interface module to the application program. IMSPLI is a two-step procedure that compiles and links your program. IMSPLIGO is a three-step procedure that compiles, link-edits, and executes your program in a DL/I batch region. For information on how to use these procedures, see IMS Version 8: Installation Volume 2: System Definition and Tailoring. Related Reading: For more information on installing CICS application programs, see CICS/MVS Installation Guide.
67
3 4 5 6
8 9
10
68
11 12
Notes to Figure 35: 1. Each of these areas defines the DL/I call functions the program uses. Each character string is defined as four alphanumeric characters and has a value assigned for each function. You can define other constants in the same way. You can store standard definitions in a source library and include them by using a %INCLUDE statement. 2. A structure definition defines each SSA the program uses. The unaligned attribute is required for SSAs. The SSA character string must reside contiguously in storage. If a call requires two or more SSAs, you may need to define additional areas. 3. The %INCLUDE DLIUIB statement will be expanded as shown in Figure 38 on page 98. 4. The UIB returns the address of an area containing the PCB addresses. The definition of PCB pointers is necessary to obtain the actual PCB addresses. Do not alter the addresses in the area. 5. The I/O areas that are used to pass segments to and from the database are defined as structures. 6. The PCBs are defined based on the addresses that are passed in the UIB. 7. The PCB call schedules a PSB for your program to use. 8. This unqualified GHU call retrieves a segment from the database. The segment is placed in the I/O area that is referenced in the call. Before issuing the call, the program must initialize the key or data value of the SSA so that it specifies the particular segment to be retrieved. 9. CICS online programs must test the return code in the UIB before testing the status code in the DB PCB. 10. The REPL call replaces the segment that was retrieved in the most recent Get Hold call. The I/O area that is referenced in the call contains the segment to be replaced. 11. The TERM call terminates the PSB that the program scheduled earlier. 12. The program issues the EXEC CICS RETURN statement when it has finished processing.
69
70
v Specifying the UIB (CICS Online Programs Only) on page 96 v Specifying the I/O Areas on page 99 v v v v v Segment Search Arguments on page 100 GSAM Data Areas on page 104 The AIBTDLI Interface on page 105 Specifying the Language Specific Entry Point on page 106 PCB Lists on page 109
v The AERTLDI interface on page 110 v Language Environment on page 111 v Special DL/I Situations on page 112 Related Reading: For detailed information on specific parameters for the DL/I calls, see Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143.
71
Format
CALL (2) ,db pcb ,tp pcb <C> aib <A> <B> <A> <A> <B>
ASMTDLI,( parmcount,
(1)
function
(1)
function,
(2)
<A>:
,i/o area , ,ssa ,token ,stat function ,rsa ,rootssa
<B>:
,i/o area length, i/o area , ,area length,area
<C>:
,psb name, uibptr ,sysserve
72
Parameters
parmcount Specifies the address of a 4-byte field in user-defined storage that contains the number of parameters in the parameter list that follows parmcount. Assembler language application programs must use either parmcount or VL. function Specifies the address of a 4-byte field in user-defined storage that contains the call function. The call function must be left-justified and padded with blanks (such as GU ). db pcb Specifies the address of the database PCB to be used for the call. The PCB address must be one of the PCB addresses passed on entry to the application program in the PCB list. tp pcb Specifies the address of the I/O PCB or alternate PCB to be used for the call. The PCB address must be one of the PCB addresses passed on entry to the application program in the PCB list. aib Specifies the address of the application interface block (AIB) in user-defined storage. For more information on AIB, see The AIBTDLI Interface on page 105. i/o area Specifies the address of the I/O area in user-defined storage that is used for the call. The I/O area must be large enough to contain the returned data. i/o area length Specifies the address of a 4-byte field in user-defined storage that contains the I/O area length (specified in binary). area length Specifies the address of a 4-byte field in user-defined storage that contains the length (specified in binary) of the area immediately following it in the parameter list. Up to seven area lengths or area pairs can be specified. area Specifies the address of the area in user-defined storage to be checkpointed. Up to seven area lengths or area pairs can be specified. token Specifies the address of a 4-byte field in user-defined storage that contains a user token. stat function Specifies the address of a 9-byte field in user-defined storage that contains the stat function to be performed. ssa Specifies the address in user-defined storage that contains the SSAs to be used for the call. Up to 15 SSAs can be specified, one of which is rootssa.
Chapter 3. Defining Application Program Elements
73
Format
(1) rc=CTDLI( parmcount, function ,db pcb ,tp pcb <A> <A> <B> <C> (2) rc=AIBTDLI( parmcount , function, (1) aib <A> <B> (1) CEETDLI( parmcount, function ,db pcb <A> ,i/o pcb <A> <B> ,aib <A> <B> );
74
<B>:
,i/o area length, i/o area , ,area length,area
<C>:
,psb name, uibptr ,sysserve
Notes: 1 See Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143 for descriptions of call functions and parameters. For AIBTDLI, parmcount is required for C applications.
Parameters
rc This parameter receives the DL/I status or return code. It is a two-character field shifted into the 2 low-order bytes of an integer variable (int). If the status code is two blanks, 0 is placed in the field. You can test the rc parameter with an if statement. For example, if (rc == 'IX'). You can also use rc in a switch statement. You can choose to ignore the value placed in rc and use the status code returned in the PCB instead. parmcount Specifies the name of a fixed binary (31) variable in user-defined storage that contains the number of parameters in the parameter list that follows parmcount. function Specifies the name of a character (4) variable, left justified in user-defined storage, that contains the call function to be used. The call function must be left-justified and padded with blanks (such as GU ). | | | db pcb Specifies the name of a pointer variable that contains the address of the database to be used for the call. The PCB address must be one of the PCB addresses passed on entry to the application program in the PCB list. tp pcb Specifies the name of a pointer variable that contains the address of the I/O PCB or alternate PCB to be used for the call. The PCB address must be one of the PCB addressed passed on entry to the application program in the PCB list.
Chapter 3. Defining Application Program Elements
75
76
I/O Area
In C, the I/O area can be of any type, including structures or arrays. The ctdli declarations in ims.h do not have any prototype information, so no type checking of the parameters is done. The area may be auto, static, or allocated (with malloc or calloc). You need to give special consideration to C-strings because DL/I does not recognize the C convention of terminating strings with nulls ('\0') Instead of the usual strcpy and strcmp functions, you may want to use memcpy and memcmp.
Format
CALL (1) ,db pcb ,tp pcb <C> aib <A> <B> <A> <A> <B> <A> <B> <A> <A> <B>
'CBLTDLI' USING
parmcount,
function
'AIBTDLI' USING
parmcount,
function,
(1)
'CEETDLI' USING
parmcount,
function
77
<B>:
,i/o area length, i/o area , ,area length,area
<C>:
,psb name, uibptr ,sysserve
Notes: 1 See Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143 for descriptions of call functions and parameters.
Parameters
parmcount Specifies the identifier of a usage binary (4) byte data item in user-defined storage that contains the number of parameters in the parameter list that follows parmcount. function Specifies the identifier of a usage display (4) byte data item, left justified in user-defined storage that contains the call function to be used. The call function must be left-justified and padded with blanks (such as GU ). | | | | | | db pcb Specifies the identifier of the database PCB group item from the PCB list that is passed to the application program on entry. This identifier will be used for the call. tp pcb Specifies the identifier of the I/O PCB or alternate PCB group item from the PCB list that is passed to the application program on entry. This identifier will be used for the call. aib Specifies the identifier of the group item that defines the application interface block (AIB) in user-defined storage. For more information on the AIB, see The AIBTDLI Interface on page 105. i/o area Specifies the identifier of a major group item, table, or usage display data item
78
79
Format
PASTDLI ( <A> ,VAR ,VAR db pcb tp pcb <B> <B> <C> AIBTDLI ( <A> , <D> VAR aib, <B> <C> );
<A>:
(1) CONST CONST parmcount , function
<B>:
,VAR i/o area , ,VAR ssa ,CONST token ,CONST stat function ,VAR rsa ,VAR rootssa
<C>:
,VAR i/o area length, VAR i/o area , ,VAR area length,VAR area
<D>:
,VAR psb name, VAR uibptr ,VAR sysserve
Notes: 1 See Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143 for descriptions of call functions and parameters.
80
Parameters
parmcount Specifies the name of a fixed binary (31) variable in user-defined storage that contains the number of parameters in the parameter list that follows parmcount. function Specifies the name of a character (4) variable, left justified in user-defined storage, that contains the call function to be used. The call function must be left-justified and padded with blanks (such as GU ). db pcb Specifies the name of a pointer variable that contains the address of the database PCB defined in the call procedure statement. | | tp pcb Specifies the name of a pointer variable that contains the address of the I/O PCB or alternate PCB defined in the call procedure statement. aib Specifies the name of the pointer variable that contains the address of the structure that defines the application interface block (AIB) in user-defined storage. For more information on the AIB, see The AIBTDLI Interface on page 105. i/o area Specifies the name of a pointer variable to a major structure, array, or character string that defines the I/O area in user-defined storage used for the call. The I/O area must be large enough to contain all of the returned data. i/o area length Specifies the name of a fixed binary (31) variable in user-defined storage that contains the I/O area length. area length Specifies the name of a fixed binary (31) variable in user-defined storage that contains the length of the area immediately following it in the parameter list. Up to seven area lengths or area pairs can be specified. area Specifies the name of the pointer variable that contains the address of the structure that defines the user-defined storage to be checkpointed. Up to seven area lengths or area pairs can be specified. token Specifies the name of a character (4) variable in user-defined storage that contains a user token. stat function Specifies the name of a character (9) variable in user-defined storage that contains the stat function to be performed. ssa Specifies the name of a character variable in user-defined storage that contains the SSAs to be used for the call. Up to 15 SSAs can be specified, one of which is rootssa. rootssa Specifies the name of a character variable that defines the root segment search argument in user-defined storage.
81
Format
CALL PLITDLI ( parmcount, function ,db pcb ,tp pcb <A> <A> <B> <C> AIBTDLI ( parmcount, function, aib <A> <B> (1) CEETDLI ( parmcount, function ,db pcb ,tp pcb <A> <A> <B> ,aib <A> <B>
82
<A>:
,i/o area , ,ssa ,token ,stat function ,rsa ,rootssa
<B>:
,i/o area length, i/o area , ,area length,area
<C>:
,psb name, uibptr ,sysserve
Notes: 1 See Chapter 4, Writing DL/I Calls for Database Management on page 115 and Chapter 5, Writing DL/I Calls for System Services on page 143 for descriptions of call functions and parameters.
Parameters
parmcount Specifies the name of a fixed binary (31-byte) variable that contains the number of arguments that follow parmcount. function Specifies the name of a fixed-character (4-byte) variable left-justified, blank padded character string containing the call function to be used (such as GU ). db pcb Specifies the structure associated with the database PCB to be used for the call. This structure is based on a PCB address that must be one of the PCB addresses passed on entry to the application program. tp pcb Specifies the structure associated with the I/O PCB or alternate PCB to be used for the call. aib Specifies the name of the structure that defines the AIB in your application program. For more information on the AIB, see The AIBTDLI Interface on page 105.
83
84
FF PCBs
MSDB PCBs
DEDB PCBs
I/O PCBs X
GSAM PCBs
X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
X X X X X
X X X X X
2 on
page 86
STAT3 on
page 86
SYNC TERM
page 86
XRST
85
Byte Length 8 2 2
DB/DC X X X
DBCTL
DCCTL X X
DB Batch
TM Batch
4-Byte Local date and time 4 Date Time Input message sequence number 5 Message output descriptor name 6 Userid
7 8 9
2 2 4 8 8 8
X X X X X X
X X X X X X
Group name
4 6 2 1 3
X X X X
X X X X
86
87
88
89
Byte Length 8 2 2 4 4 8 4
7 on page 91
DB/DC X X X X X X X X X
DBCTL X X X X X X X X X
DCCTL
DB Batch X X X X X X X X X
TM Batch
5 on
Segment name
page 91
6 on
4 var length
Notes: 1. Database Name This contains the name of the database. This field is 8 bytes long and contains character data. 2. Segment Level Number This field contains numeric character data. It is 2 bytes long and right-justified. When IMS retrieves the segment you have requested, IMS places the level number of that segment in this field. If you are retrieving several segments in a hierarchic path with one call, IMS places the number of the lowest-level segment retrieved. If IMS is unable to find the segment that you request, it gives you the level number of the last segment it encounters that satisfied your call. 3. Status Code After each DL/I call, this field contains the two-character status code that describes the results of the DL/I call. IMS updates this field after each call and does not clear it between calls. The application program should test this field after each call to find out whether the call was successful. When the program is initially scheduled, this field contains a data-availability status code, which indicates any possible access constraint based on segment sensitivity and processing options. Related Reading: For more information on these status codes, seeINIT Call on page 153. During normal processing, four categories of status codes exist: v Successful or exceptional but valid conditions. If the call was completely successful, this field contains blanks. Many of the codes in this category are for information only. For example, GB means that IMS has reached the end of the database without satisfying the call. This situation is expected in sequential processing and is not usually the result of an error.
90
91
Byte Length 8 4 8 8 16 4 4 12 4 4 4 4 48
DB/DC X X X X
DBCTL X X X X
DCCTL X X X X
DB Batch X X X X
TM Batch X X X X
Reserved 5 on page 93 Maximum output area length 6 on page 93 Output area length used 7 on page 93 Reserved 8 on page 93 Return code
9 on page 93 10 on page 93 11
X X
X X
X X
X X
X X
X X X X
X X
X X X
X X
X X
Reason code
on page 93
12 on
Reserved 13 on page 93
Notes: 1. AIB Identifier (AIBID) This 8-byte field contains the AIB identifier. You must initialize AIBID in your application program to the value DFSAIB before you issue DL/I calls. This field is required. When the call is completed, the information returned in this field is unchanged. 2. DFSAIB Allocated Length (AIBLEN) This field contains the actual 4-byte length of the AIB as defined by your program. You must initialize AIBLEN in your application program before you issue DL/I calls. The minimum length required is 128 bytes. When the call is completed, the information returned in this field is unchanged. This field is required. 3. Subfunction Code (AIBSFUNC)
92
93
Notes: 1. AIB Identifier (AIBID) This 8-byte field contains the AIB identifier. You must initialize AIBID in your application program to the value DFSAIBbb before you issue DL/I calls. This field is required. When the call is completed, the information returned in this field is unchanged. 2. DFSAIB Allocated Length (AIBLEN) This field contains the actual 4-byte length of the AIB as defined by your program. You must initialize AIBLEN in your application program before you issue DL/I calls. The minimum length required is 264 bytes for ODBA. When the call is completed, the information returned in this field is unchanged. This field is required. 3. Subfunction Code (AIBSFUNC) This 8-byte field contains the subfunction code for those calls that use a subfunction. You must initialize AIBSFUNC in your application program before you issue DL/I calls. When the call is completed, the information returned in this field is unchanged. 4. Resource Name (AIBRSNM1) #1 This 8-byte field contains the name of a resource. The resource varies depending on the call. You must initialize AIBRSNM1 in your application
94
5.
6. 7.
8.
9.
10. Return code (AIBRETRN) When the call is completed, this 4-byte field contains the return code. 11. Reason Code (AIBREASN) 12. When the call is completed, this 4-byte field contains the reason code. Error Code Extension (AIBERRXT) This 4-byte field contains additional error information depending on the return code in AIBRETRN and the reason code in AIBREASN. Resource Address (AIBRSA1) #1 When the call is completed, this 4-byte field contains call-specific information. For PCB related calls where the AIB is used to pass the PCB name instead of passing the PCB address in the call list, this field returns the PCB address. Resource Address (AIBRSA2) #2 This 4-byte field is reserved for ODBA. Resource Address (AIBRSA3) #3 This 4-byte token, returned on the APSB call, is required for subsequent DLI calls and the DPSB call related to this thread. Reserved This 40-byte field is reserved.
13.
14. 15.
16.
17. Reserved for ODBA This 136-byte field is reserved for ODBA The application program can use the returned PCB address, when available, to inspect the status code in the PCB and to obtain any other information needed by the application program.
95
AIB Examples
COBOL AIB Example
01 AIB 02 AIBRID 02 AIBRLEN 02 AIBRSFUNC 02 AIBRSNM1 02 AIBRSNM2 02 AIBRESV1 02 AIBOALEN 02 AIBOAUSE 02 AIBRESV2 02 AIBRETRN 02 AIBREASN 02 AIBERRXT 02 AIBRESA1 02 AIBRESA2 02 AIBRESA3 02 AIBRESV4 02 AIBRSAVE 02 AIBRTOKN 02 AIBRTOKC 02 AIBRTOKV 02 AIBRTOKA PIC x(8). PIC 9(9) USAGE BINARY. PIC x(8). PIC x(8). PIC x(8). PIC x(8). PIC 9(9) USAGE BINARY. PIC 9(9) USAGE BINARY. PIC x(12). PIC 9(9) USAGE BINARY. PIC 9(9) USAGE BINARY. PIC 9(9) USAGE BINARY. USAGE POINTER. USAGE POINTER. USAGE POINTER. PIC x(40). OCCURS 18 TIMES USAGE POINTER. OCCURS 6 TIMES USAGE POINTER. PIC x(16). PIC x(16). OCCURS 2 TIMES PIC 9(9) USAGE BINARY.
AIBRETRN AIBREASN AIBRRXT AIBRSA1 AIBRSA2 AIBRSA3 AIBLL AIBSAVE AIBTOKN AIBTOKC AIBTOKV AIBTOKA AIBAERL
96
01
PCB-ADDRESSES. 02 PCB-ADDRESS-LIST USAGE IS POINTER OCCURS 10 TIMES. 01 PCB1. 02 PCB1-DBD-NAME PIC X(8). 02 PCB1-SEG-LEVEL PIC XX. . . .
Figure 36. Defining the UIB, PCB Address List, and the PCB Mask for VS COBOL II
Figure 37 provides an example of using the COPY DLIUIB statement in an OS/VS COBOL program.
97
Figure 37. Defining the UIB, PCB Address List, and the PCB Mask for OS/VS COBOL
03
The values placed in level 88 entries are not printable. They are described in Chapter 17, CICS-DL/I User Interface Block Return Codes on page 295. The meanings of the field names and their hexadecimal values are shown below: FCNORESP Normal response X'00' FCNOTOPEN Not open X'0C' FCINVREQ Invalid request X'08' FCINVPCB Invalid PCB X'10'
98
Figure 39. Defining the UIB, PCB Address List, and the PCB Mask for PL/I
assembler language.
DLIUIB UIB UIBPCBAL UIBRCODE UIBFCTR UIBDLTR UIBLEN DSECT DS DS DS DS DS DS DS EQU 0F A 0XL2 X X 2X 0F *-UIB EXTENDED CALL USER INTFC BLK PCB ADDRESS LIST DL/I RETURN CODES RETURN CODE ADDITIONAL INFORMATION RESERVED LENGTH IS FULLWORD MULTIPLE LENGTH OF UIB
Figure 40. Defining the UIB, PCB Address List, and the PCB Mask for Assembler Language
99
100
The comparative value follows the relational operator. The length of this value must be equal to the length of the field that you specified in the field name. This length is defined in the DBD. The comparative value must include leading zeros for numeric values or trailing blanks for alphabetic values as necessary. v If you are using multiple qualification statements within one SSA (Boolean qualification statements), the qualification statements must be separated by one of these symbols: * or & Dependent AND + or | # Logical OR Independent AND
One of these symbols must appear between the qualification statements that the symbol connects. v The last qualification statement must be followed by a right parenthesis.
101
You can use an SSA that is coded like this for each DL/I call that needs an unqualified SSA by supplying the name of the segment type you want during program execution. Note that the string size declarations are such that the C null terminators do not appear within the structure. You can, of course, declare this as a single string:
const char unqual_ssa[] = "NAME "; /* 8 chars + 1 blank */
DL/I ignores the trailing null characters. You can define SSAs in any of the ways explained for the I/O area. The easiest way to create a qualified SSA is using the sprintf function. However, you can also define it using a method similar to that used by COBOL or PL/I. The following is an example of a qualified SSA without command codes. To use command codes with this SSA, code the asterisk (*) and command codes between the 8-byte segment name field and the left parenthesis that begins the qualification statement.
struct { seg_name char[8]; seg_qual char[1]; seg_key_name char[8]; seg_opr char[2]; seg_key_value char[n]; seg_end_char char[1]; } qual_ssa = {"ROOT ", "(", "KEY
Another way is to define the SSA as a string, using sprintf. Remember to use the preprocessor directive #include <stdio.h>.
char qual_ssa[8+1+8+2+6+1+1]; /* the final 1 is for the */ /* trailing \0 of string */ sprintf(qual_ssa, "%-8.8s(%-8.8s%2.2s%-6.6s)", "ROOT", "KEY", "=", "vvvvv");
Alternatively, if only the value were changing, the sprintf call can be:
sprintf(qual_ssa, "ROOT (KEY =%-6.6s)", "vvvvv"); /* 12345678 12345678 */
These SSAs are both taken from the C skeleton program shown in Figure 30 on page 52. To see how the SSAs are used in DL/I calls, refer to that program.
102
By supplying the name of the segment type you want during program execution, you can use an SSA coded like the one in this example for each DL/I call that needs an unqualified SSA. Use a 01 level working storage entry to define each SSA that the program is to use. Then use the name you have given the SSA as the parameter in the DL/I call, in this case:
UNQUAL-SSA,
The following SSA is an example of a qualified SSA that does not use command codes. If you use command codes in this SSA, code the asterisk (*) and the command code between the 8-byte segment name field and the left parenthesis that begins the qualification statement.
DATA DIVISION. WORKING-STORAGE SECTION. . . . 01 QUAL-SSA-MAST. 02 SEG-NAME-M PICTURE 02 BEGIN-PAREN-M PICTURE 02 KEY-NAME-M PICTURE 02 REL-OPER-M PICTURE 02 KEY-VALUE-M PICTURE 02 END-PAREN-M PICTURE
These SSAs are both taken from the COBOL skeleton program in Figure 31 on page 55. To see how they are used in a DL/I call, refer to that program.
The SSA below is an example of a qualified SSA that does not use command codes. If you use command codes in this SSA, code the asterisk (*) and the command code between the 8-byte segment name field and the left parenthesis that begins the qualification statement.
type STRUCT = record SEG_NAME SEG_QUAL : ALFA; : CHAR;
Chapter 3. Defining Application Program Elements
103
You can use an SSA that is coded like this for each DL/I call that needs an unqualified SSA by supplying the name of the segment type you want during program execution. In PL/I you define SSAs in structure declarations. The unaligned attribute is required for SSA data interchange with IMS. The SSA character string must reside contiguously in storage. For example, assignment of variable key values might cause IMS to construct an invalid SSA if the key value has changed the aligned attribute. A separate SSA structure is required for each segment type that the program accesses because the value of the key fields differs among segment types. After you have initialized the fields (other than the key values), you should not need to change the SSAs again. You can define SSAs in any of the ways explained for the I/O area. The following is an example of a qualified SSA without command codes. If you use command codes in this SSA, code the asterisk (*) and command codes between the 8-byte segment name field and the left parenthesis that begins the qualification statement.
DCL 1 QUAL_SSA STATIC UNALIGNED, 2 SEG_NAME CHAR(8) 2 SEG_QUAL CHAR(1) 2 SEG_KEY_NAME CHAR(8) 2 SEG_OPR CHAR(2) 2 SEG_KEY_VALUE CHAR(n) 2 SEG_END_CHAR CHAR(1) INIT('ROOT '), INIT('('), INIT('KEY '), INIT(' ='), INIT('vv...v'), INIT(')');
Both of these SSAs are taken from the PL/I skeleton program shown in Figure 34 on page 65. To see how they are used in DL/I calls, refer to that program.
104
GSAM RSAs
The RSA (record search argument) is an 8-byte token that can be returned on GN and ISRT calls. The application program can save the RSA for use in a subsequent GU call. Related Reading: For more information on RSAs for GSAM, see Chapter 10, Processing GSAM Databases on page 211.
Overview
When you use the AIBTDLI interface, you specify the PCB that is requested for the call by placing the PCB name (as defined by PSBGEN) in the resource name field of the AIB. You do not specify the PCB address. Because the AIB contains the PCB name, your application can refer to the PCB name rather than to the PCB address. The AIBTDLI call allows you to select PCBs directly by name rather than by a pointer to the PCB. At completion of the call, the AIB returns the PCB address that corresponds to the PCB name that is passed by the application program. For PCBs to be used in a AIBTDLI call, you must assign a name in PSBGEN, either with PCBNAME= or with the name as a label on the PCB statement. PCBs that have assigned names are also included in the positional pointer list, unless you specify LIST=NO. During PSBGEN, you define the names of the DB PCBs and alternate PCBs. All I/O PCBs are generated with the PCB name IOPCB . For a generated program specification block (GPSB), the I/O PCB is generated with the PCB name IOPCB , and the modifiable alternate PCB is generated with the PCB name TPPCB1 . Because you can pass the PCB name, you do not need to know the relative PCB number in the PCB list. In addition, the AIBTDLI interface enables your application program to make calls on PCBs that do not reside in the PCB list. The LIST= keyword, which is defined in the PCB macro during PSBGEN, controls whether the PCB is included in the PCB list. Related Reading: For more information about PSBGEN, see IMS Version 8: Utilities Reference: System.
105
AIBTDLI Interface
Assembler Language
You can use any name for the entry statement to an assembler language DL/I program. When IMS passes control to the application program, register 1 contains the address of a variable-length fullword parameter list. Each word in the list contains the address of a PCB. Save the content of register 1 before you overwrite it. IMS sets the high-order byte of the last fullword in the list to X'80' to indicate the end of the list. Use standard MVS linkage conventions with forward and backward chaining.
C Language
When IMS passes control to your program, it passes the addresses, in the form of pointers, for each of the PCBs that your program uses. The usual argc and argv arguments are not available to a program that is invoked by IMS. The IMS parameter list is made accessible by using the __pcblist macro. You can directly reference the PCBs by __pcblist[0], __pcblist[1], or you can define macros to give these more meaningful names. Note that I/O PCBs must be cast to get the proper type:
(IO_PCB_TYPE *)(__pcblist[0])
106
The env option specifies the operating environment in which your C language program is to run. For example, if your C language program is invoked under IMS and uses IMS facilities, specify env(IMS). The plist option specifies the format of the invocation parameters that is received by your C language program when it is invoked. When your program is invoked by a system support services program, the format of the parameters passed to your main program must be converted into the C language format: argv, argc, and envp. To do this conversion, you must specify the format of the parameter list that is received by your C language program. The ims.h include file contains declarations for PCB masks. You can finish in three ways: v End the main procedure without an explicit return statement. v Execute a return statement from main. v Execute an exit or an abort call from anywhere, or alternatively issue a longjmp back to main, and then do a normal return. One C language program can pass control to another by using the system function. The normal rules for passing parameters apply; in this case, the argc and argv arguments can be used to pass information. The initial __pcblist is made available to the invoked program.
COBOL
The procedure statement must refer to the I/O PCB first, then to any alternate PCB it uses, and finally to the DB PCBs it uses. The alternate PCBs and DB PCBs must be listed in the order in which they are defined in the PSB.
PROCEDURE DIVISION USING PCB-NAME-1 [,...,PCB-NAME-N]
In previous versions of IMS, USING might be coded on the entry statement to reference PCBs. However, IMS continues to accept such coding on the entry statement. Recommendation: Use the procedure statement rather than the entry statement to reference the PCBs.
Pascal
The entry point must be declared as a REENTRANT procedure. When IMS passes control to a Pascal procedure, the first address in the parameter list is reserved for Pascals use, and the other addresses are the PCBs the program uses. The PCB types must be defined before this entry statement. The IMS interface routine PASTDLI must be declared with the GENERIC directive.
procedure ANYNAME(var SAVE: INTEGER; var pcb1-name: pcb1-name-type[; ... var pcbn-name: pcbn-name-type]); REENTRANT; procedure ANYNAME; (* Any local declarations *)
Chapter 3. Defining Application Program Elements
107
PL/I
The entry statement must appear as the first executable statement in the program. When IMS passes control to your program, it passes the addresses of each of the PCBs your program uses in the form of pointers. When you code the entry statement, make sure you code the parameters of this statement as pointers to the PCBs, and not the PCB names.
anyname: PROCEDURE (pcb1_ptr [,..., pcbn_ptr]) OPTIONS (MAIN); . . . RETURN;
Interface Considerations
This section explains the interfaces: CEETDLI and AIBTDLI, and AERTDLI.
CEETDLI
The considerations are: v For PL/I programs, the CEETDLI entry point is defined in the CEEIBMAW include file. Alternatively, you can declare it yourself, but it must be declared as an assembler language entry (DCL CEETDLI OPTIONS(ASM);). v For C language application programs, you must specify env(IMS) and plist(IMS); these specifications enable the application program to accept the PCB list of arguments. The CEETDLI function is defined in <leawi.h>; the CTDLI function is defined in <ims.h>.
AIBTDLI
The considerations are: v When using the AIBTDLI interface for C/MVS, COBOL, or PL/I language application programs, the language run-time options for suppressing abend interception (that is, NOSPIE and NOSTAE) must be specified. However, for Language Environment-conforming application programs, the NOSPIE and NOSTAE restriction is removed. v The AIBTDLI entry point for PL/I programs must be declared as an assembler language entry (DCL AIBTDLI OPTIONS(ASM);). v For C language applications, you must specify env(IMS) and plist(IMS); these specifications enable the application program to accept the PCB list of arguments.
AERTDLI
The considerations are: v When using the AERTDLI interface for C/MVS, COBOL, or PL/I language application programs, the language run-time options for suppressing abend interception (that is, NOSPIE and NOSTAE) must be specified. However, for Language Environment-conforming application programs, the NOSPIE and NOSTAE restriction is removed. v The AERTDLI entry point for PL/I programs must be declared as an assembler language entry (DCL AERTDLI OPTIONS(ASM);).
108
PCB Lists
This section describes the formats of PCB lists and GPSB PCB lists, and provides a description of PCBs in various types of application programs.
Each PSB must contain at least one PCB. An I/O PCB is required for most system service calls. An I/O PCB or alternate PCB is required for transaction management calls. (Alternate PCBs can exist in IMS TM.) DB PCBs for DL/I databases are used only with the IMS Database Manager under DCCTL. GSAM PCBs can be used with DCCTL.
A GPSB contains only an I/O PCB and one modifiable alternate PCB. (A modifiable alternate PCB enables you to change the destination of the alternate PCB while the program is running.)A GPSB can be used by all transaction management application programs, and permits access to the specified PCBs without the need for a specific PSB for the application program. The PCBs in a GPSB have predefined PCB names. The name of the I/O PCB is IOPCB . The name of the alternate PCB is TPPCB1 .
PCB Summary
This section summarizes the information concerning I/O PCBs and alternate PCBs in various types of application programs. You should read this section if you intend to issue system service requests. DB Batch Programs If CMPAT=Y is specified in PSBGEN, the I/O PCB is present in the PCB list; otherwise, the I/O PCB is not present, and the program cannot issue system service calls. Alternate PCBs are always included in the list of PCBs that IMS supplies to the program. The I/O PCB and alternate PCBs are always passed to BMPs, MPPs, and IFPs. The PCB list always contains the address of the I/O PCB, followed by the addresses of any alternate PCBs, followed by the addresses of the DB PCBs.
109
PCB Lists
CICS Online Programs with DBCTL If you specify the IOPCB option on the PCB call, the first PCB address in your PCB list is the I/O PCB, followed by any alternate PCBs, followed by the addresses of the DB PCBs. If you do not specify the I/O PCB option, the first PCB address in your PCB list points to the first DB PCB. Table 8 summarizes the I/O PCB and alternate PCB information.
Table 8. I/O PCB and Alternate PCB Information Summary CALL DL/I Environment MPP IFP BMP DB Batch DB Batch
1 2 3 4 5
I/O PCB address in PCB list Yes Yes Yes No Yes Yes No Yes
Alternate PCB address in PCB list Yes Yes Yes Yes Yes Yes No Yes
TM Batch
1. CMPAT = N specified. 2. CMPAT = Y specified. 3. CMPAT = Option. Default is always to Y, even when CMPAT = N is specified. 4. SCHD request issued without the IOPCB or SYSSERVE option. 5. SCHD request issued with the IOPCB or SYSSERVE for a CICS DBCTL request or for a function-shipped request which is satisfied by a CICS system using DBCTL.
Overview
When you use the AERTDLI interface, the AIB used for database calls must be the same AIB as used for the APSB call. Specify the PCB that is requested for the call by placing the PCB name (as defined by PSBGEN) in the resource name field of the AIB. You do not specify the PCB address. Because the AIB contains the PCB name, your application can refer to the PCB name rather than to the PCB address. The AERTDLI call allows you to select PCBs directly by name rather than by a pointer to the PCB. At completion of the call, the AIB returns the PCB address that corresponds to the PCB name that is passed by the application program. For PCBs to be used in a AERTDLI call, you must assign a name in PSBGEN, either with PCBNAME= or with the name as a label on the PCB statement. PCBs that have assigned names are also included in the positional pointer list, unless you specify LIST=NO. During PSBGEN, you define the names of the DB PCBs and alternate PCBs. All I/O PCBs are generated with the PCB name IOPCBbbb.
110
PCB Lists
Because you pass the PCB name, you do not need to know the relative PCB number in the PCB list. In addition, the AERTDLI interface enables your application program to make calls on PCBs that do not reside in the PCB list. The LIST= keyword, which is defined in the PCB macro during PSBGEN, controls whether the PCB is included in the PCB list.
Language Environment
IBM Language Environment for MVS and VM provides the strategic execution environment for running your application programs written in one or more high-level languages. It provides not only language-specific run-time support, but also cross-language run-time services for your application programs, such as support for initialization, termination, message handling, condition handling, storage management, and National Language Support. Many of Language Environments services are accessible explicitly through a set of Language Environment interfaces that are common across programming languages; these services are accessible from any Language Environment-conforming program. Language Environment-conforming programs can be compiled with the following compilers: v IBM C/C++ for MVS/ESA v IBM COBOL for MVS and VM v IBM PL/I for MVS and VM These programs can be produced by programs coded in Assembler. All these programs can use CEETDLI, the Language Environment-provided language-independent interface to IMS, as well as older language-dependent interfaces to IMS, such as CTDLI, CBLTDLI, and PLITDLI. Although they do not conform to Language Environment, programs that are compiled with the following older compilers can run under Language Environment: v IBM C/370 v IBM VS COBOL II v IBM OS PL/I These programs cannot use CEETDLI, but they can use the older language-dependent interfaces to IMS. Related Reading: For more information about Language Environment, see IBM Language Environment for MVS and VM Programming Guide.
111
Language Environment
capabilities that Language Environment provides. The CEETDLI interface supports the same functionality as the other IMS application interfaces, and it has the following characteristics: v The parmcount variable is optional. v Length fields are 2 bytes long. v Direct pointers are used. Related Reading: For more information about Language Environment, see IBM Language Environment for MVS and VM Programming Guide and Language Environment for MVS & VM Installation and Customization.
Restriction: PLICALLA is only valid for PL/I compatibility with Language Environment. If a PL/I application program using PLICALLA entry at link-edit time is link-edited using Language Environment with the PLICALLA entry, the link-edit will work; however, you must use LANG=PLI. If the application program is re-compiled using PL/I for MVS & VM Version 1 Release 1, and then link-edited using Language Environment Version 1 Release 2 or later, the link-edit will fail. You must remove the PLICALLA entry statement from the link-edit.
112
Mixed-Language Programming
When an application program uses the Language Environment language-independent interface, CEETDLI, IMS does not need to know the language of the calling program. When the application program calls IMS in a language-dependent interface, IMS determines the language of the calling program according to the entry name that is specified in the CALL statement. That is, IMS assumes that the program is: v Assembler language when the application program uses CALL ASMTDLI v C language when the application program uses rc=CTDLI v COBOL when the application program uses CALL CBLTDLI v Pascal when the application program uses CALL PASTDLI v PL/I when the application program uses CALL PLITDLI For example, if a PL/I program calls an assembler language subroutine and the assembler language subroutine makes DL/I calls by using CALL ASMTDLI, the assembler language subroutine should use the assembler language calling convention, not the PL/I convention. In this situation, where the I/O area uses the LLZZ format, LL is a halfword, not the fullword that is used for PL/I.
113
Preloaded Programs
If you compile your COBOL program with the COBOL for MVS & VM compiler and preload it, you must use the COBOL compiler option, RENT. If you compile your COBOL program with the VS COBOL II compiler and preload it, you must use the COBOL compiler options, RES and RENT.
114
v REPL Call on page 140 Related Reading: For specific information about coding your program in assembler language, C language, COBOL, Pascal, and PL/I, see Chapter 3, Defining Application Program Elements on page 71. For information on the DL/I calls used for transaction management and EXEC DLI commands used in CICS, see IMS Version 8: Application Programming: Transaction Manager and IMS Version 8: Application Programming: EXEC DLI Commands for CICS and IMS.
CIMS Call
The CIMS call is used to initialize and terminate the ODBA interface in an OS/390 application region.
Format
CIMS aib
115
Parameters
aib Specifies the application interface block (AIB) that is used for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIBbb. AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 character value - optional AIBSFUNC Subfunction code. This field must contain one of the 8-byte subfunction codes as follows: INIT AIBRSNM2 - 4-character ID of the ODBA startup table - optional. TERM AIBRSNM2 - 4-character ID of the ODBA startup table representing the IMS connection that is to be terminated. TALL Terminate all IMS connections.
Usage
The CIMS call is used by an application running in an application address space to establish/terminate the ODBA environment. INITbbbb The CIMS subfunction INIT must be issued by the application to establish the ODBA environment in the OS/390 application address space. Optionally, AIBRSNM2 can specify the 4-character ID of the ODBA Startup table member. This is the member named DFSxxxx0 where xxxx is equal to the 4-character ID. If AIBRSNM2 is specified, ODBA will attempt to establish a connection to the IMS specified in the DFSxxxx0 member after the ODBA environment has been initialized in the OS/390 application address space. TERMbbbb The CIMS subfunction TERM can be issued to terminate one and only one IMS connection. AIBRSNM2 specifies the 4-character ID of the startup table member representing the IMS connection to be terminated. Upon completion of the TERM subfunction the ODBA environment will remain intact in the OS/390 application address space. Note: If the application that issued CIMS INIT chooses to return to the operating system following completion of the CIMS TERM, the address space will experience a system abend A03. This can be avoided by issuing the CIMS TALL prior to returning to the operating system
116
CLSE Call
The Close (CLSE) call is used to explicitly close a GSAM database. For more information on GSAM, see Chapter 10, Processing GSAM Databases on page 211.
Format
CLSE gsam pcb aib
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
gsam pcb Specifies the GSAM PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB length. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a GSAM PCB.
Usage
For information on using CLSE, see Explicitly Opening and Closing a GSAM Database on page 214.
DEQ Call
The Dequeue (DEQ) call is used to release a segment that is retrieved using the Q command code.
117
DB Call: DEQ
DB/DC X
DBCTL X
DCCTL
DB Batch X
TM Batch
Parameters
DEDB pcb (Fast Path only) Specifies any DEDB PCB for the call. i/o pcb (full function only) Specifies the I/O PCB for the DEQ call. This is an input and output parameter. aib Specifies the AIB for the call. This is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area (full function only) Specifies the 1-byte area containing a letter (A-J), which represents the lock class of the locks to be released. This is a mandatory input parameter.
Usage
The DEQ call releases all segments that are retrieved using the Q command code, except: v Segments modified by your program, until your program reaches a commit point v Segments required to keep your position in the hierarchy, until your program moves to another database record v A class of segments that has been locked using a different lock class If your program only reads segments, it can release them by issuing a DEQ call. If your program does not issue a DEQ call, IMS releases the reserved segments when your program reaches a commit point. By releasing the segments with a DEQ call before your program reaches a commit point, you make them available to other programs more quickly. For more information on the relationship between the DEQ call and the Q command code, see Reserving Segments for the Exclusive Use of Your Program on page 248.
118
DB Call: DEQ
Restrictions
In a CICS DL/I environment, calls made from one CICS (DBCTL) system are supported in a remote CICS DL/I environment, if the remote environment is also CICS (DBCTL).
DLET Call
The Delete (DLET) call is used to remove a segment and its dependents from the database.
Format
DLET db pcb aib i/o area
ssa
Call Name For Full-Function: For DEDB: For MSDB: DLET DLET DLET
DB/DC X X X
DBCTL X X
DCCTL
DB Batch X
TM Batch
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area in your program that communicates with IMS. This parameter is an input parameter. Before deleting a segment, you must first issue a Get Hold call to place the segment in the I/O area. You can then issue the DLET call to delete the segment and its dependents in the database. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program
Chapter 4. Writing DL/I Calls for Database Management
119
DB Call: DLET
in which you have defined the SSAs for the call. You can use only one SSA in the parameter. This parameter is optional for the DLET call.
Usage
The DLET call must be preceded by one of the three Get Hold calls. When you issue the DLET call, IMS deletes the held segment, along with all its physical dependents from the database, regardless of whether your program is sensitive to all of these segments. IMS rejects the DLET call if the preceding call for the PCB was not a Get Hold, REPL, or DLET call. If the DLET call is successful, the previously retrieved segment and all of its dependents are removed from the database and cannot be retrieved again. If the Get Hold call that precedes the DLET call is a path call, and you do not want to delete all the retrieved segments, you must indicate to IMS which of the retrieved segments (and its dependents, if any) you want deleted; to do this, specify an unqualified SSA for that segment.Deleting a segment this way automatically deletes all dependents of the segment. Only one SSA is allowed in the DLET call, and this is the only time an SSA is applicable in a DLET call. No command codes apply to the DLET call. If you use a command code in a DLET call, IMS disregards the command code.
FLD Call
The Field (FLD) call is used to access a field within a segment for MSDBs or DEDBs.
Format
FLD db pcb aib i/o area
ssa
DB/DC X X
DBCTL
DCCTL
DB Batch
TM Batch
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained.
120
Usage
Use the FLD call to access and change the contents of a field within a segment. The FLD call does two things for you: it compares the value of a field to the value you supply (FLD/VERIFY), and it changes the value of the field in the way that you specify (FLD/CHANGE). All DL/I command codes are available to DEDBs, using the FLD call. The FLD call formats for DEDBs are the same as for other DL/I calls. So, if your MSDBs have been converted to DEDBs, you do not need to change application programs that use the FLD call. For more information on the FLD call, see Updating Segments in an MSDB or DEDB: REPL, DLET, ISRT, and FLD on page 223. You can also use the FLD call in application programs for DEDBs, instead of the combination of GHU, REPL, and DL/I calls.
FSAs
The field search argument (FSA) is equivalent to the I/O area that is used by other DL/I database calls. For a FLD call, data is not moved into the I/O area; rather, the FSAs are moved into the I/O area. Multiple FSAs are allowed on one FLD call. This is specified in the FSAs Connector field. Each FSA can operate on either the same or different fields within the target segment. The FSA that you reference in a FLD call contains five fields. The rules for coding these fields are as follows: Field name This field must be 8 bytes long. If the field name you are using is less than 8 bytes, the name must be left-justified and padded on the right with blanks. FSA status code This field is 1 byte. IMS returns one of the following status codes to this area after a FLD call: Successful A B Invalid operation Operand length invalid
Chapter 4. Writing DL/I Calls for Database Management
121
Op code This 1-byte field contains one of the following operators for a change operation: + = To add the operand to the field value To subtract the operand from the field value To set the field value to the value of the operand
For a verify operation, this field must contain one of the following: E G H L M N Verify that the field value and the operand are equal. Verify that the field value is greater than the operand. Verify that the field value is greater than or equal to the operand. Verify that the field value is less than the operand. Verify that the field value is less than or equal to the operand. Verify that the field value is not equal to the operand.
Operand This variable length field contains the value that you want to test the field value against. The data in this field must be the same type as the data in the field. (You define this in the DBD.) If the data is hexadecimal, the value in the operand is twice as long as the field in the database. If the data is packed decimal, the operand does not contain leading zeros, so the operand length might be shorter than the actual field. For other types of data, the lengths must be equal. Connector This 1-byte field must contain a blank if this is the last or only FSA, or an asterisk (*) if another FSA follows this one. The format of SSAs in FLD calls is the same as the format of SSAs in DL/I calls. If no SSA exists, the first segment in the MSDB or DEDB is retrieved. For more information on the FLD call and some examples, see Processing MSDBs and DEDBs on page 223.
GN/GHN Call
The Get Next (GN) call is used to retrieve segments sequentially from the database. The Get Hold Next (GHN) is the hold form for a GN call.
Format
122
DB Call: GN/GHN
GN db pcb aib i/o area
ssa
Call Name For Full-Function: For GSAM: For DEDB: For MSDB: GN/GHN GN GN GN
DB/DC X X X X
DBCTL X X X
DCCTL
DB Batch X
TM Batch
X X
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area. This parameter is an output parameter. When you issue one of the Get calls successfully, IMS returns the requested segment to this area. If your program issues any path calls, the I/O area must be long enough to hold the longest path of concatenated segments following a path call. This area always contains left-justified segment data. The I/O area points to the first byte of this area. When you use the GN call with GSAM, the area named by the i/o area parameter contains the record you are retrieving. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program in which you have defined the SSAs for the call. You can use up to 15 SSAs in the parameter. This parameter is optional for the GN call.
123
DB Call: GN/GHN
rsa Specifies the area in your program where the RSA for the record should be returned. This output parameter is used for GSAM only and is optional. See GSAM RSAs on page 105 for more information on RSAs.
124
DB Call: GN/GHN
Example: If you issue a GN call with qualified SSAs for segments A1 and B1, and an unqualified SSA for segment type D, IMS returns segment D1 the first time you issue the call, segment D2 the second time you issue the call, and segment D3 the third time you issue the call. If you issue the call a fourth time, IMS returns a status code of GE, which means that IMS could not find the segment you requested. You can use unqualified GN calls to retrieve all of the occurrences of a segment in a hierarchy, in their hierarchic sequence, starting at the current position. Each unqualified GN call retrieves the next sequential segment forward from the current position. For example, to answer the processing request: Print out the entire medical database. You would issue an unqualified GN call repeatedly until IMS returned a GB status code, indicating that it had reached the end of the database without being able to satisfy your call. If you issued the GN again after the GB status code, IMS would return the first segment occurrence in the database. Like GU, a GN call can have as many SSAs as the hierarchy has levels. Using fully qualified SSAs with GN calls clearly identifies the hierarchic path and the segment you want, thus making it useful in documenting the call. A GN call with an unqualified SSA retrieves the next occurrence of that segment type by going forward from the current position. GN with a qualified SSA retrieves the next occurrence of the specified segment type that satisfies the SSA. When you specify a GN that has multiple SSAs, the presence or absence of unqualified SSAs in the call has no effect on the operation unless you use command codes on the unqualified SSAs. IMS uses only qualified SSAs plus the last SSA to determine the path and retrieve the segment. Unspecified or unqualified SSAs for higher-level segments in the hierarchy mean that any high-level segment that is the parent of the correct lower-level, specified or qualified segment will satisfy the call. A GN call with an SSA that is qualified on the key of the root can produce different results from a GU with the same SSA, depending on the position in the database and the sequence of keys in the database. If the current position in the database is beyond a segment that would satisfy the SSA, the segment is not retrieved by the GN. GN returns the GE status code if both the following conditions are met:
Chapter 4. Writing DL/I Calls for Database Management
125
DB Call: GN/GHN
v The value of the key in the SSA has an upper limit that is set, for example, to less-than-or-equal-to the value. v A segment with a key greater than the value in the SSA is found in a sequential search before the specified segment is found. GN returns the GE status code, even though the specified segment exists and would be retrieved by a GU call.
126
DB Call: GN/GHN
not satisfied using the current position, IMS calls the randomizing routine to determine the anchor point for that key. IMS tries to satisfy the call starting with the first root of the selected anchor.
Restriction
You can use GN to retrieve the next record of a GSAM database, but GHN is not valid for GSAM.
GNP/GHNP Call
The Get Next in Parent (GNP) call is used to retrieve dependents sequentially. The Get Hold Next in Parent (GHNP) call is the hold form for the GNP call.
Format
GNP GHNP db pcb aib i/o area
ssa
Call Name For Full-Function: For DEDB: For MSDB: GNP/GHNP GNP/GHNP GNP/GHNP
DB/DC X X X
DBCTL X X
DCCTL
DB Batch X
TM Batch
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area. This parameter is an output parameter. When you issue the Get call successfully, IMS returns the requested segment to this area. If your program issues any path calls, the I/O area must be long enough to hold
127
DB Call: GNP/GHNP
the longest path of concatenated segments following a path call. The segment data that this area contains is always left-justified. The I/O area points to the first byte of this area. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program in which you have defined the SSAs for the call. You can use up to 15 SSAs for this parameter. This parameter is optional for the GNP call.
A GNP call is linked to the previous DL/I calls that were issued by your program in two ways: v Current position: The search for the requested segment starts at the current position established by the preceding GU, GN, or GNP call. v Parentage: The search for the requested segment is limited to the dependents of the lowest-level segment most recently accessed by a GU or GN call. Parentage determines the end of the search and is in effect only following a successful GU or GN call.
A GNP call does not affect parentage unless it includes the P command code. Unless you are using a secondary index, REPL does not affect parentage. If you are using a secondary index, and you replace the indexed segment, parentage is lost. For more information, see How Secondary Indexing Affects Your Program on page 203. A DLET call does not affect parentage unless you delete the established parent. If you do delete the established parent, you must reset parentage before issuing a GNP call.
128
DB Call: GNP/GHNP
ISRT affects parentage only when you insert a segment that is not a dependent of the established parent. In this case, ISRT cancels parentage. If the segment you are inserting is a dependent at some level of the established parent, parentage is unaffected. For example, in Figure 47 on page 186, assume segment B11 is the established parent. Neither of these two ISRT calls would affect parentage:
ISRT A B C A B C D (AKEY (BKEY (AKEY (BKEY (CKEY = A1) = B11) = A1) = B11) = C111)
ISRT
The following ISRT call would cancel parentage, because the F segment is not a direct dependent of B, the established parent:
ISRT A F (AKEY = A1)
You can include one or more SSAs in a GNP call. The SSAs can be qualified or unqualified. Without SSAs, a GNP call retrieves the next sequential dependent of the established parent. The advantage of using SSAs with GNP is that they allow you to point IMS to a specific dependent or dependent type of the established parent. A GNP with an unqualified SSA sequentially retrieves the dependent segment occurrences of the segment type you have specified under the established parent. A GNP with a qualified SSA describes to IMS the segment you want retrieved or the segment that is to become part of the hierarchic path to the segment you want retrieved. A qualified GNP describes a unique segment only if it is qualified on a unique key field and not a data field or a non unique key field. A GNP with multiple SSAs defines the hierarchic path to the segment you want. If you specify SSAs for segments at levels above the established parent level, those SSAs must be satisfied by the current position at that level. If they cannot be satisfied using the current position, a GE status code is returned and the existing position remains unchanged. The last SSA must be for a segment that is below the established parent level. If it is not, a GP status code is returned. Multiple unqualified SSAs establish the first occurrence of the specified segment type as part of the path you want. If some SSAs between the parent and the requested segment in a GNP call are missing, they are generated internally as unqualified SSAs. This means that IMS includes the first occurrence of the segment from the missing SSA as part of the hierarchic path to the segment you have requested.
GU/GHU Call
The Get Unique (GU) call is used to directly retrieve segments and to establish a starting position in the database for sequential processing. The Get Hold Unique (GHU) is the hold form for a GU call.
129
DB Call: GU/GHU
Format
GU db pcb aib i/o area
ssa
Call Name For Full-Function: For GSAM: For DEDB: For MSDB: GU/GHU GU GU GU
DB/DC X X X X
DBCTL X X X
DCCTL
DB Batch X
TM Batch
X X
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area. This parameter is an output parameter. When you issue one of the Get calls successfully, IMS returns the requested segment to this area. If your program issues any path calls, the I/O area must be long enough to hold the longest path of concatenated segments following a path call. The segment data that this area contains is always left-justified. The I/O area points to the first byte of this area. When you use the GU call with GSAM, the area named by the i/o area parameter contains the record you are retrieving. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program
130
DB Call: GU/GHU
in which you have defined the SSAs for the call. You can use up to 15 SSAs for the parameter. This parameter is optional for the GU call. rsa Specifies the area in your program that contains the record search argument. This required input parameter is only used for GSAM. See GSAM RSAs on page 105 for more information on RSAs.
131
DB Call: GU/GHU
program does this by issuing a Get call with a hold before deleting or replacing the segment. Once the program has successfully retrieved the segment with a Get Hold call, it can delete the segment or change one or more fields (except the key field) in the segment. The only difference between Get calls with a hold and without a hold is that the hold calls can be followed by a REPL or DLET call. The hold status on the retrieved segment is canceled and must be reestablished before you reissue the DLET or REPL call. After issuing a Get Hold call, you can issue more than one REPL or DLET call to the segment if you do not issue intervening calls to the same PCB. After issuing a Get Hold call, if you find out that you do not need to update it after all, you can continue with other processing without releasing the segment. The segment is freed as soon as the current position changeswhen you issue another call to the same PCB you used for the Get Hold call. In other words, a Get Hold call must precede a REPL or DLET call. However, issuing a Get Hold call does not require you to replace or delete the segment.
Restriction
You can use GU to retrieve the record with the RSA you provide with a GSAM database, but GHU is not valid for GSAM.
ISRT Call
The Insert (ISRT) call is used to load a database and to add one or more segments to the database. You can use ISRT to add the record you supply to the end of a GSAM database or for an alternate PCB that is set up for IAFP processing.
Format
ISRT db pcb aib i/o area
ssa rsa
Call Name For Full-Function: For GSAM: For DEDB: For MSDB: ISRT ISRT ISRT ISRT
DB/DC X X X X
DBCTL X X X
DCCTL
DB Batch X
TM Batch
X X
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter.
132
DB Calls: ISRT
aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area. This parameter is an input parameter. When you want to add a new segment to the database, you place the new segment in this area before issuing the ISRT call. This area must be long enough to hold the longest segment that IMS returns to this area. For example, if none of the segments your program retrieves or updates is longer than 48 bytes, your I/O area should be 48 bytes. If your program issues any path calls, the I/O area must be long enough to hold the longest concatenated segment following a path call. The segment data that this area contains is always left-justified. The I/O area points to the first byte of this area. When you use the ISRT call with GSAM, the area named by the i/o area parameter contains the record you want to add. The area must be long enough to hold these records. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program in which you have defined the SSAs for the call. You can use up to 15 SSAs on the call. This parameter is required. rsa Specifies the area in your program where the RSA should be returned by DL/I. This output parameter is used for GSAM only and is optional. See GSAM RSAs on page 105 for more information on RSAs.
Usage
Your program uses the ISRT call to initially load a database and to add information to an existing one. The call looks the same in either case. However, the way it is used is determined by the processing option in the PCB. This section explains how you use ISRT to add segments to an existing database. ISRT can add new occurrences of an existing segment type to a HIDAM, PHIDAM, HISAM, HDAM, PHDAM, DEDB, or MSDB database. Restriction: New segments cannot be added to a HSAM database unless you reprocess the whole database or add the new segments to the end of the database.
133
DB Calls: ISRT
Before you issue the ISRT call, build the new segment in the I/O area. The fields of the new segment must be in the same order and of the same length as defined for the segment. (If field sensitivity is used, they must be in the order defined for the application programs view of the segment.) The DBD defines the fields that a segment contains and the order in which they appear in the segment.
Insert Rules
If the segment type you are inserting has a unique key field, the place where IMS adds the new segment occurrence depends on the value of its key field. If the segment does not have a key field, or if the key is not unique, you can control where the new segment occurrence is added by specifying either the FIRST, LAST, or HERE insert rule. Specify the rules on the RULES parameter of the SEGM statement of DBDGEN for this database. Related Reading: For information on performing a DBDGEN, see IMS Version 8: Utilities Reference: Database and Transaction Manager. The rules on the RULES parameter are as follows: FIRST IMS inserts the new segment occurrence before the first existing occurrence of this segment type. If this segment has a non unique key, IMS inserts the new occurrence before all existing occurrences of that segment that have the same key field. IMS inserts the new occurrence after the last existing occurrence of the segment type. If the segment occurrence has a non unique key, IMS inserts the new occurrence after all existing occurrences of that segment type that have the same key. IMS assumes you have a position on the segment type from a previous IMS call. IMS places the new occurrence before the segment occurrence that was retrieved or deleted by the last call, which is immediately before current position. If current position is not within the occurrences of the segment type being inserted, IMS adds the new occurrence before all existing occurrences of that segment type. If the segment has a non unique key and current position is not within the occurrences of the segment type with equal key value, IMS adds the new occurrence before all existing occurrences that have equal key fields.
LAST
HERE
You can override the insert rule of FIRST with the L command code. You can override the insert rule of HERE with either the F or L command code. This is true for HDAM and PHDAM root segments and for dependent segments in any type of database that have either non unique keys or no keys at all.
134
DB Calls: ISRT
An ISRT call must have at least one unqualified SSA for each segment that is added to the database. Unless the ISRT is a path call, the lowest-level SSA specifies the segment being inserted. This SSA must be unqualified. If you use the D command code, all the SSAs below and including the SSA containing the D command code must be unqualified. Provide qualified SSAs for higher levels to establish the position of the segment being inserted. Qualified and unqualified SSAs can be used to specify the path to the segment, but the last SSA must be unqualified. This final SSA names the segment type to be inserted. If you supply only one unqualified SSA for the new segment occurrence, you must be sure that current position is at the correct place in the database to insert that segment.
Using SSAs with ISRT is a good way to check for the parent segments of the segment you want to insert. You cannot add a segment unless its parent segments exist in the database. Instead of issuing Get calls for the parents, you can define a fully qualified set of SSAs for all the parents and issue the ISRT call for the new segment. If IMS returns a GE status code, at least one of the parents does not exist. You can then check the segment level number in the DB PCB to find out which parent is missing. If the level number in the DB PCB is 00, IMS did not find any of the segments you specified. A 01 means that IMS found only the root segment; a 02 means that the lowest-level segment that IMS found was at the second level; and so on.
OPEN Call
The OPEN call is used to explicitly open a GSAM database.
Format
OPEN gsam pcb aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
135
DB Call: OPEN
Parameters
gsam pcb Specifies the GSAM PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name of a GSAM PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the kind of data set you are opening. This parameter is an input parameter.
Usage
For more information, see Explicitly Opening and Closing a GSAM Database on page 214.
POS Call
| | | | | | A qualified Position (POS) call is used to retrieve the location of a specific sequential dependent segment. In addition to location, a qualified POS call using an SSA for a committed segment will return the sequential dependent segment (SDEP) timestamp and the ID of the IMS owner that inserted it. For more information about the qualified POS call, see Locating the Last Inserted Sequential Dependent Segment on page 235. An unqualified POS points to the logical end of the sequential dependent segment (SDEP) data. By default, an unqualified POS call returns the DMACNXTS value, which is the next SDEP CI to be allocated. Because this CI has not been allocated, its specification without the EXCLUDE keyword will often result in a DFS2664A message from the SDEP utilities.
Format
POS db pcb aib i/o area ssa
136
DB Call: POS
Call Name For DEDB: POS DB/DC X DBCTL X DCCTL DB Batch TM Batch
Parameters
db pcb Specifies the DB PCB for the DEDB that you are using for this call. This parameter is an input and output parameter. aib Specifies the AIB for the DEDB that you are using for this call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area in your program that you want to contain the positioning information that is returned by a successful POS call. This parameter is an output parameter. The I/O area should be long enough to contain all entries returned. IMS returns an entry for each area in the DEDB. | | | | | | | | | | | | | | | The I/O area on a POS call contains six words with nine potential fields of data for each entry returned. When the successful POS is an unqualified call, the I/O area contains the length (LL), followed by as many entries as existing areas within the database. You can provide one of five keywords in position one of the I/O area to determine what data is returned in the I/O area. The following table lists the five keywords and the data that an unqualifed POS call would return, based on which keyword you choose.
Table 10. Unqualified POS Call: Keywords and Map of the I/O Area Returned Keyword <null> V5SEGRBA PCSEGRTS PSSEGHWM PCHSEGTS PCLBTSGTS word 0 word 1 Field 1 Field 1 Field 1 Field 1 Field 1 Field 1 word 2 word 3 Field 2 Field 3 Field 3 Field 3 Field 8 Field 9 word 4 Field 4 word 5 Field 5 <null> Field 6 Field 7 Field 6 Field 6
137
DB Call: POS
| | | | | | | | | |
Table 10. Unqualified POS Call: Keywords and Map of the I/O Area Returned (continued) Field 1 Area name Field 2 Sequential dependent next to allocate CI Field 3 Local sequential dependent next segment Field 4 Unused CIs in sequential dependent part Field 5 Unused CIs in independent overflow part Field 6 Highest committed SDEP segment timestamp Field 7 Sequential dependent High Water Mark Field 8 Highest committed SDEP segment Field 9 Logical begin time stamp
The following describes the contents of each of the nine fields in the table. Length (LL) (not shown in table) After a successful POS call, IMS places the length of the data area for this call in this 2-byte field. | (Field 1) Area name This 8-byte field contains the ddname from the AREA statement. Position IMS places two pieces of data in this 8-byte field after a successful POS call. The first 4 bytes contain the cycle count, and the second 4 bytes contain the VSAM RBA. These two fields uniquely identify a sequential dependent segment during the life of an area. If the sequential dependent segment that is the target of the POS call is inserted in the same synchronization interval, no position information is returned. Bytes 11-18 contain X'FF'. Other fields contain normal data. | (Field 2) Sequential dependent next to allocate CI This is the default if no keyword is specified in position one of the input I/O area. The data returned is the 8-byte cycle count and RBA (CC+RBA) acquired from the global DMACNXTS field. This represents the next to be pre-allocated CI as a CI boundary. (Field 3) Local sequential dependent next segment The data returned is the 8-byte CC+RBA of a segment boundary where the next SDEP to be inserted will be placed. This data is specific to only the IMS that executes the POS call. Its scope is for local IMS use only. (Field 4) Unused CIs in sequential dependent part This 4-byte field contains the number of unused control intervals in the sequential dependent part. (Field 5)
| | | | | | | | | | | | |
138
DB Call: POS
| | | | | | | | | | | | | | | | | | | | | | | | | | ssa Specifies the SSA that you want to use in this call. This parameter is an input parameter. The format of SSAs in POS calls is the same as the format of SSAs in DL/I calls. You can use only one SSA in this parameter. This parameter is optional for the POS call. Unused CIs in independent overflow part This 4-byte field contains the number of unused control intervals in the independent overflow part. (Field 6) Highest committed SDEP segment timestamp The data returned is the 8-byte timestamp of the highest committed SDEP segment across partners, or for a local IMS, the timestamp of the pre-allocated SDEP dummy segment. If the area (either local or shared) has not been opened, or a /DBR was performed without any subsequent SDEP segment inserts, the current time is returned. (Field 7) Sequential dependent High Water Mark This 8-byte field contains the cycle count plus RBA (CC+RBA) of the last pre-allocated CI which is the High Water Mark (HWM) CI. (Field 8) Highest committed SDEP segment The data returned is the 8-byte cycle count plus RBA (CC+RBA) for the highest committed SDEP segment across partners, or for a local IMS, the CC+RBA of the highest committed SDEP segment. If the area (either local or shared) has not been opened, or a /DBR was performed without any subsequent SDEP segment inserts, the HWM CI is returned. (Field 9) Logical begin time stamp This 8-byte field contains the logical begin time stamp from the DMACLBTS field.
Usage
The POS call: | | | v Retrieves the location of a specific sequential dependent segment. v Retrieves the location of last-inserted sequential dependent segment, its timestamp, and the IMS ID. v Retrieves the timestamp of a sequential dependent segment or Logical Begin. v Tells you the amount of unused space within each DEDB area. For example, you can use the information that IMS returns for a POS call to scan or delete the sequential dependent segments for a particular time period. If the area which the POS call specifies is unavailable, the I/O area is unchanged, and the status code FH is returned.
Restrictions
You can only use the POS call with a DEDB.
139
DB Call: REPL
REPL Call
The Replace (REPL) call is used to change the values of one or more fields in a segment.
Format
REPL db pcb aib i/o area
ssa
Call Name For Full-Function: For DEDB: For MSDB: REPL REPL REPL
DB/DC X X X
DBCTL X X
DCCTL
DB Batch X
TM Batch
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the area in your program that communicates with IMS. This parameter is an input parameter. When you want to replace an existing segment in the database with a new segment, you first issue a Get Hold call to place the new segment in the I/O area. You can modify the data in the I/O area, and then issue the REPL call to replace the segment in the database. ssa Specifies the SSAs, if any, to be used in the call. This parameter is an input parameter. The SSAs you supply in the call point to data areas in your program in which you have defined the SSAs for the call. You can use up to 15 SSAs in this parameter. This parameter is optional for the REPL call.
140
DB Call: REPL
Usage
A REPL call must be preceded by one of the three Get Hold calls. After you retrieve the segment, you modify it in the I/O area, and then issue a REPL call to replace it in the database. IMS replaces the segment in the database with the segment you modify in the I/O area. You cannot change the field lengths of the segments in the I/O area before you issue the REPL call. For example, if you do not change one or more segments that are returned on a Get Hold call, or if you change the segment in the I/O area but do not want the change reflected in the database, you can inform IMS not to replace the segment. Specify an unqualified SSA with an N command code for that segment, which tells IMS not to replace the segment. The N command enables you to tell IMS not to replace one or more of the multiple segments that were returned using the D command code. However, you can specify an N command code even if there were no D command codes on the preceding Get Hold call. You should not include a qualified SSA on a REPL call. If you do, you receive an AJ status code. For your program to successfully replace a segment, the segment must have been previously defined as replace-sensitive by PROCOPT=A or PROCOPT=R on the SENSEG statement in the PCB. Related Reading: For more information on the PROCOPT option, see IMS Version 8: Utilities Reference: Database and Transaction Manager. If your program attempts to do a path replace of a segment where it does not have replace sensitivity, and command code N is not specified, the data for the segment in the I/O area for the REPL call must be the same as the segment returned on the preceding Get Hold call. If the data changes in this situation, your program receives the status code, AM, and data does not change as a result of the REPL call.
141
142
v TERM Call (CICS Online Programs Only) on page 177 v XRST Call on page 177 Related Reading: For specific information about coding your program in assembler language, C language, COBOL, Pascal, and PL/I, see Chapter 3, Defining Application Program Elements on page 71 for the complete structure. For information on calls that apply to TM, see IMS Version 8: Application Programming: Transaction Manager. Calls within the section are in alphabetic order. For information on DL/I calls used for transaction management and EXEC DLI
143
commands used in CICS, see IMS Version 8: Application Programming: Transaction Manager and IMS Version 8: Application Programming: EXEC DLI Commands for CICS and IMS.
APSB Call
The Allocate PSB (APSB) calls are used to allocate a PSB for an ODBA application.
Format
APSB aib
DB/DC X
IMS DB X
DCCTL
DB Batch
TM Batch
Parameters
aib Specifies the application interface block (AIB) that is used for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIBbb. AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PSB name. AIBRSNM2 This is the 4-character ID of ODBA startup table representing the target IMS of the APSB.
Usage
The ODBA application must load or be link edited with the ODBA application interface AERTDLI. The APSB call must be issued prior to any DLI calls. The APSB call uses the AIB to allocate a PSB for ODBA application programs. RRS/MVS must be active at the time of the APSB call. If RRS/MVS is not active, the APSB call will fail and the application will receive:
AIBRETRN = X'00000108' AIBREASN = X'00000548'
144
Format
CHKP i/o pcb aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. A basic CHKP call must refer to the I/O PCB. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies your programs I/O area that contains the 8-byte checkpoint ID. This parameter is an input parameter. If the program is an MPP or a message-driven BMP, the CHKP call implicitly returns the next input message to this I/O area. Therefore, the area must be large enough to hold the longest returned message.
Usage
Basic CHKP commits the changes your program has made to the database and establishes places in your program from which you can restart your program, if it terminates abnormally.
Format
145
area length
area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. This parameter is an input and output parameter. A symbolic CHKP call must refer to the I/O PCB. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area length This parameter is no longer used by IMS. For compatibility reasons, this parameter must be included in the call, and it must contain a valid address. You can get a valid address by specifying the name of any area in your program. i/o area Specifies the I/O area in your program that contains the 8-byte ID for this checkpoint. This parameter is an input parameter. If the program is a message-driven BMP, the CHKP call implicitly returns the next input message into this I/O area. Therefore, the area must be large enough to hold the longest returned message. area length Specifies a 4-byte field in your program that contains the length (in binary) of the area to checkpoint. This parameter is an input parameter. You can specify up to seven area lengths. For each area length, you must also specify the area parameter. All seven area parameters (and corresponding length parameters) are optional. When you restart the program, IMS restores only the areas you specified in the CHKP call. area Specifies the area in your program that you want IMS to checkpoint. This parameter is an input parameter. You can specify up to seven areas. Each area specified must be preceded by an area length parameter.
146
Usage
The symbolic CHKP call commits the changes your program has made to the database and establishes places in your program from which you can restart your program, if it terminates abnormally. In addition, the CHKP call: v Works with the Extended Restart (XRST) call to restart your program if it terminates abnormally v Enables you to save as many as seven data areas in your program, which are restored when your program is restarted An XRST call is required before a CHKP call to indicate to IMS that symbolic check points are being taken. The XRST call must specify a checkpoint ID of blanks. For more information, see XRST Call on page 177.
Restrictions
The Symbolic CHKP call is allowed only from batch and BMP applications.
DPSB Call
The DPSB call is used to deallocate IMS DB resources.
Format
DPSB aib
DB/DC X
IMS DB X
DCCTL
DB Batch
TM Batch
Parameters
aib Specifies the application interface block (AIB) that is used for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIBbb. AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PSB name. AIBSFUNC Subfunction code. This field must contain one of the 8-byte subfunction codes as follows:
bbbbbbbb (Null) PREPbbbb
Usage
The DPSB call is used by an application running in an OS/390 application region to deallocate a PSB. If the PREP subfunction is not used, the application must
Chapter 5. Writing DL/I Calls for System Services
147
The thread will not be terminated. The application should issue a SRRCMIT or SRRBACK call, and retry the DPSB. The PREP sub-function allows the application to issue the DPSB prior to activating the sync-point process. The sync-point activation can occur at a later time, but still must be issued.
GMSG Call
A Get Message (GMSG) call is used in an automated operator (AO) application program to retrieve a message from the AO exit routine DFSAOE00.
Format
GMSG aib i/o area
Parameters
aib Specifies the application interface block (AIB) to be used for this call. This parameter is an input and output parameter. You must initialize the following fields in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the length of the AIB the application actually obtained. AIBSFUNC Subfunction code. This field must contain one of the following 8-byte subfunction codes: 8-blanks (null) When coded with an AOI token in the AIBRSNM1 field, indicates IMS is to return when no AOI message is available for the application program. WAITAOI When coded with an AOI token in the AIBRSNM1 field, WAITAOI indicates IMS is to wait for an AOI message when none is currently available for the application program. This subfunction value is invalid if an AOI token is not coded in AIBRSNM1. In this case, error return and reason codes are returned in the AIB. The value WAITAOI must be left justified and padded on the right with a blank character.
148
Usage
GMSG is used in an AO application program to retrieve a message associated with an AOI token. The AO application program must pass an 8-byte AOI token to IMS in order to retrieve the first segment of the message. IMS uses the AOI token to associate messages from AO exit routine DFSAOE00 with the GMSG call from an AO application program. IMS returns to the application program only those messages associated with the AOI token. By using different AOI tokens, DFSAOE00 can direct messages to different AO application programs. Note that your installation defines the AOI token. Related Reading: For more information on the AOI exits, see IMS Version 8 Customization Guide. To retrieve the second through the last segments of a multisegment message, issue GMSG calls with no token specified (set the token to blanks). If you want to retrieve all segments of a message, you must issue GMSG calls until all segments are retrieved. IMS discards all nonretrieved segments of a multisegment message when a new GMSG call that specifies an AOI token is issued. Your AO application program can specify a wait on the GMSG call. If no messages are currently available for the associated AOI token, your AO application program waits until a message is available. The decision to wait is specified by the AO application program, unlike a WFI transaction where the wait is specified in the transaction definition. The wait is done on a call basis; that is, within a single application program some GMSG calls can specify waits, while others do not. Table 11 shows, by IMS environment, the types of AO application programs that can issue GMSG. GMSG is also supported from a CPI-C driven program.
149
Restrictions
A CPI-C driven program must issue an allocate PSB (APSB) call before issuing GMSG.
GSCD Call
This section contains product-sensitive programming interface information. A Get System Contents Directory (GSCD) call retrieves the address of the IMS system contents directory for batch programs. The ODBA interface does not support this call.
Format
GSCD db pcb i/o pcb aib i/o area
DB/DC
DBCTL
DCCTL
DB Batch X
TM Batch X
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. i/o pcb Specifies the I/O PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained.
150
Usage
IMS does not return a status code to a program after it issues a successful GSCD call. The status code from the previous call that used the same PCB remains unchanged in the PCB. For more information on GSCD, see IMS Version 8: Application Programming: Design Guide.
Restriction
The GSCD call can be issued only from batch application programs.
ICMD Call
An Issue Command (ICMD) call enables an automated operator (AO) application program to issue an IMS command and retrieve the first command response segment.
Format
ICMD aib i/o area
Parameters
aib Specifies the application interface block (AIB) for this call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. This field is not changed by IMS. AIBOAUSE Length of data returned in the I/O area. This parameter is an output parameter.
151
Usage
ICMD enables an AO application to issue an IMS command and retrieve the first command response segment. When using ICMD, put the IMS command that is to be issued in your application programs I/O area. After IMS has processed the command, it returns the first segment of the response message to your AO application programs I/O area. To retrieve subsequent segments (one segment at a time) use the RCMD call. Some IMS commands that complete successfully result in a DFS058 message indicating that the command is complete. Some IMS commands that are processed asynchronously result in a DFS058 message indicating that the command is in progress. For a command entered on an ICMD call, neither DFS058 message is returned to the AO application program. In this case, the AIBOAUSE field is set to 0 to indicate that no segment was returned. So, your AO application program must check the AIBOAUSE field along with the return and reason codes to determine if a response was returned. Related Reading: For more information on the AOI exits, see IMS Version 8 Customization Guide. Table 12 shows, by IMS environment, the types of AO application programs that can issue ICMD. ICMD is also supported from a CPI-C driven program.
Table 12. ICMD Support by Application Region Type IMS Environment Application Region Type DRA thread BMP (nonmessage-driven) BMP (message-driven) MPP IFP DBCTL Yes Yes N/A N/A N/A DB/DC Yes Yes Yes Yes Yes DCCTL N/A Yes Yes Yes Yes
See IMS Version 8: Command Reference for a list of commands that can be issued using the ICMD call.
152
Restrictions
Before issuing ICMD, a CPI-C driven program must issue an allocate PSB (APSB) call.
INIT Call
The Initialize (INIT) call allows an application to receive status codes regarding deadlock occurrences and data availability (by checking each DB PCB).
Format
INIT i/o pcb aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. INIT must refer to the I/O PCB. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area in your program that contains the character string or strings indicating which INIT functions are requested. This parameter is an input parameter. INIT function character strings include DB QUERY, STATUS GROUPA, and STATUS GROUPB.
Usage
You can use the call in any application program, including IMS batch in a sharing environment. Specify the function in your application program with a character string in the I/O area.
153
Note: The LL value of X'0B' is a hexadecimal representation of decimal 11. ZZ fields are binary.
Table 14 contains a sample I/O area for the INIT call with DBQUERY for PL/I.
Table 14. INIT DBQUERY: I/O Area Example for PLITDLI L 00 L 00 L 00 L 0B Z 00 Z 00 Character String DBQUERY
Note: The LL value of X'0B' is a hexadecimal representation of decimal 11. ZZ fields are binary.
LL or LLLL
A 2-byte field that contains the length of the character string, plus two bytes for LL. For the PLITDLI interface, use the 4-byte field LLLL. When you use the AIB interface (AIBTDLI), PL/I programs require only a 2-byte field. A 2-byte field of binary zeros.
ZZ
One of the following status codes is returned for each database PCB: NA At least one of the databases that can be accessed using this PCB is not available. A call made using this PCB probably results in a BA or BB status code if the INIT STATUS GROUPA call has been issued, or in a DFS3303I message and 3303 pseudoabend if it has not. An exception is when the database is not available because dynamic allocation failed. In this case, a call results in an AI (unable to open) status code. In a DCCTL environment, the status code is always NA. NU At least one of the databases that can be updated using this PCB is unavailable for update. An ISRT, DLET, or REPL call using this PCB might result in a BA status code if the INIT STATUS GROUPA call has been issued, or in a DFS3303I message and 3303 pseudoabend if it has not. The database that caused the NU status code might be required only for delete processing. In that case, DLET calls fail, but ISRT and REPL calls succeed. The data that can be accessed with this PCB can be used for all functions that the PCB allows. DEDBs and MSDBs always have the status code.
154
Note: The LL value of X'11' is a hexadecimal representation of decimal 17. ZZ fields are binary.
Table 16 contains a sample I/O area for the INIT call for PL/I.
Table 16. INIT I/O Area Examples for PLITDLI L 00 L 00 L 00 L 11 Z 00 Z 00 Character String STATUS GROUPA
Note: The LL value of X'11' is a hexadecimal representation of decimal 17. ZZ fields are binary.
LL or LLLL ZZ
LL is a halfword-length field. For non-PLITDLI calls, LLLL is a fullword-length field for PLITDLI. A 2-byte field of binary zeros.
The value for LLZZ data or LLLLZZ data is always 4 bytes (for LLZZ or LLLLZZ), plus data length.
Chapter 5. Writing DL/I Calls for System Services
155
Table 17 contains a sample I/O area for the INIT call for assembler language, COBOL, C language, and Pascal.
Table 17. INIT I/O Area Examples for ASMTDLI, CBLTDLI, CTDLI, and PASTDLI L 00 L 11 Z 00 Z 00 Character String STATUS GROUPB
Note: The LL value of X'11' is a hexadecimal representation of decimal 17. ZZ fields are binary.
Table 18 contains a sample I/O area for the INIT call for PL/I.
Table 18. INIT I/O Area Examples for PLITDLI L 00 L 00 L 00 L 11 Z 00 Z 00 Character String STATUS GROUPB
Note: The LL value of X'11' is a hexadecimal representation of decimal 17. ZZ fields are binary.
LL or LLLL ZZ
LL is a halfword-length field. For non-PLITDLI calls, LLLL is a fullword-length field for PLITDLI. A 2-byte field of binary zeros.
The value for LLZZ data or LLLLZZ data is always four bytes (for LLZZ or LLLLZZ), plus data length.
156
IFP
DBCTL
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL. You should be familiar with deadlock occurrences as described in IMS Version 8: Administration Guide: System.
INQY Call
The Inquiry (INQY) call is used to request information regarding execution environment, destination type and status, and session status. INQY is valid only when using the AIB interface.
157
Format
INQY aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
aib Specifies the address of the application interface block (DFSAIB) for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBSFUNC Subfunction code. This field must contain one of the 8-byte subfunction codes as follows: v DBQUERY v ENVIRON | v FIND v LERUNOPT v PROGRAM Not supported with the ODBA interface. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of any named PCB in the PSB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. This field is not changed by IMS. i/o area Specifies the data output area to use with the call. This parameter is an output parameter. An I/O area is required for INQY subfunctions ENVIRON and PROGRAM . It is not required for subfunctions DBQUERY and FIND .
Usage
The INQY call operates in both batch and online IMS environments. IMS application programs can use the INQY call to request information regarding the output destination, the session status, the current execution environment, the availability of databases, and the PCB address, which is based on the PCB name. You must use the AIB when issuing an INQY call. Before you can issue an INQY call, initialize the fields of the AIB. For more information on initializing AIBs, see The AIBTDLI Interface on page 105.
158
BK
The INQY call returns the following status codes in each DB PCB: NA At least one of the databases that can be accessed using this PCB is not available. A call that is made using this PCB probably results in a BA or BB status code if the INIT STATUS GROUPA call has been issued, or in a DFS3303I message and 3303 pseudoabend if the call has not been issued. An exception is when the database is not available because dynamic allocation failed. In this case, a call results in an AI (unable to open) status code. In a DCCTL environment, the status code is always NA. NU At least one of the databases that can be updated using this PCB is unavailable for update. An ISRT, DLET, or REPL call using this PCB might result in a BA status code if the INIT STATUS GROUPA call has been issued, or in a DFS3303I message and 3303 pseudoabend if it has not been issued. The database that caused the NU status code might be required only for delete processing. In that case, DLET calls fail, but ISRT and REPL calls succeed. The data that can be accessed with this PCB can be used for all functions the PCB allows. DEDBs and MSDBs always have the status code.
159
Actual Value
Explanation Provides the identifier from the execution parameters. Provides the release level for IMS. For example, X'00000410'. Indicates that an IMS batch region is active. Indicates that only the IMS Database Manager is active. (DBCTL system) Indicates that only the IMS Transaction Manager is active. (DCCTL system) Indicates that both the IMS Database and Transaction managers are active. (DBDC system) Indicates that the IMS Batch region is active. Indicates that the Batch Message Processing region is active. Indicates that the Database Resource Adapter Thread region is active. Indicates that the IMS Fast Path region is active. Indicates that the Message Processing region is active. Provides the region identifier. For example, X'00000001'. Provides the name of the application program being run. Provides the name of the PSB currently allocated. Provides the name of the transaction. Indicates that no associated transaction exists. Provides the user ID. Indicates that the user ID is unavailable.
4 8 8 8 8
User Identifier
160
Indicates an INIT STATUS GROUPA call is issued. Indicates an INIT STATUS GROUPB call is issued. Indicates that a status group is not initialized.
4 4 0
Provides the address of the LL field, followed by the recovery token. Provides the address of the LL field, followed by the application program parameter string. Indicates that the APARM= parameter is not coded in the execution parameters of the dependent region JCL. Indicates IMS is not using Shared Queues. SHRQ Indicates IMS is using Shared Queues.
4 4
Notes: 1. The user ID is derived from the PSTUSID field of the PST that represents the region making the INQY ENVIRON call. The PSTUSID field is one of the following: v For message-driven BMP regions that have not completed successful GU calls to the IMS message queue and for non-message-driven BMP regions, the PSTUSID field is derived from the name of the PSB that is currently scheduled into the BMP region. v For message-driven BMP regions that have completed a successful GU call and for any MPP region, the PSTUSID field is derived which is usually the input terminals RACF ID. If the terminal has not signed on to RACF, the ID is the input terminals LTERM. 2. The pointer identifies a length field (LL) that contains the length of the recovery token or application program parameter string in binary, including the two bytes required for LL.
When the INQY call is issued with the FIND subfunction, the application program is returned with the PCB address of the requested PCB name. The only valid PCB names that can be passed in AIBRSNM1 are IOPCB or the name of an alternate PCB or DB PCB, as defined in the PSB. On a FIND subfunction, the requested PCB remains unmodified, and no information is returned in an I/O area. The FIND subfunction is used to get a PCB address following an INQY DBQUERY call. This process allows the application program to analyze the PCB status code to determine if either an NA or NU status code is set in the PCB. | | | | | | | | | | When the LERUNOPT call is issued with the LERUNOPT subfunction, IMS determines if LE overrides are allowed based on the LEOPT system parameter. The LE override parameters are defined to IMS through the UPDATE LE command. IMS checks to see if there are any overrides applicable to the caller based on the specific combinations of transaction name, lterm name, userid, or program name in the callers environment. IMS will return the address of the string to the caller if an override parameter is found. The LE overrides are used by the IMS supplied CEEBXITA exit, DFSBXITA, to allow dynamic overrides for LE runtime parameters. Related Reading:
Chapter 5. Writing DL/I Calls for System Services
161
162
Restrictions
The INQY call is valid only when using the AIB. An INQY call issued through the PCB interface is rejected with an AD status code.
LOG Call
The Log (LOG) call is used to send and write information to the IMS system log.
Format
LOG io pcb aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the area in your program that contains the record that you want to write to the system log. This is an input parameter. This record must follow the format shown in Figure 42 on page 164. The format of this record is described in more detail following the figure.
163
Figure 42. Log Record Formats for COBOL, C, Assembler, Pascal and PL/I Programs
The fields must be: LL or LLLL Specifies a 2-byte field (or, for PL/I, a 4-byte-long field) to contain the length of the record. The length of the record is equal to LL + ZZ + C + text of the record. When you calculate the length of the log record, you must account for all fields. The total length you specify includes: v 2 bytes for LL or LLLL. (For PL/I, include the length as 2, even though LLLL is a 4-byte field.) v 2 bytes for the ZZ field. v 1 byte for the C field. v n bytes for the length of the record itself. If you are using the PLITDLI interface, your program must define the length field as a binary fullword. ZZ C Text Specifies a 2-byte field of binary zeros. Specifies a 1-byte field containing a log code, which must be equal to or greater than X'A0'. Specifies any data to be logged.
Usage
An application program can write a record to the system log by issuing the LOG call. When you issue the LOG call, specify the I/O area that contains the record you want written to the system log. You can write any information to the log, and you can use different log codes to distinguish between different types of information. You can issue the LOG call: v In a batch program, and the record is written to the IMS log v In an online program in the DBCTL environment, and the record is written to the DBCTL log v In the IMS DB/DC environment, and the record is written to the IMS log
Restrictions
The length of the I/O area (including all fields) cannot be larger than the logical record length (LRECL) for the system log data set, minus four bytes, or the I/O area specified in the IOASIZE keyword of the PSBGEN statement of the PSB. For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
164
Format
PCB psb name uibptr sysserve
DB/DC X
DBCTL X
DCCTL
DB Batch
TM Batch
Parameters
The AIB is not valid for PCB calls. psb name Specifies the PSB. An asterisk can be used for the parameter to indicate the default. This parameter is an input parameter. uibptr Specifies a pointer, which is set to the address of the UIB after the call. This parameter is an output parameter. sysserve Specifies an optional 8-byte field that contains either IOPCB or NOIOPCB. This parameter is an input parameter.
Usage
Before a CICS online program can issue any DL/I calls, it must indicate to DL/I its intent to use a particular PSB. A PCB call accomplishes this and also obtains the address of the PCB list in the PSB. When you issue a PCB call, specify the following: v The call function: PCB v The PSB you want to use, or an asterisk to indicate that you want to use the default name. The default PSB name is not necessarily the name of the program issuing the PCB call, because that program could have been called by another program. v A pointer, which is set to the address of the UIB after the call. For more information on defining and establishing addressability to the UIB, see Specifying the UIB (CICS Online Programs Only) on page 96. v The system service call parameter that names an optional 8-byte field that contains either IOPCB or NOIOPCB.
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
165
RCMD Call
A Retrieve Command (RCMD) call enables an automated operator (AO) application program retrieve the second and subsequent command response segments after an ICMD call.
Format
RCMD aib i/o area
Parameters
aib Specifies the application interface block (AIB) used for this call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. This field is not changed by IMS. AIBOAUSE Length of data returned in the I/O area. This parameter is an output parameter. When partial data is returned because the I/O area is not large enough, AIBOAUSE contains the length required to receive all of the data, and AIBOALEN contains the actual length of the data. i/o area Specifies the I/O area to use for this call. This parameter is an output parameter. The I/O area should be large enough to hold the largest command response segment that is passed from IMS to the AO application program. If the I/O area is not large enough for all of the information, partial data is returned in the I/O area.
Usage
RCMD lets an AO application program retrieve the second and subsequent command response segments resulting from an ICMD call. Related Reading For more information on the AOI exits, see IMS Version 8 Customization Guide. Table 21 on page 167 shows, by IMS environment, the types of AO application programs that can issue RCMD. RCMD is also supported from a CPI-C driven program.
166
RCMD retrieves only one response segment at a time. If you need additional response segments, you must issue RCMD one time for each response segment that is issued by IMS.
Restrictions
An ICMD call must be issued before an RCMD call.
ROLB Call
The Roll Back (ROLB) call is used to dynamically back out database changes and return control to your program. For more information on the ROLB call, see Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) on page 242. The ODBA interface does not support this call.
Format
ROLB i/o pcb aib i/o area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained.
167
Restrictions
The AIB must specify the I/O PCB for this call.
ROLL Call
The Roll (ROLL) call is used to abnormally terminate your program and to dynamically back out database changes. For more information on the ROLL call, see Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) on page 242. The ODBA interface does not support this call.
Format
ROLL
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
The only parameter required for the ROLL call is the call function.
Usage
When you issue a ROLL call, IMS terminates the application program with a U0778 abend.
Restriction
Unlike the ROLB call, the ROLL call does not return control to the program.
ROLS Call
The Roll Back to SETS (ROLS) call is used to back out to a processing point set by a prior SETS or SETU call. For more information on the ROLS call, see Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) on page 242.
Format
168
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
db pcb Specifies the DB PCB for the call. This parameter is an input and output parameter. i/o pcb Specifies the I/O PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB , or the name of a DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the I/O area has the same format as the I/O area supplied on the SETS call. This parameter is an output parameter. token Specifies the area in your program that contains a 4-byte identifier. This parameter is an input parameter.
Usage
When you use the Roll Back to SETS (ROLS) call to back out to a processing point set by a prior SETS or SETU, the ROLS enables you to continue processing or to back out to the prior commit point and place the input message on the suspend queue for later processing. Issuing a ROLS call for a DB PCB can result in the user abend code 3303.
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
169
SETS/SETU Call
The Set a Backout Point (SETS) call is used to set an intermediate backout point or to cancel all existing backout points. The SET Unconditional (SETU) call operates like the SETS call, except that the SETU call is accepted even if unsupported PCBs exist or an external subsystem is used. For more information on the SETS and SETU calls, see Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions) on page 242.
Format
SETS SETU i/o pcb aib i/o area token
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. SETS and SETU must refer to the I/O PCB. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB . AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list. i/o area Specifies the area in your program that contains the data to be returned on the corresponding ROLS call. This parameter is an input parameter. token Specifies the area in your program that contains a 4-byte identifier. This parameter is an input parameter.
Usage
The SETS and SETU format and parameters are the same, except for the call functions, SETS and SETU.
170
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL. The SETS call is not valid when the PSB contains a DEDB or MSDB PCB, or when the call is made to a DB2 database. The SETU call is valid, but not functional, if unsupported PCBs exist in the PSB or if the program uses an external subsystem.
SNAP Call
This section contains product-sensitive programming interface information. The SNAP call is used to collect diagnostic information.
Format
SNAP db pcb aib i/o area
DB/DC X
DBCTL X
DCCTL
DB Batch X
TM Batch
Parameters
db pcb Specifies the address that refers to a full-function PCB that is defined in a calling program PSB. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a full-function DB PCB.
171
| | | |
12 10 2
If you specify another length, IMS uses default values for the destination, identification, and SNAP operation parameters.
172
19-22 19
cccc
19-21 22
ALL
N S
173
Usage
Any application program can issue this call.
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
STAT Call
This section contains product-sensitive programming interface information. The Statistics (STAT) call is used in a CICS, IMS online, or batch program to obtain database statistics that might be useful for performance monitoring.
Format
STAT db pcb aib i/o area stat function
DB/DC X
DBCTL X
DCCTL
DB Batch X
TM Batch
Parameters
db pcb Specifies the DB PCB used to pass status information to the application program. The VSAM statistics used by the data sets associated with this PCB are not related to the type of statistics that is returned from the STAT call. This PCB must reference a full-function database. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the name of a full-function DB PCB. AIBOALEN I/O area length. This field must contain the length of the I/O area specified in the call list.
174
O S
Full statistics to be unformatted. If you specify U, your I/O area must be at least 72 bytes. v 4 bytes of EBCDIC blanks for normal or enhanced STAT call, or E1 , for extended STAT call. Restriction: The extended format parameter is supported by the DBESO, DBESU, and DBESF functions only. Extended OSAM buffer pool statistics can be retrieved by including the parameter E1 following the enhanced call function. The extended STAT call returns all of the statistics returned with the enhanced call, plus the statistics on the coupling facility buffer invalidates, OSAM caching, and sequential buffering IMMED and SYNC read counts.
Usage
The STAT call can be helpful in debugging because it retrieves IMS database statistics. It is also helpful in monitoring and tuning for performance. The STAT call retrieves OSAM database buffer pool statistics and VSAM database buffer supports. When you request VSAM statistics, each issued STAT call retrieves the statistics for a subpool. Statistics are retrieved for all VSAM local shared resource pools in the order in which they are defined. For each local shared resource pool, statistics are retrieved in ascending order based on buffer size. Statistics for index subpools always follow those for data subpools if any index subpool exists in the shared resource pool. The index subpools are also retrieved in ascending order based on buffer size.
Chapter 5. Writing DL/I Calls for System Services
175
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
SYNC Call
The Synchronization Point (SYNC) call is used to release resources that IMS has locked for the application program. The ODBA interface does not support this call.
Format
SYNC i/o pcb aib
DB/DC X
DBCTL X
DCCTL X
DB Batch
TM Batch
Parameters
i/o pcb Specifies the IO PCB for the call. This parameter is an input and output parameter. aib Specifies the AIB for the call. This parameter is an input and output parameter. The following fields must be initialized in the AIB: AIBID Eye catcher. This 8-byte field must contain DFSAIB . AIBLEN AIB lengths. This field must contain the actual length of the AIB that the application program obtained. AIBRSNM1 Resource name. This 8-byte, left-justified field must contain the PCB name, IOPCB .
Usage
SYNC commits the changes your program has made to the database, and establishes places in your program from which you can restart, if your program terminates abnormally.
Restrictions
The SYNC call is valid only in non-message driven BMPs; you cannot issue a SYNC call from an CPI-C driven application program. For important considerations about using the SYNC call, see IMS Version 8: Administration Guide: Database Manager.
176
Format
TERM
DB/DC X
DBCTL X
DCCTL
DB Batch
TM Batch
Usage
If your program needs to use more than one PSB, you must issue a TERM call to release the first PSB it uses and then issue a second PCB call to schedule the second PSB. The TERM call also commits database changes. The only parameter in the TERM call is the call function: TERM or T . When your program issues the call, CICS terminates the scheduled PSB, causes a CICS sync point, commits changes, and frees resources for other tasks.
Restrictions
For function shipping in the CICS environment, the local and remote CICS must both be DBCTL.
XRST Call
The Extended Restart (XRST) call is used to restart your program. If you use the symbolic Checkpoint call in your program, you must precede it with an XRST call that specifies checkpoint data of blanks. The ODBA interface does not support this call.
Format
XRST i/o pcb aib i/o area length i/o area
area length
area
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Parameters
i/o pcb Specifies the I/O PCB for the call. XRST must refer to the I/O PCB. This parameter is an input and output parameter.
Chapter 5. Writing DL/I Calls for System Services
177
Usage
Programs that wish to issue Symbolic Checkpoint calls (CHKP) must also issue the Extended Restart call (XRST). The XRST call must be issued only once and should be issued early in the execution of the program. It does not need to be the first call in the program. However, it must precede any CHKP call. Any Database calls issued before the XRST call are not within the scope of a restart. To determine whether to perform a normal start or a restart, IMS evaluates the I/O area provided by the XRST call or CKPTID= value in the PARM field on the EXEC statement in your programs JCL.
178
The XRST call attempts to reposition all databases to the position that was held when the last checkpoint was taken. This is done by including each PCB and PCB
Chapter 5. Writing DL/I Calls for System Services
179
Restrictions
If your program is being started normally, the first 5 bytes of the I/O area must be set to blanks. If your program is restarted and the CKPTID= value in the PARM field of the EXEC statement is not used, then the right-most bytes beyond the checkpoint ID being used in the I/O area must be set to blanks. The XRST call is allowed only from Batch and BMP application programs.
180
The structure in the figure contains six segment types: A, B, C, D, E, and F. Figure 44 on page 182 shows one database record, the root which is A1.
181
When you issue this call, IMS returns the D segment with the key D111, regardless of where your position is when you issue the call. If this is the first call your program issues (and if this is the first database record in the database), current position before you issue the call is immediately before the first segment occurrence in the databasejust before the A segment with the key of A1. Even if current position is past segment D111 when you issue the call (for example, just before segment F111), IMS still returns the segment D111 to your program. This is also true if the current position is in a different database record. When you issue GN and GNP calls, current position in the database affects the way that you code the call and the SSAs. That is because when IMS searches for a segment described in a GN or GNP call, it starts the search from current position and can only search forward in the database. IMS cannot look behind that segment occurrence to satisfy a GN or GNP. These calls can only move forward in the database when trying to satisfy your call, unless you use the F command code, the use of which is described in The F Command Code on page 31. If you issue a GN call for a segment occurrence that you have already passed, IMS starts searching at the current position and stops searching when it reaches the end of the database (resulting in a GB status code), or when it determines from your SSAs that it cannot find the segment you have requested (GE status code). Current Position after Unsuccessful Calls on page 186 explains where your position is when you receive a GE status code. Current position affects ISRT calls when you do not supply qualified SSAs for the parents of the segment occurrence that you are inserting. If you supply only the unqualified SSA for the segment occurrence, you must be sure that your position in the database is where you want the segment occurrence to be inserted.
182
Your current position is the same after retrieving segment C111, whether you retrieve it with GU, GN, GNP, or any of the Get Hold calls. If you retrieve several segment occurrences by issuing a Get call with the D command code, current position is immediately after the lowest segment occurrence that you retrieved. If you issue the GU call that was shown above but include the D command code in the SSAs for segments A and B, current position is still immediately after segment C111. C111 is the last segment that IMS retrieves for this call. With the D command code, the call looks like this:
GU A B C *D(AKEY = A1) *D(BKEY = B11) (CKEY = C111)
You do not need the D command code on the SSA for the C segment because IMS always returns to your I/O area the segment occurrence that is described in the last SSA.
Figure 45 on page 184 shows what the hierarchy looks like after this call.
183
When you issue a successful DLET call for a segment occurrence that has dependents, IMS deletes the dependents, and the segment occurrence. Current position is still immediately after the segment occurrence you deleted. An unqualified GN call returns the segment occurrence that followed the segment you deleted. Example: If you delete segment B11 in the hierarchy shown in Figure 45, IMS deletes its dependent segments, C112 and D111, as well. Current position is immediately after segment B11, just before segment B12. If you then issue an unqualified GN call, IMS returns segment B12. Figure 46 shows what the hierarchy looks like after you issued this call.
Because IMS deletes the segments dependents, you can think of current position as being immediately after the last (lowest, right-most) dependent. In the example in Figure 45, this is immediately after segment D111. But if you then issue an unqualified GN call, IMS still returns segment B12. You can think of position in either
184
If you are inserting a segment that has a unique key, IMS places the new segment in key sequence. If you are inserting a segment that has either a non unique key or no key at all, IMS places the segment according to the rules parameter of the SEGM statement of the DBD for the database. ISRT Call on page 132 explains these rules. If you insert several segment occurrences using the D command code, current position is immediately after the lowest segment occurrence that is inserted. Example: Suppose you insert a new segment B (this would be B14), and a new C segment occurrence (C141), which is a dependent of B14. Figure 47 on page 186 shows what the hierarchy looks like after you insert these segment occurrences. The call to do this looks like this:
ISRT A B C (AKEY *D = A1)
You do not need the D command code in the SSA for the C segment. On ISRT calls, you must include the D command code in the SSA for the only first segment you are inserting. After you issue this call, position is immediately after the C segment occurrence with the key of C141. Then, if you issue an unqualified GN call, IMS returns segment E11. If your program receives an II status code as a result of an ISRT call (which means that the segment you tried to insert already exists in the database), current position is just before the duplicate of the segment that you tried to insert.
185
186
When IMS searches for a segment occurrence, it accepts the first segment occurrence it encounters that satisfies the call. As it does so, IMS stores the key of that segment occurrence in the key feedback area.
187
IMS establishes position on segment A1 and segment B11. Because A1 and B11 satisfy the first two SSAs in the call, IMS stores their keys in the key feedback area. IMS searches for a segment C113 under segment B11. None is found. But this time, IMS can continue searching, because the key of the B parent can be greater than or equal to B11. The next segment is B12. Because B12 satisfies the qualification for segment B, IMS places B12s key in the key feedback area. IMS then looks for a C113 under B12 and does not find one. The same thing happens for B13: IMS places the key of B13 in the key feedback area and looks for a C113 under B13. When IMS finds no more B segments under A1, it again tries to move forward to look for B and C segments that satisfy the call under another A parent. But this time it cannot; the SSA for the A segment specifies that the A segment must be equal to A1. (If the keys were non unique, IMS could look for another A1 segment.) IMS
188
After you issue this call, the key feedback area contains the key for segment B11. If you continue issuing this call until you receive a GE status code, IMSs current position is immediately after segment B13, but the key feedback area still contains only the key for segment B11. Of the B segments IMS examines, only one of them (B11) satisfies the SSA in the call. When you use a greater-than or greater-than-or-equal-to relational operator, you do not limit IMSs search. If you get a GE status code on this kind of call, and if one or more of the segments IMS examines does not satisfy an SSA, IMSs position in the database may be further than the position reflected in the key feedback area. If, when you issue the next GN or GNP call, you want IMS to start searching from the position reflected in the key feedback area instead of from its real position, you can either: v Issue a fully qualified GU call to reestablish position to where you want it. v Issue a GN or GNP call with the U command code. Including a U command code on an SSA tells IMS to use the first position it established at that level as qualification for the call. This is like supplying an equal-to relational operator for the segment occurrence that IMS has positioned on at that level. Example: Suppose that you first issue the GU call with the greater-than-or-equal-to relational operator in the SSA for segment B, and then you issue this GN call:
GN A B C *U *U
The U command code tells IMS to use segment A1 as the A parent, and segment B11 as the B parent. IMS returns segment C111. But if you issue the same call without the U command code, IMS starts searching from segment B13 and moves forward to the next database record until it encounters a B segment. IMS returns the first B segment it encounters.
Chapter 6. Monitoring Your Position in the Database
189
190
Logical OR
One more Boolean operator exists and is called the independent AND. Use it only with secondary indexes. Multiple Qualification Statements with Secondary Indexes on page 204 describes its use. For a segment to satisfy multiple qualification statements, the segment must satisfy a set of qualification statements. A set is a number of qualification statements that are joined by an AND. To satisfy a set, a segment must satisfy each of the qualification statements within that set. Each OR starts a new set of qualification statements. When processing multiple qualification statements, IMS reads them left to right and processes them in that order. When you include multiple qualification statements for a root segment, the fields you name in the qualification statements affect the range of roots that IMS examines to satisfy the call. DL/I examines the qualification statements to determine the minimum acceptable key value. If one or more of the sets do not include at least one statement that is qualified on the key field with an operator of equal-to, greater-than, or equal-to-or-greater-than, IMS starts at the first root of the database and searches for a root that meets the qualification. If each set contains at least one statement that is qualified on the key field with an equal-to, greater-than, or equal-to-or-greater-than operator, IMS uses the lowest of these keys as the starting place for its search. After establishing the starting position for the search, IMS processes the call by searching forward sequentially in the database, similar to the way it processes GN calls. IMS examines each root it
191
In this case, the minimum and maximum key is 10. This means that IMS starts searching with key 10 and stops when it encounters the first key greater than 10. To satisfy the SSA, the ROOTKEY field must be equal to 10, and FIELDB must be equal to either ABC or XYZ.
ROOTKEY =>10&ROOTKEY =<20
In this case, the minimum key is 10 and the maximum key is 20. Keys in the range of 10 to 20 satisfy the SSA. IMS stops the search when it encounters the first key greater than 20.
ROOTKEY =>10&ROOTKEY =<20+ROOTKEY =>110&ROOTKEY =<120
In this case, the minimum key is 10 and the maximum key is 120. Keys in the range of 10 to 20 and 110 to 120 satisfy the call. IMS stops the search when it encounters the first key greater than 120. IMS does not scan from 20 to 110 but skips forward (using the index for HIDAM or PHIDAM) from 20 to 110. Because of this, you can use ranges for more efficient program operation. When you use multiple qualification statement segments that are part of logical relationships, additional considerations exist. See How Logical Relationships Affect Your Programming on page 208 for more information about these considerations.
192
To satisfy this request, the value for ILLDATE must satisfy either of the two sets. IMS returns any ILLNESS segment occurrences for the month of January 1992, or for the month of July 1992.
193
194
In this Chapter: v Multiple Positioning v Advantages of Using Multiple Positioning on page 198 v Using Multiple DB PCBs on page 200
Multiple Positioning
When you define the PSB for your application program, you have a choice about the kind of positioning you want to use: single or multiple. All of the examples used so far, and the explanations about current position, have used single positioning. This section explains what multiple positioning is, why it is useful, and how it affects your programming. Specify the kind of position you want to use for each PCB on the PCB statement when you define the PSB. The POS operand for a DEDB is disregarded. DEDBs support multiple positioning only. Definitions:
Copyright IBM Corp. 1974, 2002
195
Multiple Positioning
v Single positioning means that IMS maintains position in one hierarchic path for the hierarchy that is defined by that PCB. When you retrieve a segment, IMS clears position for all dependents and all segments on the same level. v Multiple positioning means that IMS maintains position in each hierarchic path in the database record that is being accessed. When you retrieve a segment, IMS clears position for all dependents but keeps position for segments at the same level. Example: Suppose you issue these two calls using the hierarchy shown in Figure 50:
GU A B C E (AKEY (BKEY (CKEY (EKEY = A1) = B11) = C111) = E11)
GN
After issuing the first call with single positioning, IMS has three positions established: one on A1, one on B11, and one on C111. After issuing the second call, the positions on B11 and C111 are canceled. Then IMS establishes positions on A1 and E11. After issuing the first call with multiple positioning, IMS has three positions established (just as with single positioning): one on A1, one on B11, and one on C111. But after issuing the second call, the positions on B11 and C111 are retained. In addition to these positions, IMS establishes position on segments A1 and E11.
196
Multiple Positioning
The examples that follow compare the results of single and multiple positioning using the hierarchy in Figure 51.
Table 23. Results of Single and Multiple Positioning with DL/I Calls Sequence Example 1 GU (where AKEY equals A1) GNP B GNP C GNP B GNP C GNP B GNP C GNP B GNP C Example 2 GU A (where AKEY equals A1) GN B GN C GN B GN C Example 3 GU A (where AKEY equals A1) GN C GN B GN B GN C Example 4 GU A (where AKEY equals A1) GN B GN C GN D GN E GN B GN D GN C GN E Result of Single Positioning Result of Multiple Positioning
A1 B11 C11 Not found C12 Not found C13 Not found Not found A1 B11 C11 B21 C21 A1 C11 B21 B22 C21 A1 B11 C11 D111 E111 B21 D221 C under next A E under next A
A1 B11 C11 B12 C12 Not found C13 Not found Not found A1 B11 C11 B12 C12 A1 C11 B11 B12 C12 A1 B11 C11 D111 E111 B12 D112 C12 E121
197
Multiple Positioning
Multiple positioning is useful when you want to examine or compare segments in two hierarchic paths. It lets you process different segment types under the same parent in parallel. Without multiple positioning, you would have to issue GU calls to reestablish position in each path.
198
Multiple Positioning
When your program issues a GN or GNP call, IMS tries to satisfy the call by moving forward from current position. When you use multiple positioning, more than one current position exist: IMS maintains a position at each level in all hierarchic paths, instead of at each level in one hierarchic path. To satisfy GN and GNP calls with multiple positioning, IMS moves forward from the current position in the path that is referred to in the SSAs.
When your program issues the unqualified GN call, IMS uses the position that is established by the last call, the call for the E segment, to satisfy the unqualified call. 2. After you successfully retrieve a segment with an unqualified GN or GNP, IMS establishes position in only one hierarchic path: the path containing the segment just retrieved. IMS cancels positions in other hierarchic paths. IMS establishes current position on the segment that is retrieved and sets parentage on the parent of the segment that is retrieved. If, after issuing an unqualified call, you issue a qualified call for a segment in a different hierarchic path, the results are unpredictable. For example:
Your program issues these calls: GU A (where AKEY = A1) GN B GN E GN GN B DL/I returns these segments: A1 B11 E11 F111 unpredictable
When you issue the unqualified GN call, IMS no longer maintains a position in the other hierarchic path, so the results of the GN call for the B segment are unpredictable. 3. If you issue an unqualified GN or GNP call and IMS has a position established on a segment that the unqualified call might encounter, the results of the call are
Chapter 8. Multiple Processing
199
Multiple Positioning
unpredictable. Also, when you issue an unqualified call and you have established position on the segment that the call should retrieve, the results are unpredictable. For example:
Your program issues these calls: GU A (where AKEY = A1) GN E GN D GN B GN B GN DL/I returns these segments: A1 E11 D111 B12 B13 E11 (The only position IMS has is the one established by the GN call.)
In this example, IMS has a position established on E11. An unqualified GN call moves forward from the position that is established by the previous call. Multiple positions are lost; the only position IMS has is the position that is established by the GN call. To summarize these rules: 1. To satisfy an unqualified GN or GNP call, IMS uses the position established in the last call for that PCB. 2. If an unqualified GN or GNP call is successful, IMS cancels positions in all other hierarchic paths. Position is maintained only within the path of the segment retrieved.
Or, if you wanted to continue processing segments in record A1, you issue this call to cancel all positions in record A1:
GU A (AKEY = A1)
200
201
202
203
The distinction between the two ANDs applies only when the indexed field (the one defined as XDFLD in the DBD) is used in all qualifications. If one of the qualification statements uses another field, both ANDs work like the dependent AND. The next two sections give examples of the dependent and independent AND. Although the examples show only two qualification statements in the SSA, you can use more than two. No set limit exists for the number of qualification statements you can include in an SSA, but a limit on the maximum size of the SSA does exist. You specify this size on the SSASIZE parameter of the PSBGEN statement. For information on this parameter, see IMS Version 8: Utilities Reference: System.
204
To satisfy this call, IMS searches for one pointer segment with a value between 500 and 1000. IMS returns the PATIENT segment that is pointed to by that segment.
You want IMS to find two pointer segments in the index that point to the same PATIENT segment, one with ILLNAME equal to TONSILLITIS and one with ILLNAME equal to STREPTHRT. Use this call:
GU PATIENT (XILLNAME=TONSILITIS#XILLNAME= STREPTHRT)
This call retrieves the first PATIENT segment with ILLNESS segments of strep throat and tonsillitis. When you issue the call, IMS searches for an index entry for tonsillitis. Then it searches for an index entry for strep throat that points to the same PATIENT segment. When you use the independent AND with GN and GNP calls, a special situation can occur. If you repeat a GN or a GNP call using the same qualification, it is possible for
205
206
Three types of segments are found in a logical relationship: v TREATMNT is called the logical parent segment. It is a physical dependent of ILLNESS, but it can be processed through the item hierarchy because a path is established by the logical child segment DISBURSE. The logical parent segment can be accessed through both hierarchies, but it is stored in only one place.
Chapter 9. Secondary Indexing and Logical Relationships
207
LL is the length field of the logical parent if this segment is a variable-length segment.
208
IX
RX
209
210
211
Byte Length 8 2 2 4 4 8 4
5
Length of key feedback area and undefined-length records area7 Number of sensitive segments8 Key feedback area9 Length of undefined-length records10
4 8 4
N/A X X
N/A X X
N/A X X
N/A X X
N/A X X
212
213
214
215
216
GU
Get Unique
ISRT
Insert
OPEN
Open
Can specify printer function, gsam pcb [, open or punch control option] characters
217
Restriction: Do not use BFALN, BUFL, BUFOFF, FUNC, NCP, and KEYLEN.
218
219
EXEC DD DD DD DD DD DD DD DD DD . . .
PGM=DFSRRC00,PARM=[BMP|DBB|DLI],... DSN=executionlibrary-name,DISP=SHR DSN=pgmlib-name,DISP=SHR DSN=psblib-name,DISP=SHR DSN=dbdlib-name,DISP=SHR DSN=acblib-name,disp=shr (required for DBB) SYSOUT=A SYSOUT=A (add DD statements for required GSAM databases) (add DD statements for non-GSAM IMS databases for DLI/DBB)
/*
220
Related Reading: For more information on the types of processing requirements the two types of Fast Path databases satisfy, see IMS Version 8: Administration Guide: Database Manager. This section contains information on how to write programs to access data in MSDBs and DEDBs.
Function Code DEQ FLD GU, GHU GN, GHN GNP, GHNP DLET ISRT POS REPL
DEDBs X
X X X
X X X
X X X X X
X X X X X X
221
MSDBs
MSDBs contain only root segments. Each segment is like a database record, because the segment contains all of the information about a particular subject. In a DL/I hierarchy, a database record is made up of a root segment and all its dependents. For example, in the medical hierarchy, a particular PATIENT segment and all the segments underneath that PATIENT segment comprise the database record for that patient. In an MSDB, the segment is the whole database record. The database record contains only the fields that the segment contains. MSDB segments are fixed length.
Types of MSDBs
The two kinds of MSDBs are terminal related and non-terminal related. In terminal-related MSDBs, each segment is owned by one logical terminal. The segment that is owned can be updated only by that terminal. Related MSDBs can be fixed or dynamic. You can add segments to and delete segments from dynamic related MSDBs. You cannot add segments to or delete segments from fixed related MSDBs. In the second kind of MSDB, called non-terminal related (or nonrelated) MSDBs, the segments are not owned by logical terminals. One way to understand the
222
DEDBs
A DEDB contains a root segment and as many as 127 dependent segment types. One of these can be a sequential dependent; the other 126 are direct dependents. Sequential dependent segments are stored in chronological order. Direct dependent segments are stored hierarchically. DEDBs can provide high data availability. Each DEDB can be partitioned, or divided into multiple areas. Each area contains a different collection of database records. In addition, you can make as many as seven copies of each area data set. If an error exists in one copy of an area, application programs continue to access the data by using another copy of that area. Use of the copy of an area is transparent to the application program. When an error occurs to data in a DEDB, IMS does not stop the database. IMS makes the data in error unavailable but continues to schedule and process application programs. Programs that do not need the data in error are unaffected. DEDBs can be shared among application programs in separate IMS systems. Sharing DEDBs is virtually the same as sharing full-function databases, and most of the same rules apply. IMS systems can share DEDBs at the area level (instead of at the database level as with full-function databases), or at the block level. Related Reading: For more information on DEDB data sharing, see the explanation of administering IMS systems that share data in IMS Version 8: Administration Guide: System.
223
A FLD/VERIFY call compares the contents of a specified field in a segment to the value that you supply. The way that a FLD/VERIFY call compares the two depends on the operator you supply. When you supply the name of a field and a value for comparison, you can determine if the value in the field is: v v v v v Equal to the value you have supplied Greater than the value you have supplied Greater than or equal to the value you have supplied Less than the value you have supplied Less than or equal to the value you have supplied
v Not equal to the value you have supplied After IMS performs the comparison that you have asked for, it returns a status code (in addition to the status code in the PCB) to tell you the results of the comparison. You specify the name of the field and the value that you want its value compared to in a field search argument, or FSA. The FSA is also where IMS returns the status code. You place the FSA in an I/O area before you issue a FLD call, and then you reference that I/O area in the calljust as you do for an SSA in a DL/I call. An FSA is similar to an SSA in that you use it to give information to IMS about the information you want to retrieve from the database. An FSA, however, contains more information than an SSA. Figure 57 shows the structure and format of an FSA.
224
Operator (OP) This tells IMS how you want the two values compared. For a FLD/VERIFY call, you can specify: E G H L M N Verify that the value in the field is equal to the value you have supplied in the FSA. Verify that the value in the field is greater than the value you have supplied in the FSA. Verify that the value in the field is greater than or equal to the value you have supplied in the FSA. Verify that the value in the field is less than the value you have supplied in the FSA. Verify that the value in the field is less than or equal to the value you have supplied in the FSA. Verify that the value in the field is not equal to the value you have supplied in the FSA.
Field Value (FLD Value) This area contains the value that you want IMS to compare to the value in the segment field. The data that you supply in this area must be the same type of data in the field you have named in the first field of the FSA. The five types of data are: hexadecimal, packed decimal, alphanumeric (or a combination of data types), binary fullword, and binary halfword. The length of the data in this area must be the same as the length that is defined for this field in the DBD. Exceptions: v If you are processing hexadecimal data, the data in the FSA must be in hexadecimal. This means that the length of the data in the FSA is twice the length of the data in the field in the database. IMS checks the characters in hexadecimal fields for validity before that data is translated to database format. (Only 0 to 9 and A to F are valid characters.) v For packed-decimal data, you do not need to supply the leading zeros in the field value. This means that the number of digits in the FSA might be less than the number of digits in the corresponding database field. The data that you supply in this field must be in a valid packed-decimal format and must end in a sign digit.
Chapter 11. Processing Fast Path Databases
225
226
The last character in the FSA is an asterisk, because this FSA will be followed by other FSAs. 2. Subtract $100 from the value in the BALANCE field if the first FSA is successful. If the first FSA is unsuccessful, IMS does not continue processing. To subtract the amount of the withdrawal from the amount of the balance, you use this FSA:
BALANCE -10000*
Again, the last character in the FSA is an asterisk, because this FSA is followed by a third FSA. 3. Add 1 to the transaction count for the account. To do this, use this FSA:
TRANCNT +001
In this FSA, the last character is a blank ( ), because this is the last FSA for this call. When you issue the FLD call, you do not reference each FSA individually; you reference the I/O area that contains all of them.
227
VSO Considerations
VSO is transparent to the processing of an application. Where the data resides is immaterial to the application.
228
1. This section does not apply to CICS users. Chapter 11. Processing Fast Path Databases
229
Figure 59. Processing a Long Chain of Segment Occurrences with Subset Pointers
You can use subset pointers at any level of the database hierarchy, except at the root level. If you try to use subset pointers at the root level, they are ignored. Figure 60 on page 231 and Figure 61 on page 231 show some of the ways you can set subset pointers. Subset pointers are independent of one another, which means that you can set one or more pointers to any segment in the chain. For example, you can set more than one subset pointer to a segment, as shown in Figure 60.
230
You can also define a one-to-one relationship between the pointers and the segments, as shown in Figure 61.
Figure 62 on page 232 shows how the use of subset pointers divides a chain of segment occurrences under the same parent into subsets. Each subset ends with the last segment in the entire chain. For example, the last segment in the subset that is defined by subset pointer 1 is B7.
231
232
To use a subset pointer command code with a qualified SSA, use the command code and subset pointer number immediately before the left parenthesis of the qualification statement, as shown in Figure 64.
The examples in this section use calls with unqualified SSAs. The examples are based on Sample Application, which is described in Fast Path Coding Considerations on page 239. Inserting Segments in a Subset: When you use the R command code to insert an unkeyed segment in a subset, the new segment is inserted before the first segment occurrence in the subset. However, the subset pointer is not automatically set to the new segment occurrence. Example: The following call inserts a new B segment occurrence in front of segment B5, but does not set subset pointer 1 to point to the new B segment occurrence:
ISRT A B (Akey *R1 = A1)
To set subset pointer 1 to the new segment, you use the S command code along with the R command code, as shown in the following example:
ISRT A B (Akey *R1S1 = A1)
If the subset does not exist (subset pointer 1 is set to 0), the segment is added to the end of the segment chain. Deleting the Segment Pointed to by a Subset Pointer: If you delete the segment pointed to by a subset pointer, the subset pointer points to the next segment occurrence in the chain. If the segment you delete is the last segment in the chain, the subset pointer is set to 0. Combining Command Codes: You can use the S, M, and W command codes with other command codes, and you can combine subset pointer command codes with each other, as long as they do not conflict. For example, you can use R and S
Chapter 11. Processing Fast Path Databases
233
234
Field 1 Field 1
Field 2 Field 2
Field 1 Area name Field 2 Sequential dependent location from qualified SSA Field 3 Unused CIs in sequential dependent part Field 4 Unused CIs in independent overflow part Field 5 Committed sequential dependent segment timestamp Field 6 IMS ID Field 7 Pad
After a successful POS call, the I/O area contains: LL (Not shown in table) A 2-byte field containing the total length of the data in the I/O area, in binary.
235
236
237
Data Locking
For information on how data locking is handled for DEDBs, see Data Locking for MSDBs and DEDBs on page 228.
238
239
240
Issuing Checkpoints
Two kinds of checkpoint (CHKP) calls exist: the basic CHKP and the symbolic CHKP. All IMS programs and CICS shared database programs can issue the basic CHKP call; only BMPs and batch programs can use either call. IMS Version 8: Application Programming: Design Guide explains when and why you should issue checkpoints in your program. Both checkpoint calls cause a loss of database position when the call is issued, so you must reestablish position with a GU call or some other method. You cannot reestablish position in the middle of non unique keys or nonkeyed segments. Restriction: You must not specify CHKPT=EOV on any DD statement to take an IMS checkpoint. Some differences exist if you issue the same call sequence against a full-function database or a DEDB, and an MSDB. For more information about the differences, see Commit-Point Processing in MSDBs and DEDBs on page 227. Depending on the database organization, a CHKP call can result in the database position for the PCB being reset. When the CHKP call is issued, the locks held by the program are released. Therefore, if locks are necessary for maintaining your database position, the position is reset by the CHKP call. Position is reset in all cases except those in which the organization is either GSAM (locks are not used) or DEDB, and the CHKP call is issued following a GC status code. For a DEDB, the position is maintained at the unit-of-work boundary. Issuing a CHKP resets the destination of the modifiable alternate PCB. Related Reading: For more information on CHKP calls, see CHKP (Basic) Call on page 144 and CHKP (Symbolic) Call on page 145.
241
Maintaining Database Integrity (IMS Batch, BMP, and IMS Online Regions)
IMS uses the following DL/I calls to back out database updates: ROLB, ROLL, ROLS, SETS, and SETU. The ROLB and ROLS calls can back out the database updates or cancel the output messages that the program has created since the programs most recent commit point. A ROLL call backs out the database updates and cancels any non-express output messages the program has created since the last commit point. It also deletes the current input message. SETS allows multiple intermediate backout points to be noted during application program processing. SETU operates like SETS except that it is not rejected by unsupported PCBs in the PSB. If your program issues a subsequent ROLS call specifying one of these points, database updates and message activity performed since that point are backed out. CICS online programs with DBCTL can use the ROLS and SETS or SETU DL/I calls to back out database changes to a previous commit point or to an intermediate backout point.
242
ROLL X X
1
ROLS X X1
Because IMS has the complete message (MSG1) and because an express PCB is being used, the message can be sent before a commit point. 2. Returned only if you supply the address of an I/O area as one of the call parameters. 3. The transaction is suspended and requeued for subsequent processing.
Using ROLL
A ROLL call backs out the database updates and cancels any non-express output messages the program has created since the last commit point. It also deletes the current input message. Any other input messages that were processed since the last commit point are returned to the queue to be reprocessed. IMS then terminates the program with an abend code U0778. This type of abnormal termination terminates the program without a storage dump. When you issue a ROLL call, the only parameter you supply is the call function, ROLL. You can use the ROLL call in a batch program. If your system log is on DASD, and if dynamic backout has been specified through the use of the BKO execution parameter, database changes made since the last commit point will be backed out; otherwise they will not. One reason for issuing ROLL in a batch program is for compatibility. After backout is complete, the original transaction is discarded if it can be, and it is not re-executed. IMS issues the APPC/MVS verb, ATBCMTP TYPE(ABEND), specifying the TPI to notify remote transaction programs. Issuing the APPC/MVS verb causes all active conversations (including any that are spawned by the application program) to be DEALLOCATED TYP(ABEND_SVC).
243
Using ROLB
244
Using ROLS
245
The SETS call sets up to nine intermediate backout points or cancels all existing backout points. With the SETS call, you can back out pieces of work. If the necessary data to complete one piece of work is unavailable, you can complete a different piece of work and then return to the former piece. To set an intermediate backout point, issue the call using the I/O PCB, and include an I/O area and a token. The I/O area has the format LLZZuser-data, where LL is the length of the data in the I/O area including the length of the LLZZ portion. The ZZ field must contain binary zeros. The data in the I/O area is returned to the
246
Using ROLS
247
248
Reserving Segments
a commit point. Therefore, you know that if you have altered a segment, no other program (except those using the GO processing option) can access that segment until your program reaches a commit point. For database organizations that support the Q command code, if the PCB processing option allows updates and the PCB holds position in a database record, no other program can access the database record. The Q command code allows you to prevent other programs from updating a segment that you have accessed, even when the PCB that accessed the segment moves to another database record. Related Reading: For more information on the Q command code, see The Q Command Code on page 34.
249
Reserving Segments
250
Chapter 14. Sample Execs Using REXXTDLI . . . . . . . SAY Exec: For Expression Evaluation . . . . . . . . . . . PCBINFO Exec: Display PCBs Available in Current PSB . . . . PART Execs: Database Access Example . . . . . . . . . . PARTNUM Exec: Show Set of Parts Near a Specified Number . PARTNAME Exec: Show a Set of Parts with a Similar Name . DFSSAM01 Exec: Load the Parts Database. . . . . . . . DOCMD: IMS Commands Front End . . . . . . . . . . . IVPREXX: MPP/IFP Front End for General Exec Execution . . .
251
252
253
Related Reading: For more information on addressing environments, see IBM TSO Extensions for MVS/REXX Reference.
254
This example uses a GPSB, but you could use any PSB that you have defined. The GPSB provides a generic PSB that has an IOPCB and a modifiable alternate PCB. It does not have any database PCBs. The language type of ASSEM is specified because no specific language type exists for a REXX application. Recommendation: For a REXX application, specify either Assembler language or COBOL. IMS schedules transactions using a load module name that is the same as the PSB name being used for MPP regions or the PGM name for other region types. You must use this load module even though your application program consists of the REXX EXEC. The IMS adapter for REXX provides a load module for you to use. This module is called DFSREXX0. You can use it in one of the following ways: v Copy to a steplib data set with the same name as the application PSB name. Use either a standard utility intended for copying load modules (such as IEBCOPY or SAS), or the Linkage Editor. v Use the Linkage Editor to define an alias for DFSREXX0 that is the same as the application PGM name. Example: Shown below is a section from the PGM setup job. It uses the linkage editor to perform the copy function to the name IVPREXX. The example uses the IVP.
//* REXXTDLI SAMPLE - GENERIC APPLICATION DRIVER //* //IVPREXX EXEC PROC=LKED //L.SYSIN DD * INCLUDE RESLIB(DFSREXX0) ENTRY DFSREXX0 NAME IVPREXX(R) /*
When IMS schedules an application transaction, the load module is loaded and given control. The load module establishes the REXX EXEC name as the PGM name with an argument of the Transaction Code (if applicable). The module calls a user exit routine (DFSREXXU) if it is available. The user exit routine selects the REXX EXEC (or a different EXEC to run) and can change the EXEC arguments, or do any other desired processing. Related Reading: For more information on the IMS adapter for REXX exit routine, see IMS Version 8 Customization Guide. Upon return from the user exit routine, the action requested by the routine is performed. This action normally involves calling the REXX EXEC. The EXEC load occurs using the SYSEXEC DD allocation. This allocation must point to one or more partitioned data sets containing the IMS REXX application programs that will be run as well as any functions written in REXX that are used by the programs. Standard REXX output, such as SAY statements and tracing, is sent to SYSTSPRT. This DD is required and can be set to SYSOUT=A.
255
Figure 66. JCL Code Used to Run the IVPREXX Sample Exec
256
IVPREXX Example 1
Entry:
IVPREXX execname
or
IVPREXX execname arguments
Response:
EXEC execname ended with RC= x
IVPREXX Example 2
Entry:
IVPREXX LEAVE
Response:
Transaction IVPREXX leaving dependent region.
257
IVPREXX Example 3
Entry:
IVPREXX HELLOHELLO
Response:
One-to-eight character EXEC name must be specified.
IVPREXX Example 4
Entry:
IVPREXX
or
IVPREXX ?
Response:
TRANCODE TRANCODE TRANCODE TRANCODE EXECNAME <Arguments> LEAVE TRACE level ROLL Run specified EXEC Leave Dependent Region 0=None,1=Some,2=More,3=Full Issue ROLL call
When an EXEC name is supplied, all of the segments it inserts to the I/O PCB are returned before the completion message is returned. REXX return codes (RC) in the range of 20000 to 20999 are usually syntax or other REXX errors, and you should check the MVS system console or region output for more details. Related Reading: For more information on REXX errors and messages, see IBM TSO Extensions for MVS/REXX Reference. Stopping an Infinite Loop: To stop an EXEC that is in an infinite loop, you can enter either of the following IMS commands from the master terminal or system console:
/STO REGION p1 ABDUMP p2 /STO REGION p1 CANCEL
In these examples, p1 is the region number and p2 is the TRANCODE that the EXEC is running under. Use the /DISPLAY ACTIVE command to find the region number. This technique is not specific to REXX EXECs and can be used on any transaction that is caught in an infinite loop. Related Reading: For more information about these commands and others to help in this situation, see IMS Version 8: Command Reference.
REXXTDLI Commands
The following section contains REXX commands and describes how they apply to DL/I calls. The terms command and call can be used interchangeably when explaining the REXXTDLI environment. However, the term command is used exclusively when explaining the REXXIMS environment. For consistency, call is used when explaining DL/I, and command is used when explaining REXX.
258
Addressable Environments
To issue commands in the IMS adapter for REXX environment, you must first address the correct environment. Two addressable environments are provided with the IMS adapter for REXX. The environments are as follows: REXXTDLI Used for standard DL/I calls, for example GU and ISRT. The REXXTDLI interface environment is used for all standard DL/I calls and cannot be used with REXX-specific commands. All commands issued to this environment are considered to be standard DL/I calls and are processed appropriately. A GU call for this environment could look like this:
Address REXXTDLI "GU MYPCB DataSeg"
REXXIMS
Used to access REXX-specific commands (for example, WTO and MAPDEF) in the IMS adapter for REXX environment. The REXXIMS interface environment is used for both DL/I calls and REXX-specific commands. When a command is issued to this environment, IMS checks to see if it is REXX-specific. If the command is not REXX-specific, IMS checks to see if it is a standard DL/I call. The command is processed appropriately. The REXX-specific commands, also called extended commands, are REXX extensions added by the IMS adapter for the REXX interface. A WTO call for this environment could look like this:
Address REXXIMS "WTO Message"
On entry to the scheduled EXEC, the default environment is MVS. Consequently, you must either use ADDRESS REXXTDLI or ADDRESS REXXIMS to issue the IMS adapter for REXX calls. Related Reading: For general information on addressing environments, see IBM TSO Extensions for MVS/REXX Reference.
REXXTDLI Calls
dlicall parm1 parm2 ...
The format of a DL/I call varies depending on call type. The parameter formats for supported DL/I calls are shown in previous chapters of this book. The parameters for the calls are case-independent, separated by one or more blanks, and are generally REXX variables. See Parameter Handling on page 260 for detailed descriptions.
Return Codes
If you use the AIBTDLI interface, the REXX RC variable is set to the return code from the AIB on the DL/I call. If you do not use the AIBTDLI interface, a simulated return code is returned. This simulated return code is set to zero if the PCB status code was GA, GK, or . If the status code had any other value, the simulated return code is X'900' or decimal 2304.
259
Parameter Handling
The IMS adapter for REXX performs some parameter setup for application programs in a REXX environment. This setup occurs when the application program uses variables or maps as the parameters. When the application uses storage tokens, REXX does not perform this setup. The application program must provide the token and parse the results just as a non-REXX application would. For a list of parameter types and definitions, see Table 30. The REXXTDLI interface performs the following setup: v The I/O area retrieval for the I/O PCB is parsed. The LL field is removed, and the ZZ field is removed and made available by means of the REXXIMS(ZZ) function call. The rest of the data is placed in the specified variable or map. Use the REXX LENGTH() function to find the length of the returned data. v The I/O area building for the I/O PCB or alternate PCB is done as follows: The appropriate LL field. The ZZ field from a preceding SET ZZ command or X'0000' if the command was not used. The data specified in the passed variable or map. v The I/O area processing for the SPA is similar to the first two items, except that the ZZ field is 4 bytes long. v The feedback area on the CHNG and SETO calls is parsed. The LLZZLL fields are removed, and the remaining data is returned with the appropriate length. v The parameters that have the LLZZ as part of their format receive special treatment. These parameters occur on the AUTH, CHNG, INIT, ROLS, SETO, and SETS calls. The LLZZ fields are removed when IMS returns data to you and added (ZZ is always X'0000') when IMS retrieves data from you. In effect, your application ignores the LLZZ field and works only with the data following it. v The numeric parameters on XRST and symbolic CHKP are converted between decimal and a 32-bit number (fullword) as required.
Table 30. IMS Adapter for REXX Parameter Types and Definitions Type1 Parameter Definition
PCB
PCB Identifier specified as a variable containing one of the following: v PCB name as defined in the PSB generation on the PCBNAME= parameter. See IMS Version 8: Utilities Reference: System for more information on defining PCB names. The name can be from 1 to 8 characters long and does not have to be padded with blanks. If this name is given, the AIBTDLI interface is used, and the return codes and reason codes are acquired from that interface. v An AIB block formatted to DFSAIB specifications. This variable is returned with an updated AIB. v A # followed by PCB offset number (#1=first PCB). Example settings are: IOPCB=:"#1" ALTPCB=:"#2" DBPCB=:"#3" The IOAREA length returned by a database DL/I call defaults to 4096 if this notation is used. The correct length is available only when the AIBTDLI interface is used.
260
Const Note:
1. The parameter types listed above correspond to the types shown (earlier in this book) under the specific DL/I calls, as well as to those shown in Table 31 on page 262. All parameters specified on DL/I calls are case independent except for the values associated with the STEM portion of the compound variable (REXX terminology for an array-like structure). A period (.) can be used in place of any parameter and is read as a NULL (zero length string) and written as a void (place holder). Using a period in place of a parameter is useful when you want to skip optional parameters. 2. For more information on *mapname, see MAPGET on page 266 and MAPPUT on page 267. 3. For more information on !token, see STORAGE on page 270.
In this example, IO is a variable that contains the PCB name, which is the constant IOPCB for the I/O PCB. If a non-zero return code (RC) is received, the EXEC ends (Exit) with a return code of 12. You can do other processing here. The next example gets a part from the IMS sample parts database. The part number is "250239". The actual part keys have a "02" prefix and the key length defined in the DBD is 17 bytes. The following example puts the segment into the variable called Part_Segment.
PartNum DB SSA Address = "250239" = "DBPCB01" = PARTROOT(PARTKEY = Left(02PartNum,17)) REXXTDLI "GU DB Part_Segment SSA"
Notes: v In a real EXEC, you would probably find the value for PartNum from an argument and would have to check the return code after the call. v The LEFT function used here is a built-in REXX function. These built-in functions are available to any IMS REXX EXEC. For more information on functions, see IBM TSO Extensions for MVS/REXX Reference.
Chapter 13. IMS Adapter for REXX
261
Environment Determination
If you use an EXEC that runs in both IMS and non-IMS environments, check to see if the IMS environment is available. You can check to see if the IMS environment is available in two ways: v Use the MVS SUBCOM command and specify either the REXXTDLI or REXXIMS environments. The code looks like this:
Address MVS SUBCOM REXXTDLI If RC=0 Then Say "IMS Environment is Available." Else Say "Sorry, no IMS Environment here."
v Use the PARSE SOURCE instruction of REXX to examine the address space name (the 8th word). If it is running in an IMS environment, the token will have the value IMS. The code looks like this:
Parse Source . . . . . . . Token . If Token=IMS Then Say "IMS Environment is Available." Else Say "Sorry, no IMS Environment here."
262
DLIINFO
The DLIINFO call requests information from the last DL/I call or on a specific PCB.
Format
DLIINFO infoout pcbid
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The infoout variable name is a REXX variable that is assigned the DL/I information. The pcbid variable name, when specified as described in Parameter Handling on page 260, returns the addresses associated with the specified PCB and its last status code. The format of the returned information is as follows: Word 1 2 3 4 5 6 7 Description Last DL/I call ('.' if N/A) Last DL/I PCB name (name or #number, '.' if N/A) Last DL/I AIB address in hexadecimal (00000000 if N/A) Last DL/I PCB address in hexadecimal (00000000 if N/A) Last DL/I return code (0 if N/A) Last DL/I reason code (0 if N/A) Last DL/I call status ('.' if blank or N/A)
Example
Address REXXIMS DLIINFO MyInfo /* Get Info Parse Var MyInfo DLI_Cmd DLI_PCB DLI_AIB_Addr DLI_PCB_Addr, DLI_RC DLI_Reason DLI_Status . */
Always code a period after the status code (seventh word returned) when parsing to allow for transparent additions in the future if needed. Words 3, 4, and 7 can be used when a pcbid is specified on the DLIINFO call.
263
IMSRXTRC
The IMSRXTRC command is used primarily for debugging. It controls the tracing action taken (that is, how much trace output via SYSTSPRT is sent to the user) while running a REXX program.
Format
IMSRXTRC level
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The level variable name can be a REXX variable or a digit, and valid values are from 0 to 9. The initial value at EXEC start-up is 1 unless it is overridden by the user Exit. Traced output is sent to the DDNAME SYSTSPRT. See IMS Version 8 Customization Guide for more information on the IMS adapter for REXX exit routine. The IMSRXTRC command can be used in conjunction with or as a replacement for normal REXX tracing (TRACE). Level 0 1 2 3 4-7 8 Description Trace errors only. The previous level and trace DL/I calls, their return codes, and environment status (useful for flow analysis). All the previous levels and variable sets. All the previous levels and variable fetches (useful when diagnosing problems). All previous levels. All previous levels and parameter list to/from standard IMS language interface. See message DFS3179 in IMS Version 8: Messages and Codes, Volume 1. All previous levels.
Example
Address REXXIMS IMSRXTRC 3
MAPDEF
The MAPDEF command makes a request to define a data mapping.
Format
MAPDEF mapname <A> REPLACE
264
startpos
length *
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
Data mapping is an enhancement added to the REXXIMS interface. Because REXX does not offer variable structures, parsing the fields from your database segments or MFS output maps can be time consuming, especially when data conversion is necessary. The MAPDEF, MAPGET, and MAPPUT commands allow simple extraction of most formatted data. v mapname is a 1- to 16-character case-independent name. v definition (<A>) is a variable containing the map definition. v REPLACE, if specified, indicates that a replacement of an existing map name is allowed. If not specified and the map name is already defined, an error occurs and message DFS3171E is sent to the SYSTPRT. The map definition has a format similar to data declarations in other languages, with simplifications for REXX. In this definition, you must declare all variables that you want to be parsed with their appropriate data types. The format is shown in <A> in the syntax diagram. Variable name: The variable name variable is a REXX variable used to contain the parsed information. Variable names are case-independent. If you use a STEM (REXX terminology for an array-like structure) variable, it is resolved at the time of use (at the explicit or implicit MAPGET or MAPPUT call time), and this can be very powerful. If you use an index type variable as the STEM portion of a compound variable, you can load many records into an array simply by changing the index variable. Map names or tokens cannot be substituted for variable names inside a map definition. Repositioning the internal cursor: A period (.) can be used as a variable place holder for repositioning the internal cursor position. In this case, the data type must be C, and the length can be negative, positive, or zero. Use positive values to skip over fields of no interest. Use negative lengths to redefine fields in the middle of a map without using absolute positioning. The data type values are: C V B Z Character Variable Binary (numeric) Zoned Decimal (numeric)
Chapter 13. IMS Adapter for REXX
265
All numeric data types can have a period and a number next to them. The number indicates the number of digits to the right of a decimal point when converting the number. Length value: The length value can be a number or an asterisk (*), which indicates that the rest of the buffer will be used. You can only specify the length value for data types C and V. Data type V maps a 2-byte length field preceding the data string, such that a when the declared length is 2, it takes 4 bytes. Valid lengths for data types are: C V B Z P 1 to 32767 bytes or * 1 to 32765 bytes or * 1 to 4 bytes 1 to 12 bytes 1 to 6 bytes
If a value other than asterisk (*) is given, the cursor position is moved by that value. The startpos value resets the parsing position to a fixed location. If startpos is omitted, the column to the right of the previous map variable definition (cursor position) is used. If it is the first variable definition, column 1 is used. Note: A length of asterisk (*) does not move the cursor position, so a variable declared after one with a length of asterisk (*) without specifying a start column overlays the same definition.
Example
This example defines a map named DBMAP, which is used implicitly on a GU call by placing an asterisk (*) in front of the map name.
DBMapDef = RECORD C * :, /* NAME C 10 :, /* PRICE Z.2 6 :, /* CODE C 2 :, /* . C 25 :, /* CATEGORY B 1 /* Address REXXIMS MAPDEF DBMAP DBMapDef Pick up entire record Cols 1-10 hold the name Cols 11-16 hold the price Cols 11-16 hold the code Skip 25 columns Col 42 holds category */ */ */ */ */ */
. . .
Address REXXTDLI GU DBPCB *DBMAP /* Read and decode a segment */ If RC=0 Then Signal BadCall /* Check for failure */ Say CODE /* Can now access any Map Variable*/
The entire segment retrieved on the GU call is placed in RECORD. The first 10 characters are placed in NAME, and the next 6 are converted from zoned decimal to EBCDIC with two digits to the right of the decimal place and placed in PRICE. The next 2 characters are placed in CODE, the next 25 are skipped, and the next character is converted from binary to EBCDIC and placed in CATEGORY. The 25 characters that are skipped are present in the RECORD variable.
MAPGET
The MAPGET command is a request to parse or convert a buffer into a specified data mapping previously defined with the MAPDEF command.
266
Format
MAPGET mapname buffer
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The mapname variable name specifies the data mapping to use. It is a 1- to 16-character case-independent name. The buffer variable name is the REXX variable containing the data to parse. Map names can also be specified in the REXXTDLI calls in place of variable names to be set or written. This step is called an implicit MAPGET. Thus, the explicit (or variable dependent) MAPGET call can be avoided. To indicate that a Map name is being passed in place of a variable in the DL/I call, precede the name with an asterisk (*), for example, GU IOPCB *INMAP.
Examples
This example uses explicit support.
Address REXXTDLI GU DBPCB SegVar If RC=0 Then Signal BadCall /* Check for failure */ Address REXXIMS MAPGET DBMAP SegVar/* Decode Segment */ Say VAR_CODE /*Can now access any Map Variable */
If an error occurs during a MAPGET, message DFS3172I is issued. An error could occur when a Map is defined that is larger than the input segment to be decoded or during a data conversion error from packed or zoned decimal format. The program continues, and an explicit MAPGET receives a return code 4. However, an implicit MAPGET (on a REXXTDLI call, for example) does not have its return code affected. Either way, the failing variables value is dropped by REXX.
MAPPUT
This MAPPUT command makes a request to pack or concatenate variables from a specified Data Mapping, defined by the MAPDEF command, into a single variable.
Format
MAPPUT mapname buffer
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The mapname variable name specifies the data mapping to use, a 1- to 16-character case-independent name. The buffer variable name is the REXX variable that will contain the resulting value.
267
Examples
This example uses explicit support.
Address REXXTDLI GHU DBPCB SegVar SSA1 If RC=0 Then Signal BadCall Address REXXIMS MAPGET DBMAP SegVar DBM_Total = DBM_Total + Deposit_Amount Address REXXIMS MAPPUT DBMAP SegVar REPL DBPCB SegVar If RC=0 Then Signal BadCall /* /* /* /* /* /* /* Read segment Check for failure Decode Segment Adjust Mapped Variable Encode Segment Update Database Check for failure */ */ */ */ */ */ */
If an error occurs during a MAPPUT, such as a Map field defined larger than the variables contents, then the field is truncated. If the variables contents are shorter than the field, the variable is padded: Character (C) Character (V) Numeric (B,Z,P) Padded on right with blanks Padded on right with zeros Padded on the left with zeros
If a MAP variable does not exist when a MAPPUT is processed, the variable and its position are skipped. All undefined and skipped fields default to binary zeros. A null parameter is parsed normally. Conversion of non-numeric or null fields to numeric field results in a value of 0 being used and no error.
SET
The SET command resets AIB subfunction values and ZZ values before you issue a DL/I call.
Format
SET SUBFUNC variable ZZ variable
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
268
Usage
Examples
This example shows the SET ZZ command used with a conversational transaction for SPA processing.
Address REXXTDLI GU IOPCB SPA Hold_ZZ = IMSQUERY(ZZ) /* Get first Segment /* Get ZZ Field (4 bytes) */ */
. . .
Address REXXIMS SET ZZ Hold_ZZ Address REXXTDLI ISRT IOPCB SPA /* Set ZZ for SPA ISRT /* ISRT the SPA */ */
This example shows the SET ZZ command used for setting 3270 Device Characteristics Flags.
Bell_ZZ = 0040X Address REXXIMS SET ZZ Bell_ZZ Address REXXTDLI ISRT IOPCB Msg /* ZZ to Ring Bell on Term /* Set ZZ for SPA ISRT /* ISRT the Message */ */ */
Format
SRRBACK return_code SRRCMIT return_code
DB/DC X
DBCTL
DCCTL X
DB Batch
TM Batch
269
Usage
The return code from the SRR command is returned and placed in the return_code variable name as well as the REXX variable RC. For more information on SRRBACK and SRRCMIT, see IMS Version 8: Administration Guide: Transaction Manager and System Application Architecture Common Programming Interface: Resource Recovery Reference.
STORAGE
The STORAGE command allows the acquisition of system storage that can be used in place of variables for parameters to REXXTDLI and REXXIMS calls.
Format
STORAGE OBTAIN !token length KEEP BELOW RELEASE !token
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
Although REXX allows variables to start with characters (!) and (#), these characters have special meanings on some commands. When using the REXXTDLI interface, you must not use these characters as the starting characters of variables. The !token variable name identifies the storage, and it consists of an exclamation mark followed by a 1- to 16-character case-independent token name. The length variable name is a number or variable containing size in decimal to OBTAIN in the range 4 to 16777216 bytes (16 MB). The storage class has two possible override values, BELOW and KEEP, of which only one can be specified for any particular token. The BELOW function acquires the private storage below the 16 MB line. The KEEP function marks the token to be kept after this EXEC is terminated. The default action gets the storage in any location and frees the token when the EXEC is terminated. Use the STORAGE command to get storage to use on DL/I calls when the I/O area must remain in a fixed location (for example, Spool API) or when it is not desirable to have the LLZZ processing. For more information on LLZZ processing, see Parameter Handling on page 260. Once a token is allocated, you can use it in REXXTDLI DL/I calls or on the STORAGE RELEASE command. Note the following when using STORAGE: v When used on DL/I calls, none of the setup for LLZZ fields takes place. You must fill the token in and parse the results from it just as required by a non-REXX application. v You cannot specify both KEEP and BELOW on a single STORAGE command. v The RELEASE function is only necessary for tokens marked KEEP. All tokens not marked KEEP and not explicitly released by the time the EXEC ends are released automatically by the IMS adapter for REXX. v When you use OBTAIN, the entire storage block is initialized to 0.
270
Example
This example shows how to use the STORAGE command with Spool API.
/* Get 4K Buffer below the line for Spool API Usage */ Address REXXIMS STORAGE OBTAIN !MYTOKEN 4096 BELOW /* Get Address and length (if curious) */ Parse Value IMSQUERY(!MYTOKEN) With My_Token_Addr My_Token_Len. Address REXXIMS SETO ALTPCB !MYTOKEN SETOPARMS SETOFB
. . .
Address REXXIMS STORAGE RELEASE !MYTOKEN
Format
WTO message WTP message WTL message
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The message variable name is a REXX variable containing the text that is stored displayed in the appropriate place.
Example
This example shows how to write a simple message stored the REXX variable MSG.
Msg = Sample output Address REXXIMS WTO Address REXXIMS WTP Address REXXIMS WTL message. Msg Msg Msg /* /* /* /* Build Message Tell Operator Tell Programmer Log It */ */ */ */
WTOR
The WTOR command requests input or response from the MVS system operator.
271
Format
WTOR message response
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The message variable name is a REXX variable containing the text that will be displayed on the MVS console. The operator's response is placed in the REXX variable signified by the response variable name. Attention: This command hangs the IMS region in which it is running until the operator responds. This example prompts the operator to enter ROLL or CONT on the MVS master or alternate console. Once the WTOR is answered, the response is placed in the REXX variable name response, and the EXEC will continue and process the IF statement appropriately.
Msg = Should I ROLL or Continue. Reply "ROLL" or "CONT" Address REXXIMS WTOR Msg Resp /* Ask Operator */ If Resp = ROLL Then /* Tell Programmer */ Address REXXTDLI ROLL /* Roll Out of this */
Example
Format
IMSQUERY ( FEEDBACK IMSRXTRC REASON SEGLEVEL SEGNAME STATUS TRANCODE USERID ZZ !token )
DB/DC X
DBCTL X
DCCTL X
DB Batch X
TM Batch X
Usage
The format of the function call is: IMSQUERY(Argument) where Argument is one of the following values: Argument FEEDBACK IMSRXTRC Description of Data Returned FEEDBACK area from current PCB. Current IMSRXTRC trace level #.
272
TRANCODE USERID
!token
This value can be placed in a variable or resolved from an expression. In these cases, the quotation marks should be omitted as shown below:
Token_Name="!MY_TOKEN" AddrInfo=IMSQUERY(Token_Name) /* or */ AddrInfo=IMSQUERY("!MY_TOKEN")
Although the function argument is case-independent, no blanks are allowed within the function argument. You can use the REXX STRIP function on the argument, if necessary. IMSQUERY is the preferred syntax, however REXXIMS is supported and can be used, as well.
Example
If REXXIMS(STATUS)=GB Then Signal End_Of_DB . . . Hold_ZZ = IMSQUERY(ZZ) /* Get current ZZ field*/ . . . Parse Value IMSQUERY(!MYTOKEN) With My_Token_Addr My_Token_Len .
Related Reading: For information on the IMS adapter for REXX exit routine, see IMS Version 8: Customization Guide.
273
274
This exec shows an example of developing applications with IMS Adapter for REXX. It also shows the advantages of REXX, such as dynamic interpretation, which is the ability to evaluate a mathematical expression at run-time. A PDF EDIT session is shown in Figure 69 on page 276. This figure shows how you can enter a new exec to be executed under IMS.
275
SAY Exec
EDIT ---- USER.PRIVATE.PROCLIB(SAY) - 01.03 ------------------ COLUMNS 001 072 COMMAND ===> SCROLL ===> PAGE ****** ***************************** TOP OF DATA ****************************** 000001 /* EXEC TO DO CALCULATIONS */ 000002 Address REXXTDLI 000003 Arg Args 000004 If Args= Then 000005 Msg=SUPPLY EXPRESSION AFTER EXEC NAME. 000006 Else Do 000007 Interpret X=Args /* Evaluate Expression */ 000008 Msg=EXPRESSION: Args = X 000009 End 000010 000011 ISRT IOPCB MSG 000012 Exit RC ****** **************************** BOTTOM OF DATA ****************************
To execute the SAY exec, use IVPREXX and supply an expression such as:
IVPREXX SAY 5*5+7
Figure 71. Example Output of PCBINFO Exec on a PSB without Database PCBs.
IMS PCB System Information Exec: PCBINFO System Date: 09/26/92 Time: 15:53:34 PCB # 1: Type=IO, LTERM=T3270LC Status= Date=89320 Time=1553243 PCB # 2: Type=DB, DBD =DI21PART Status= EXEC PCBINFO ended with RC= 0 UserID= Level=00 Opt=G OutDesc=DFSMO2
Figure 72. Example Output of PCBINFO Exec on a PSB with a Database PCB.
276
PCBINFO Exec
/* REXX EXEC TO SHOW SYSTEM LEVEL INFO */ Address REXXTDLI Arg Dest . WTO=(Dest=WTO) Call SayIt IMS PCB System Information Exec: PCBINFO Call SayIt System Date: Date(U) Time: Time() Call Sayit /* A DFS3162 message is given when this exec is run because it does /* not know how many PCBs are in the list and it runs until it gets /* an error return code. Note this does not show PCBs that are /* available to the PSB by name only, i.e. not in the PCB list. Msg=PCBINFO: Error message normal on DLIINFO. WTP MSG Do i=1 by 1 until Result=LAST Call SayPCB i End Exit 0
*/ */ */ */
SayPCB: Procedure Expose WTO Arg PCB DLIINFO DLIINFO #PCB /* Get PCB Address */ If rc<0 Then Return LAST /* Invalid PCB Number */ Parse Var DLIInfo . . AIBAddr PCBAddr . PCBINFO=Storage(PCBAddr,255) /* Read PCB */ DCPCB=(Substr(PCBInfo,13,1)=00x) /* Date Field, must be DC PCB */ If DCPCB then Do Parse Value PCBInfo with, LTERM 9 . 11 StatCode 13 CurrDate 17 CurrTime 21, InputSeq 25 OutDesc 33 UserID 41 If LTERM= then LTERM=* NONE * CurrDate=Substr(c2x(CurrDate),3,5) CurrTime=Substr(c2x(CurrTime),1,7) If CurrDate=000000 then Do Call SayIt PCB #Right(PCB,2): Type=IO, LTERM=LTERM, Status=StatCode UserID=UserID OutDesc=OutDesc Call SayIt Date=CurrDate Time=CurrTime End Else Call SayIt PCB #Right(PCB,2): Type=TP, LTERM=LTERM, Status=StatCode End Else Do Parse Value PCBInfo with, DBDName 9 SEGLev 11 StatCode 13 ProcOpt 17 . 21 Segname . 29, KeyLen 33 NumSens 37 KeyLen = c2d(KeyLen) NumSens= c2d(NumSens) Call SayIt PCB #Right(PCB,2): Type=DB, DBD =DBDName, Status=StatCode Level=SegLev Opt=ProcOpt End Return SayIt: Procedure Expose WTO Parse Arg Msg If WTO Then WTO MSG Else ISRT IOPCB MSG Return
277
PART Execs
All part numbers that begin with a 300 or larger numbers are listed. The listing is shown in Figure 76 on page 279.
IMS Parts DATABASE Transaction System Date: 02/16/92 Time: 23:28:41 Request: Display 5 Parts with Part_Number >= 300 1 Part=3003802 Desc=CHASSIS 2 Part=3003806 Desc=SWITCH 3 Part=3007228 Desc=HOUSING 4 Part=3008027 Desc=CARD FRONT 5 Part=3009228 Desc=CAPACITOR EXEC PARTNUM ended with RC= 0
PARTNAME is used to show part names that begin with a specific string of characters. To list part names beginning with TRAN, enter the command:
PARTNAME TRAN
All part names that begin with TRAN are listed on the screen. The screen is shown in Figure 75. The listing is shown in Figure 77 on page 280.
IMS Parts DATABASE Transaction System Date: 02/16/92 Time: 23:30:09 Request: Display 5 Parts with Part Name like TRAN 1 Part=250239 Desc=TRANSISTOR 2 Part=7736847P001 Desc=TRANSFORMER 3 Part=975105-001 Desc=TRANSFORMER 4 Part=989036-001 Desc=TRANSFORMER End of DataBase reached before 5 records shown. EXEC PARTNAME ended with RC= 0
The DFSSAM01 exec is used to load the parts database. This exec is executed in batch, is part of the IVP, and provides an example of EXECIO usage in an exec. Related Reading: For details, see IMS Version 8: Installation Volume 1: Installation Verification.
278
PART Execs
PartNum=Left(PartNum,15) /* Pad to 15 with Blanks */ If PartNum= then Call Sayit Request: Display first Segs Parts in the DataBase Else Call Sayit Request: Display Segs Parts with Part_Number >= PartNum SSA1=PARTROOT(PARTKEY >=02PartNum) GU DATABASE *ROOTSEG SSA1 Status=IMSQUERY(STATUS) If Status=GE then Do /* Segment Not Found */ Call Sayit No parts found with larger Part_Number Exit 0 End Do i=1 to Segs While Status= Call Sayit Right(i,2) Part=PNum Desc=Description GN DATABASE *ROOTSEG SSA1 Status=IMSQUERY(STATUS) End If Status=GB then Call SayIt End of DataBase reached before Segs records shown. Else If Status= then Signal BadCall Call Sayit Exit 0 SayIt: Procedure Expose IOPCB Parse Arg Msg ISRT IOPCB MSG If RC=0 then Signal BadCall Return BadCall: DLIINFO INFO Parse Var Info Call PCB . . . . Status . Msg = Unresolved Status Code Status, on Call on PCB PCB ISRT IOPCB MSG Exit 99
Figure 76. PARTNUM Exec: Show Set of Parts Near a Specified Number
279
PART Execs
/* REXX EXEC TO SHOW ALL PARTS WITH A NAME CONTAINING A STRING */ /* Designed to be run by the IVPREXX exec with PSB=DFSSAM02 */ /* Syntax: IVPREXX PARTNAME string <#parts> */ Arg PartName Segs . Address REXXIMS Term =IOPCB /* PCB Name */ DataBase=DBPCB01 /* PCB Name for Parts Database */ Call SayIt IMS Parts DATABASE Transaction Call SayIt System Date: Date(U) Time: Time() Call Sayit If DataType(Segs,W) & Segs=* then Segs=5 If PartName= then Do Call Sayit Please supply the first few characters of the part name Exit 0 End Call Sayit Request: Display Segs Parts with Part Name like PartName SSA1=PARTROOT GU DATABASE ROOT_SEG SSA1 Status=REXXIMS(STATUS) i=0 Do While RC=0 & (i<Segs | Segs=*) Parse Var Root_Seg 3 PNum 18 27 Description 47 GN DATABASE ROOT_SEG SSA1 Status=REXXIMS(STATUS) If RC=0 & Status=GB Then Leave If Index(Description,PartName)=0 then Iterate i=i+1 Call Sayit Right(i,2)) Part=PNum Desc=Description End If RC=0 & Status=GB Then Signal BadCall If i<Segs & Segs=* then Call SayIt End of DataBase reached before Segs records shown. Call Sayit Exit 0 SayIt: Procedure Expose Term Parse Arg Msg ISRT Term MSG If RC=0 then Signal BadCall Return BadCall: Call "DFSSUT04" Term Exit 99
280
DOCMD
281
DOCMD
Selection criteria =>TYPE=SLU2<= Command: /DIS NODE ALL NODE_SUB TYPE CID RECD ENQCT DEQCT QCT SENT WRIGHT SLU2 00000000 0 0 0 0 0 IDLE Q3290A SLU2 00000000 0 0 0 0 0 IDLE Q3290B SLU2 00000000 0 0 0 0 0 IDLE Q3290C SLU2 00000000 0 0 0 0 0 IDLE Q3290D SLU2 00000000 0 0 0 0 0 IDLE V3290A SLU2 00000000 0 0 0 0 0 IDLE V3290B SLU2 00000000 0 0 0 0 0 IDLE H3290A SLU2 00000000 0 0 0 0 0 IDLE H3290B SLU2 00000000 0 0 0 0 0 IDLE E32701 SLU2 00000000 0 0 0 0 0 IDLE E32702 SLU2 00000000 0 0 0 0 0 IDLE E32703 SLU2 00000000 0 0 0 0 0 IDLE E32704 SLU2 00000000 0 0 0 0 0 IDLE E32705 SLU2 00000000 0 0 0 0 0 IDLE ADLU2A SLU2 00000000 0 0 0 0 0 IDLE ADLU2B SLU2 00000000 0 0 0 0 0 IDLE ADLU2C SLU2 00000000 0 0 0 0 0 IDLE ADLU2D SLU2 00000000 0 0 0 0 0 IDLE ADLU2E SLU2 00000000 0 0 0 0 0 IDLE ADLU2F SLU2 00000000 0 0 0 0 0 IDLE ADLU2X SLU2 00000000 0 0 0 0 0 IDLE ENDS01 SLU2 00000000 0 0 0 0 0 IDLE ENDS02 SLU2 00000000 0 0 0 0 0 IDLE ENDS03 SLU2 00000000 0 0 0 0 0 IDLE ENDS04 SLU2 00000000 0 0 0 0 0 IDLE ENDS05 SLU2 00000000 0 0 0 0 0 IDLE ENDS06 SLU2 00000000 0 0 0 0 0 IDLE NDSLU2A1 SLU2 00000000 0 0 0 0 0 ASR IDLE NDSLU2A2 SLU2 00000000 0 0 0 0 0 ASR IDLE NDSLU2A3 SLU2 00000000 0 0 0 0 0 ASR IDLE NDSLU2A4 SLU2 00000000 0 0 0 0 0 ASR IDLE NDSLU2A5 SLU2 00000000 0 0 0 0 0 IDLE NDSLU2A6 SLU2 00000000 0 0 0 0 0 ASR IDLE OMSSLU2A SLU2 00000000 0 0 0 0 0 IDLE Selected 34 lines from 396 lines. DOCMD Executed 435 DL/I calls in 1.602206 seconds. EXEC DOCMD ended with RC= 0
Selection criteria =>ENQCT>0 & RECTYPE=T02<= Command: /DIS TRAN ALL TRAN CLS ENQCT QCT LCT PLCT CP NP LP SEGSZ SEGNO PARLM RC TACP18 1 119 0 65535 65535 1 1 1 0 0 NONE 1 Selected 1 lines from 1104 lines. DOCMD Executed 1152 DL/I calls in 5.780977 seconds. EXEC DOCMD ended with RC= 0
Figure 82. Output from = > DOCMD /DIS TRAN ALL;ENQCT>0 & RECTYPE=T02
Selection criteria =>ENQCT>0<= Command: /DIS LTERM ALL LTERM ENQCT DEQCT QCT CTRL 19 19 0 T3270LC 119 119 0 Selected 2 lines from 678 lines. DOCMD Executed 681 DL/I calls in 1.967670 seconds. EXEC DOCMD ended with RC= 0
The source code for the DOCMD exec is shown in Figure 84 on page 283.
282
DOCMD
/*********************************************************************/ /* A REXX exec that executes an IMS command and parses the */ /* output by a user supplied criteria. */ /* */ /*********************************************************************/ /* Format: tranname DOCMD IMS-Command;Expression */ /* Where: */ /* tranname is the tranname of a command capable transaction that */ /* will run the IVPREXX program. */ /* IMS-Command is any valid IMS command that generates a table of */ /* output like /DIS NODE ALL or /DIS TRAN ALL */ /* Expression is any valid REXX expression, using the header names*/ /* as the variables, like CID>0 or SEND=0 or more */ /* complex like CID>0 & TYPE=SLU2 */ /* Example: TACP18 DOCMD DIS A Display active */ /* TACP18 DOCMD DIS NODE ALL;? See headers of DIS NODE */ /* TACP18 DOCMD DIS NODE ALL;CID>0 Show active Nodes */ /* TACP18 DOCMD DIS NODE ALL;CID>0 & TYPE=SLU2 */ /*********************************************************************/ Address REXXTDLI Parse Upper Arg Cmd ; Expression Cmd=Strip(Cmd); Expression=Strip(Expression) If Cmd= Then Do Call SayIt Please supply an IMS Command to execute. Exit 0 End AllOpt= (Expression=ALL) If AllOpt then Expression= If Left(Cmd,1)=/ then Cmd=/Cmd /* Add a slash if necessary */ If Expression= Then Call SayIt No Expression supplied, all output shown, from: Cmd Else If Expression=? Then Call SayIt Headers being shown for command: Cmd Else Call SayIt Selection criteria =>Expression<=, Command: Cmd x=Time(R); Calls=0 ExitRC= ParseHeader(Cmd,Expression) If ExitRC=0 then Exit ExitRC If Expression=? Then Do Do i=1 to Vars.0 Call SayIt Variable (header) #i = Vars.i Calls=Calls+1 End End
283
DOCMD
Else Do Call ParseCmd Expression Do i=1 to Line.0 If AllOpt then Line=Line.i Else Line=Substr(Line.i,5) Call SayIt Line Calls=Calls+1 End If Expression= then Call SayIt Selected Line.0-1 lines from, LinesAvail lines. Else Call SayIt Total lines of output: Line.0-1 Call SayIt DOCMD Executed Calls DL/I calls in, Time(E) seconds. End Exit 0 ParseHeader: CurrCmd=Arg(1) CmdCnt=0 CMD IOPCB CURRCMD CmdS= IMSQUERY(STATUS) Calls=Calls+1 If CmdS= then Do Call SayIt Command Executed, No output available. Return 4 End Else If CmdS=CC then Do Call SayIt Error Executing Command, Status=CmdS Return 16 End CurrCmd=Translate(CurrCmd, ,15x) /* Drop special characters CurrCmd=Translate(CurrCmd,__,-/) /* Drop special characters CmdCnt=CmdCnt+1 Interpret LINE.||CmdCnt = Strip(CurrCmd) Parse Var CurrCmd RecType Header If Expression= then Nop Else If Right(RecType,2)=70 then Do Vars.0=Words(Header)+1 Vars.1 = "RECTYPE" Do i= 2 to Vars.0 Interpret VARS.i = "Word(CurrCmd,i)" End End Else Do Call SayIt Command did not produce a header, record, first records type=RecType Return 12 End Return 0
*/ */
284
IVPREXX
ParseCmd: LinesAvail=0 CurrExp=Arg(1) Do Forever GCMD IOPCB CURRCMD CmdS= IMSQUERY(STATUS) Calls=Calls+1 If CmdS= then Leave /* Skip Time Stamps */ If Word(CurrCmd,1)=X99 & Expression= then Iterate LinesAvail=LinesAvail+1 CurrCmd=Translate(CurrCmd, ,15x)/* Drop special characters */ If Expression= then OK=1 Else Do Do i= 1 to Vars.0 Interpret Vars.i = "Word(CurrCmd,i)" End Interpret OK=Expression End If OK then Do CmdCnt=CmdCnt+1 Interpret LINE.||CmdCnt = Strip(CurrCmd) End End Line.0 = CmdCnt If CmdS=QD Then Call SayIt Error Executing Command:, Arg(1) Stat=CmdS Return SayIt: Procedure Parse Arg Line ISRT IOPCB LINE Return RC
285
286
287
288
DLET
Delete
DB/DC, DBCTL, DB batch, ODBA DB/DC, ODBA DB/DC, DBCTL, DB batch, ODBA DB/DC, DBCTL, DB batch, ODBA DB/DC, DBCTL, DB batch, ODBA
Field Get Hold Next Get Hold Next in Parent Get Hold Unique
Retrieves segments function, db pcb or aib, i/o area, [ssa] and establishes a starting position in the database Retrieves subsequent message segments function, db pcb or aib, i/o area, [ssa or rsa]
GN
Get Next
289
Retrieves segments function, db pcb or and establishes a aib, i/o area, [ssa or starting position in the rsa] database Loads and adds one or more segments to the database Opens a GSAM database explicitly Retrieves the location of a specific dependent or last-inserted sequential dependent segment Changes values of one or more fields in a segment function, db pcb or aib, i/o area, [ssa or rsa] function, gsam pcb or aib, [i/o area] function, db pcb or aib, i/o area, [ssa]
ISRT
Insert
DB/DC, DCCTL, DB batch, ODBA DB/DC, DBCTL, DB batch, ODBA DB/DC, DBCTL, DB batch, ODBA
OPEN POS
Open Position
REPL
Replace
Specifies up to function, i/o pcb or seven program areas aib, i/o area len, i/o to be saved area[, area len, area] Waits for an AOI function, aib, i/o area message when none is available
GMSG
GSCD1
None
290
Issues an IMS None command and retrieves the first command response segment
INIT
Initialize; application receives data availability and deadlock occurrence status codes Inquiry; returns information and status codes about I/O or alternate PCB destination type, location, and session status Log; writes a message to the system log
INQY
function, aib, i/o area, DB batch, TM batch, Checks each PCB AIBFUNC=FIND| BMP, MPP, IFP, database for data DBQUERY| ENVIRON ODBA availability; returns information and status codes about the current execution environment None function, i/o pcb or aib, i/o area function, psb name, uibptr, [,sysserve] function, aib, i/o area DB batch, TM batch, BMP, MPP, IFP, DBCTL, ODBA CICS (DBCTL or DB/DC) DB/DC and DCCTL (BMP, MPP, IFP), DB/DC and DBCTL (DRA thread), DBCTL (BMP non-message driven), ODBA DB batch, TM batch, BMP, MPP, IFP DB batch, TM batch, BMP, MPP, IFP DB batch, TM batch, BMP, MPP, IFP, DBCTL, ODBA DB batch, TM batch, BMP, MPP, IFP, DBCTL, ODBA DB batch, BMP, MPP, IFP, CICS (DCCTL), ODBA DB batch, BMP, MPP, IFP, DBCTL, ODBA
LOG
PCB RCMD
Specifies and None schedules another PSB Retrieves the second and subsequent command response segments resulting from an ICMD call Roll back; eliminates database updates Roll; eliminates database updates; abend Roll back to SETS; backs out database changes to SETS points None
ROLB ROLL
ROLS
function, db pcb, i/o pcb or aib, i/o area, token function, i/o pcb or aib, i/o area, token
SETS/SETU
Set a backout point; Cancels all existing establishes as many as backout points nine intermediate backout points Collects diagnostic information Choose SNAP options
SNAP2
function, db pcb or aib, i/o area function, db pcb or aib, i/o area, stat function
STAT3
Statistics; retrieves IMS Choose type and system statistics format Synchronization; releases locked resources Requests commit-point processing
SYNC
291
Terminate; releases a None PSB so another can be scheduled; commit database changes Extended restart; works Specifies up to with symbolic seven areas to be checkpoint to restart saved application program
XRST
function, i/o pcb or aib, i/o area len, i/o area[, area len, area]
Note: 1. GSCD is a Product-sensitive programming interface. 2. SNAP is a Product-sensitive programming interface. 3. STAT is a Product-sensitive programming interface.
292
L M N P Q R S U V W Z -
293
Command Codes
Table 35. Command Codes and Calls (continued) Command Code M N P Q R S U V W Z X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X GU GHU X GN GHN X GNP GHNP X REPL X X X X X X X X X X X X X ISRT X DLET
294
Table 37. Return Codes in UIBDLTR if UIBFCTR='0C' (NOTOPEN) Condition Database not open Intent scheduling conflict ASM X'00' X'02' COBOL LOW-VALUES 12-2-9 PL/I 00000 000 00000 010
Table 38. Return Codes in UIBDLTR if UIBFCTR='08' (INVREQ) Condition Invalid argument passed to DL/I PSBNF (PSB not found) PSBSCH (PSB already scheduled) NOTDONE (request not executed) PSBFAIL (PSB initialization failed) TERMNS (termination not successful) FUNCNS (function unscheduled) INVPSB (invalid PSB) DLINA (DL/I not active) ASM X'00' X'01' X'03' X'04' X'05' X'07' X'08' X'10' X'FF' COBOL LOW-VALUES 12-1-9 12-3-9 12-4-9 12-5-9 12-7-9 12-8-9 12-10-9 12-11-0-7-8-9 PL/I 00000 000 00000 001 00000 011 00000 100 00000 101 00000 111 00001 000 00010 000 11111 111
295
Not-Open Conditions
A NOTOPEN condition is indicated if UIBFCTR contains X'0C'
UIBDLTR='00' Explanation: This is returned on a database call if the database was stopped after scheduling of the PSB. UIBDLTR='02' Explanation: This indicates that an intent-scheduling conflict exists. This condition does not occur if you are using IMS program isolation.
296
Part 4. Appendixes
297
298
299
300
Control Statements
DFSDDLT0 processes control statements to control the test environment. DFSDDLT0 can issue calls to IMS full-function databases and Fast Path databases, as well as DC calls. Table 39 gives an alphabetical summary of the types of control statements DFSDDLT0 uses. A detailed description of each type of statement follows.
Table 39. Summary of DFSDDLT0 Control Statements Control Statement ABEND CALL
1
Code ABEND L
Description Causes user abend 252. There are two types of CALL statements: v CALL FUNCTION identifies the type of IMS call function to be made and supplies information to be used by the call. v CALL DATA provides IMS with additional information.
COMMENT
T U1
There are two types of COMMENT statements: v Conditional allows a limited number of comments that are printed or not depending on how the STATUS statement is coded and the results of the PCB or DATA COMPARE. v Unconditional allows an unlimited number of comments, all of which are printed.
301
Control Statements
Table 39. Summary of DFSDDLT0 Control Statements (continued) Control Statement COMPARE Code E Description There are three types of COMPARE statements: v COMPARE DATA verifies that the correct segment was retrieved by comparing the segment returned by IMS with data in this statement. v COMPARE AIB compares values that IMS returns to the AIB. v COMPARE PCB checks fields in the PCB and calls for a snap dump of the DL/I blocks, the I/O buffer pool, or the batch region if the compare is unequal. IGNORE OPTION
1
N or . O
The program ignores statements that contain N or . (period) in column 1. Shows which control blocks are to be dumped, the number of unequal comparisons allowed, whether dumps are produced, number of lines printed per page, and the SPA size. PUNCH CTL produces an output data set consisting of the COMPARE PCB statements, the COMPARE AIB statements, the DATA statements, and all other control statements read. Establishes print options and selects the PCB or AIB against which subsequent calls are to be issued. Sends a message to the MVS console without waiting for reply. Sends a message to the MVS console and waits for a reply before proceeding.
PUNCH1
CTL
S WTO WTOR
1. These control statements are acted on immediately when encountered in an input stream. Do not code them where they will interrupt call sequences. (See Planning the Control Statement Order on page 303.)
The control statements are further described below: v The CALL statement is the central DFSDDLT0 statement. The CALL statement has two parts: CALL FUNCTION and CALL DATA. CALL FUNCTION identifies the type of IMS call function and supplies information about segment search arguments (SSAs). CALL DATA provides more information required for the type of call identified by CALL FUNCTION. v The STATUS statement controls the PCB, AIB, and handling of output. v The three types of COMPARE statements, DATA, PCB, and AIB, compare different values: If you want specific data from a call, use COMPARE DATA to check the segment data for mismatches when the call is made. Use COMPARE PCB to check status codes, segment levels, and feedback keys. It also indicates mismatches when you specify output. Use COMPARE AIB to compare values that IMS returns to the AIB. v The two COMMENT statements, Conditional and Unconditional, allow you to set limits on the number of comments on the DFSDDLT0 job stream and to specify whether you want the comments printed. v The OPTION statement controls several overall functions such as the number of unequal comparisons allowed and the number of lines printed per page. v The remaining statements, ABEND, IGNORE, CTL, WTO and WTOR, are not as important as the others at first. Read the sections describing these statements so that you can become familiar with the functions they offer. When you are coding the DFSDDLT0 control statements, keep the following items in mind:
302
Control Statements
v If you need to temporarily override certain control statements in the DFSDDLT0 streams, read about SYSIN/SYSIN2 processing in the JCL requirements section on page 341. v You must fill in column 1 of each control statement. If column 1 is blank, the statement type defaults to the prior statement type. DFSDDLT0 attempts to use any remaining characters as it would for the prior statement type. v Use of reserved fields can produce invalid output and unpredictable results. v Statement continuations are important, especially for the CALL statement. v Sequence numbers are not required, but they can be very useful for some DFSDDLT0 functions. Read about the PUNCH CTL statement starting on page 334 and the SYSIN/SYSIN2 processing description in the JCL requirements section on page 341 to understand how to use sequence numbers. v All codes and fields in the DFSDDLTO statements must be left justified followed by blanks, unless otherwise specified.
ABEND Statement
The ABEND statement causes IMS to issue an abend and terminate DFSDDLT0. Table 40 shows the format of the ABEND statement.
Table 40. ABEND Statement Column 1-5 Function Code Description Issues abend U252. (No dump is produced unless you code DUMP on the OPTION statement.)
6-72 73-80
303
ABEND Statement
CALL Statement
The CALL control statement has two parts: CALL FUNCTION and CALL DATA. v The CALL FUNCTION statement supplies the DL/I call function, the segment search arguments (SSAs), and the number of times to repeat the call. SSAs are coded according to IMS standards. v With the CALL DATA statement you provide any data (database segments, MVS commands, checkpoint IDs) required by the DL/I call specified in the CALL FUNCTION statement. See CALL DATA Statement on page 307.
9 10-13
b b b b b xxxx If blank, use function from previous CALL statement. 'xxxx' is a DL/I call function.
304
CALL Statement
Table 41. CALL FUNCTION Statement (continued) Column Function Continue SSA Code CONT Description Continuation indicator for SSAs too long for a single CALL FUNCTION statement. Column 72 of the preceding CALL FUNCTION statement must have an entry. The next CALL statement should have CONT in columns 10 - 13 and the SSA should continue in column 16.
Token
xxxxxxxx
MOD name
xxxxxxxx
Subfunction
xxxxxxxx
nulls, DBQUERY, FIND, ENVIRON, PROGRAM (INQY). DBAS/DBES-OSAM or VBAS/VBES-VSAM (STAT).2 F - Formatted UUnformatted S - Summary. Where x is 1, 2, or 3. Specified on SETO and CHNG calls as defined in Note. Value of 0000 to 8192. If a value greater than 8192 is specified, it defaults to 8192. If no value is specified, the call is made with no SETO size specified.
Statistics type
xxxx
Statistics format
SETO ID1
SETx
21-24
nnnn
2471
Remainder of SSA
Unqualified SSAs must be blank. Qualified search arguments should have either an '*' or a '(' in column 24 and follow IMS SSA coding conventions. b No continuations for this statement.
72
Continuation column
305
CALL Statement
Table 41. CALL FUNCTION Statement (continued) Column Function Code x Description Alone, it indicates multiple SSAs each beginning in column 16 of successive statements. With CONT in columns 10-13 of the next statement, indicates a single SSA that is continued beginning in column 16 of the following statement. For SYSIN2 statement override.
73-80 Note:
Sequence indication
nnnnnnnn
1. SETO CALL: The SETO ID (SET1, SET2, or SET3) is required on the SETO call if DFSDDLT0 is to keep track of the text unit address returned on the SETO call that would be passed on the CHNG call for option parameter TXTU. If the SETO ID is omitted on the SETO call, DFSDDLT0 does not keep track of the data returned and is unable to reference it on a CHNG call. CHNG CALL: The SETO ID (SET1, SET2, or SET3) is required on the CHNG call if DFSDDLT0 is to place the address of the SETO ID I/O area returned on the SETO call. This is the SETO call of the text unit returned on the SETO call with a matching SETO ID for this CHNG call into the TXTU=ADDR field of the option parameter in the CHNG call. When the SETO ID is specified on the CHNG call, DFSDDLT0 moves the address of that text unit returned on the SETO call using the same SETO ID. Code the OPTION statement parameter TXTU as follows: TXTU=xxxx where xxxx is any valid non-blank character. It cannot be a single quote character. Suggested value for xxxx could be SET1, SET2, or SET3. This value is not used by DFSDDLT0. 2. STAT is a Product-sensitive programming interface.
The following information applies to different types of continuations: v Column 3, the SSA level, is usually blank. If it is blank, the first CALL FUNCTION statement fills SSA 1, and each following CALL FUNCTION statement fills the next lower SSA. If column 3 is not blank, the statement fills the SSA at that level, and the following CALL FUNCTION statement fills the next lower one. v Columns 5 through 8 are usually blank, but if used, must be right justified. The same call is repeated as specified by the repeat call function. v Columns 10 through 13 contain the DL/I call function. The call function is required only for the first CALL FUNCTION statement when multiple SSAs are in a call. If left blank, the call function from the previous CALL FUNCTION statement is used. v Columns 16 through 23 contain the segment name if the call uses an SSA. v If the DL/I call contains multiple SSAs, the statement must have a nonblank character in column 72, and the next SSA must start in column 16 of the next statement. The data in columns 1 and 10 through 13 are blank for the second through last SSAs. Restriction: On ISRT calls, the last SSA can have only the segment name with no qualification or continuation.
306
CALL Statement
v If a field value extends past column 71, put a nonblank character in column 72. (This character is not read as part of the field value, only as a continuation character.) In the next statement insert the keyword CONT in columns 10 through 13 and continue the field value starting at column 16. v Maximum length for the field value is 256 bytes, maximum size for an SSA is 290 bytes, and the maximum number of SSAs for this program is 15, which is the same as the IMS limit. v If columns 5 through 8 in the CALL FUNCTION statement contain a repeat count for the call, the call will terminate when reaching that count, unless it first encounters a GB status code. Related Reading: See CALL FUNCTION Statement with Column-Specific SSAs on page 322 for another format supported by DFSDDLT0.
b V
P Z U
307
CALL Statement
Table 42. CALL DATA Statement (continued) Column Function Code U 5-8 Length of data in segment nnnn This value must be right justified but need not contain leading zeros. If you do not specify a length, DFSDDLT0 will use the number of DATA statements read multiplied by 56 to derive the length. Description
b DATA b xxxx Data that goes in the I/O area. Identifies this as a DATA statement.
Checkpoint ID
Checkpoint ID (SYNC).
Destination name
DEQ options (A,B,C,D,E,F,G,H,I, or J). If no more continuations for this segment. If more data for this segment or more segments. For SYSIN2 statement override.
73-80
Sequence indication
nnnnnnnn
When inserting variable-length segments or including variable-length data for a CHKP or LOG call: v You must use a V or M in column 4 of the CALL DATA statement. v Use V if only one variable-length segment is being processed. v You must enter the length of the data with leading zeros, right justified, in columns 5 through 8. The value is converted to binary and becomes the first 2 bytes of the segment data. v You can continue a CALL DATA statement into the next CALL DATA statement by entering a nonblank character in column 72. For subsequent statements, leave columns 1 through 15 blank, and start the data in column 16. If multiple variable-length segments are required (that is, concatenated logical child/logical parent segments, both of which are variable-length) for the first segment: v You must enter a V in column 4. v You must enter the length of the first segment in columns 5 through 8. v If the first segment is longer than 56 bytes, continue the data as described for inserting variable-length segments. Exceptions: The last CALL DATA statement to contain data for this segment must have a nonblank character in column 72.
308
CALL Statement
The next CALL DATA statement applies to the next variable-length statement and must contain an M in column 4 and the length of the segment in columns 5 through 8. You can concatenate any number of variable-length segments in this manner. Enter M or V and the length (only in CALL DATA statements that begin data for a variable-length segment). When a program is inserting or replacing through path calls: v Enter a P in column 4 to specify that the length field is to be used as the length the segment will occupy in the user I/O area. v You only need to use P in the first statement of fixed-length-segment CALL DATA statements in path calls that contain both variable- and fixed-length segments. v You can use V, M, and P in successive CALL DATA statements. For INIT, SETS, ROLS, and LOG calls: v The format of the I/O area is
LLZZuser-data
where LL is the length of the data in the I/O area, including the length of the LLZZ portion. v If you want the program to use this format for the I/O area, enter a Z in column 4 and the length of the data in columns 5 through 8. The length in columns 5 through 8 is the length of the data, not including the 4-byte length of LLZZ.
309
CALL Statement
The FEEDBACK DATA statement is optional. However, if the FEEDBACK DATA statement is used, an OPTION DATA statement is required. Table 44 shows the format for a FEEDBACK DATA statement.
Table 44. FEEDBACK DATA Statement Column Function 1 Identifies control statement Reserved Format option Code L Description FEEDBACK statement.
2-3 4
b b Z Feedback area contains LLZZ. Length of feedback area will be computed and the LLZZ will be added to the feedback area. This value must be right justified but need not contain leading zeros. If you do not specify a length, DFSDDLT0 uses the number of FDBK inputs read multiplied by 56 to derive the length.
5-8
nnnn
b FDBK b xxxx b x Contains user pre-defined initialized area. If no more continuations for feedback. If more feedback data exists in following statement. For SYSIN2 statement override. Identifies this as feedback statement and continuation of feedback statement.
73-80
Sequence number
nnnnnnnn
Call Functions
DL/I Call Functions
Table 45 shows the DL/I call functions supported in DFSDDLT0 and which ones require data statements.
Table 45. DL/I Call Functions Call CHKP CHNG AIB Support yes yes PCB Support yes yes Data Stmt1 R R R CMD DEQ yes yes yes yes R R Description Checkpoint. Change alternate PCB. Contains the alternate PCB name option statement and feedback statement optional. Issue IMS command. This call defaults to I/O PCB. Dequeue segments locked with the Q command code. For full function, this call defaults to the I/O PCB, provided a DATA statement containing the class to dequeue immediately follows the call. For Fast Path, the call is issued against a DEDB PCB. Do not include a DATA statement immediately following the DEQ call.
310
CALL Statement
Table 45. DL/I Call Functions (continued) Call DLET FLD AIB Support yes yes PCB Support yes yes Data Stmt1 O R Description Delete. If the data statement is present, it is used. If not, the call uses the data from the previous Get Hold Unique (GHU). Fieldfor Fast Path MSDB calls using FSAs. This call references MSDBs only. If there is more than one FSA, put a nonblank character in column 34, and put the next FSA in columns 16-34 of the next statement. A DATA statement containing FSA is required. Get command response. This call defaults to I/O PCB.
2 2 2
N O
Get Hold Next. Get Hold Next in Parent. Get Hold Unique. Get Message is used in an automated operator (AO) application program to retrieve a message from AO exit routine DFSAOE00. The DATA statement is required to allow for area in which to return data. The area must be large enough to hold this returned data. Get Next segment. Get Next in Parent. Get Unique segment. Issue Command enables an automated operator (AO) application program to issue an IMS command and retrieve the first command response segment. The DATA statement is required to contain the input command and to allow for area in which to return data. The area must be large enough to hold this returned data. Initialization This call defaults to I/O PCB. A DATA statement is required. Use the LLZZ format. Request environment information using the AIB and the ENVIRON subfunction. The DATA statement is required to allow for area in which to return data. The area must be large enough to hold this returned data. Request database information using the AIB and the DBQUERY subfunction, which is equivalent to the INIT DBQUERY call. The DATA statement is required to allow for area in which to return data. The area must be large enough to hold this returned data. Insert.
O O R
GN GNP GU ICMD
3
O2 O O R
2 2
INIT INQY3
yes yes
yes no
R R
ISRT
yes
yes R O R
DB PCB, DATA statement required. I/O PCB using I/O area with MOD name, if any, in columns 16-23. Alt PCB. Log system request. This call defaults to I/O PCB. DATA statement is required and can be specified in one of two ways. Position - for DEDBs to determine a segment location. This call references DEDBs only.
LOG
yes
yes
POS
yes
yes
311
CALL Statement
Table 45. DL/I Call Functions (continued) Call PURG AIB Support yes PCB Support yes R Data Stmt1 Description Purge. This call defaults to use I/O PCB. If column 16 is not blank, MOD (message output descriptor) name is used and a DATA statement is required. If column 16 is blank, the DATA statement is optional. Retrieve Command enables an automated operator (AO) application program to retrieve the second and subsequent command response segments after an ICMD call. The DATA statement is required to allow for area in which to return data. The area must be large enough to hold this returned data. ReplaceThis call references DB PCBs only. The DATA statement is required. Roll Back call. Roll Back call and issue U778 abend. Back out updates and issue 3303 abend. Uses the I/O PCB. Can be used with the SETS call function. To issue a ROLS with an I/O area and token as the fourth parameter, specify the 4-byte token in column 16 of the CALL statement. Leaving columns 16-19 blank will cause the call to be made without the I/O area and the token. (To issue a ROLS using the current DB PCB, use ROLX.) Roll call against the DB PCB (DFSDDLT0 call function). This call is used to request a Roll Back call to DB PCB, and is changed to ROLS call when making the DL/I call. Set options. OPTION statement required. FEEDBACK statement optional. Create or cancel intermediate backout points. Uses I/O PCB. To issue a SETS with an I/O area and token as the fourth parameter, specify the four-byte token in column 16 of the CALL statement and include a DATA statement. Leaving columns 16-19 blank will cause the call to be made without the I/O area and the token. Sets the identification and destination for snap dumps. If a SNAP call is issued without a CALL DATA statement, a snap of the I/O buffer pools and control blocks will be taken and sent to LOG if online and to PRINTDD DCB if batch. The SNAP ID will default to SNAPxxxx where xxxx starts at 0000 and is incremented by 1 for every SNAP call without a DATA statement. The SNAP options default to YYYN. If a CALL DATA statement is used, columns 16-23 specify the SNAP destination, columns 24-31 specify the SNAP identification, and columns 32-35 specify the SNAP options. SNAP options are coded using Y to request a snap dump and N to prevent it. Column 32 snaps the I/O buffer pools, columns 33 and 34 snap the IMS control blocks and column 35 snaps the entire region. The SNAP call function is only supported for full-function database PCB.
O RCMD
3
yes
no
R O O O
ROLX
yes
yes
SETO SETS/SETU
yes yes
yes yes
N O
SNAP4
yes
yes
312
CALL Statement
Table 45. DL/I Call Functions (continued) Call STAT
5
Data Stmt1 O
Description The STAT call retrieves statistics on the IMS system. This call must reference only full-function DB PCBs. See the examples on 321. Statistics type is coded in columns 16-19 of the CALL FUNCTION statement. DBAS For OSAM database buffer pool statistics.
VBAS For VSAM database subpool statistics. Statistics format is coded in column 20 of the CALL FUNCTION statement. F U S SYNC XRST Notes: 1. R = required; O = optional; N = none 2. The data statement is required on the AIB interface. 3. Valid only on the AIB interface. 4. SNAP is a Product-sensitive programming interface. 5. STAT is a Product-sensitive programming interface. yes yes yes yes R R For the full statistics to be formatted if F is specified, the I/O area must be at least 360 bytes. For the full statistics to be unformatted if U is specified, the I/O area must be at least 72 bytes. For a summary of the statistics to be formatted if S is specified, the I/O area must be at least 120 bytes.
Synchronization. Restart.
Symbolic CHKP Call with Two Data Areas to Checkpoint: Use a CALL FUNCTION statement to contain the CHKP function, a CALL DATA statement to contain the checkpoint ID data, and two CALL DATA statements to contain the data that you want to checkpoint. You also need to use an XRST call when you use the symbolic CHKP call. Prior usage of an XRST call is required when using the symbolic CHKP call, as the CHKP call keys on the XRST call for symbolic CHKP. Recommendation: Issue an XRST call as the first call in the application program.
313
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L XRST L . L . L . L CHKP L DATA TSTCHKP2 X L 8 DATA STRING2X L 16 DATA STRING2-STRING2U EIGHT BYTES OF DATA (STRING2-) IS CHECKPOINTED AND U SIXTEEN BYTES OF DATA (STRING2-STRING2-) IS CHECKPOINTED ALSO
CHNG Call: Use a CALL FUNCTION statement to contain the CHNG function and a CALL DATA statement to contain the new logical terminal name.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L CHNG SET1 L OPT IAFP=A1M,PRTO=LLOPTION1,OPTION2, L CONT OPTION4 L Z0023 DATA DESTNAME
LL is the hex value of the length of LLOPTION,.........OPTION4. The following is an example of a CHNG statement using SETO ID SET2, OPTION statement, DATA statement with MODNAME, and FDBK statement.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L CHNG SET2 L OPT IAFP=A1M,TXTU=SET2 L Z0023 DATA DESTNAME L Z0095 FDBK FEEDBACK AREA
CMD Call: Use a CALL FUNCTION statement to contain the CMD function and a CALL DATA statement to contain the Command data.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L CMD L ZXXXX DATA COMMAND DATA WHERE XXXX = THE LENGTH OF THE COMMAND DATA
DEQ Call: For full function, use a CALL FUNCTION statement to contain the DEQ function and a CALL DATA statement to contain the DEQ value (A,B,C,D,E,F,G,H,I or J).
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L DEQ L DATA A
For Fast Path, use a CALL FUNCTION statement to contain the DEQ function.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L DEQ
DLET Call: Use a CALL FUNCTION statement to contain the DLET function. The data statement is optional. If there are intervening calls to other PCBs between the Get Hold call and the DLET call, you must use a data statement to refresh the I/O area with the segment to be deleted.
314
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L DLET
FLD Call: Use a CALL FUNCTION statement to contain the FLD function and ROOTSSA, and a CALL DATA statement to contain the FSAs.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L FLD ROOTA (KEYA =ROOTA) L DATA ??????? X L DATA
GCMD Call: Use a CALL FUNCTION statement to contain the GCMD function; no CALL DATA statement is required.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GCMD
GHN Call: Use a CALL FUNCTION statement to contain the GHN function; no CALL DATA statement is required.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GHN 10103210
GHNP Call: Use a CALL FUNCTION statement to contain the GHNP function; no CALL DATA statement is required.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GHNP 10103210
GHU Call with a Continued SSA:Use two CALL FUNCTION statements to contain the single SSA.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GHU SEGG (FILLRG = G131G131G131G131G131G131G131G131G131G* CONT 131G131G131G131G131G131G131 )
GMSG Call: Use a CALL FUNCTION statement to contain the GMSG function. Use a CALL DATA statement to retrieve messages from AO exit routine.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GMSG TOKEN111 WAITAOI L Z0132 DATA L GMSG L Z0132 DATA
GN Call: Use a CALL FUNCTION statement to contain the GN function; no CALL DATA statement is required.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GN 10103210
GNP Call: Use a CALL FUNCTION statement to contain the GNP function; no CALL DATA statement is required.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GNP 10103210
315
CALL Statement
GU Call with a Single SSA and a Relational Operator: Use a CALL FUNCTION statement to contain the GU function; no CALL DATA statement is required. The qualified SSA begins in column 24 and is contained in parentheses.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU SEGF (KEYF > F131*KEYF < F400)
GU Call with a Single SSA and a Relational Operator Extended Across Multiple Inputs with Boolean Operators: Use a CALL FUNCTION statement to contain the GU function and three additional continuation of CALL FUNCTION input to continue with Boolean operators. No CALL DATA statement is required. The qualified SSA begins in column 24 and is contained in parentheses. This type of SSA can continue over several statements.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU SEGG (FILLRG > G131G131G131G131G131G131G131G131G131G* CONT 131G131G131G131G131G131G131 &FILLRG < G400G400G4* CONT 00G400G400G400G400G400G400G400G400G400G400G400G400G400 * CONT )
GU Path Call: Use a CALL FUNCTION statement to contain the GU function and three additional continuation of CALL function input to continue with two additional SSAs. No CALL DATA statement is required. The call uses command codes in columns 24 and 25 to construct the path call. This type of call cannot be made with the column-specific SSA format.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU SEGA *D(KEYA = A200) * SEGF *D(KEYF = F250) * SEGG *D(KEYG = G251)
ICMD Call: Use a CALL FUNCTION statement to contain the ICMD function. Use a CALL DATA statement to contain the command.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ICMD L Z0132 DATA /DIS ACTIVE
INIT Call: Use a CALL FUNCTION statement to contain the INIT call and a CALL DATA statement to contain the INIT function DBQUERY, STATUS GROUPA, or STATUS GROUPB.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L INIT 10103210 L Z0011 DATA DBQUERY
INQY Call: Use a CALL FUNCTION statement to contain the INQY call and either the DBQUERY or ENVIRON subfunction. The subfunctions are in the call input rather than the data input as in the INIT call.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L INQY ENVIRON 10103210 L V0256 DATA 10103211 L 10103212 |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L INQY DBQUERY 10103210 L V0088 DATA 10103211 L 10103212
316
CALL Statement
ISRT Call: Use two CALL FUNCTION statements to contain the multiple SSAs and a CALL DATA statement to contain the segment data.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT STOCKSEG(NUMFIELD =20011) X10103210 ITEMSSEG 10103211 L V0018 DATA 3002222222222222 10103212
ISRT Containing Only One Fixed-Length Segment: Use a CALL FUNCTION statement to contain the ISRT function and segment name, and two CALL DATA statements to contain the fixed-length segment. When inserting only one fixed-length segment, leave columns 4 through 8 blank and put data in columns 16 through 71. To continue data, put a nonblank character in column 72, and the continued data in columns 16 through 71 of the next statement.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT JOKESSEG 10103210 L DATA THEQUICKBLACKDOGJUMPEDONTOTHECRAZYFOXOOPSTHEQUICKBROWNFO*10103211 XJUMPEDOVERTHELAZYDOGSIR 10103212
ISRT Containing Only One Variable-Length Segment: Use a CALL FUNCTION statement to contain the ISRT function and segment name, and two CALL DATA statements to contain the variable-length segment. When only one segment of variable-length is being processed, you must enter a V in column 4, and columns 5 through 8 must contain the length of the segment data. The length in columns 5 through 8 is converted to binary and becomes the first two bytes of the segment data. To continue data, put a nonblank character in column 72, and the continued data in columns 16 through 71 of the next statement.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT JOKESSEG 10103210 L V0080 DATA THEQUICKBLACKDOGJUMPEDONTOTHECRAZYFOXOOPSTHEQUICKBROWNFO*10103211 XJUMPEDOVERTHELAZYDOGSIR 10103212
ISRT Containing Multiple Variable-Length Segments: Use a CALL FUNCTION statement to contain the ISRT function and segment name, and four CALL DATA statements to contain the variable-length segments. For the first segment, you must enter a V in column 4 and the length of the segment data in columns 5 through 8. If the segment is longer than 56 bytes, put a nonblank character in column 72, and continue data on the next statement as described above. The last statement to contain data for this segment must have a nonblank character in column 72. The next DATA statement applies to the next variable-length segment and it must contain an M in column 4, the length of the new segment in columns 5 through 8, and data starting in column 16. Any number of variable-length segments can be concatenated in this manner. If column 72 is blank, the next statement must have the following: v An L in column 1 v v v v An M in column 4 The length of the new segment in columns 5 through 8 The keyword DATA in columns 10 through 13 Data starting in column 16
317
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT AAAAASEG 10103210 L V0080 DATA THEQUICKBLACKDOGJUMPEDONTOTHECRAZYFOXOOPSTHEQUICKBROWNFO*10103211 XJUMPEDOVERTHELAZYDOGSIR *10103212 M0107 DATA NOWISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRYNOW*10103213 ISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRY 10103214
ISRT Containing Multiple Segments in a PATH CALL: Use a CALL FUNCTION statement to contain the ISRT function and segment name, and seven CALL DATA statements to contain the multiple segments in the PATH CALL. When DFSDDLT0 is inserting or replacing segments through path calls, you can use V and P in successive statements. The same rules apply for coding multiple variable-length segments, but fixed-length segments must have a P in column 4 of the DATA statement. This causes the length field in columns 5 through 8 to be used as the length of the segment, and causes the data to be concatenated in the I/O area without including the LL field. Rules for continuing data in the same segment or starting a new segment in the next statement are the same as those applied to the variable-length segment.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT LEV01SEG*D *10103210 LEV02SEG *10103211 LEV03SEG *10103212 LEV04SEG 10103213 L V0080 DATA THEQUICKBLACKDOGJUMPEDONTOTHECRAZYFOXOOPSTHEQUICKBROWNFO*10103214 XJUMPEDOVERTHELAZYDOGSIR *10103215 M0107 DATA NOWISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRYNOW*10103216 ISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRY *10103217 L P0039 DATA THEQUICKBROWNFOXJUMPEDOVERTHELAZYDOGSIR *10103218 L M0107 DATA NOWISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRYNOW*10103219 ISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRCOUNTRY 10103220
LOG Call Using an LLZZ Format: Use a CALL FUNCTION statement to contain the LOG function and a CALL DATA statement to contain the LLZZ format of data to be logged. When you put a Z in column 4, the first word of the record is not coded in the DATA statement. The length specified in columns 5 through 8 must include the 4 bytes for the LLZZ field that is not in the DATA statement.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L LOG 10103210 L Z0016 DATA ASEGMENT ONE 10103211
The A in column 16 becomes the log record ID. POS Call: Use a CALL FUNCTION statement to contain the POS function and SSA; CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L POS SEGA (KEYA =A300)
PURG Call with MODNAME and Data: Use a CALL FUNCTION statement to contain the PURG function and MOD name. Use the CALL DATA statement to contain the message data. If MOD name is provided, a DATA statement is required.
318
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L PURG MODNAME1 L DATA FIRST SEGMENT OF NEW MESSAGE
PURG Call with Data and no MODNAME: Use a CALL FUNCTION statement to contain the PURG function; a DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L PURG L DATA FIRST SEGMENT OF NEW MESSAGE
PURG Call without MODNAME or Data: Use a CALL FUNCTION statement to contain the PURG function; CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L PURG
RCMD Call: Use a CALL FUNCTION statement to contain the RCMD function. Use a CALL DATA statement to retrieve second and subsequent command response segments resulting from an ICMD call.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L RCMD L Z0132 DATA
REPL Call: Use a CALL FUNCTION statement to contain the REPL function. Use a CALL DATA statement to contain the replacement data.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L REPL L V0028 DATA THIS IS THE REPLACEMENT DATA
ROLB Call Requesting Return of First Segment of Current Message: Use a CALL FUNCTION statement to contain the ROLB function. Use the CALL DATA statement to request first segment of current message.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLB L DATA THIS WILL BE OVERLAID WITH FIRST SEGMENT OF MESSAGE
ROLB Call Not Requesting Return of First Segment of Current Message: Use a CALL FUNCTION statement to contain the ROLB function. The CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLB
ROLL Call: Use a CALL FUNCTION statement to contain the ROLL function. The CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLL
ROLS Call with a Token: Use a CALL FUNCTION statement to contain the ROLS function and token, and the CALL DATA statement to provide the data area that will be overlaid by the data from the SETS call.
319
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLS TOKEN1 L Z0046 DATA THIS WILL BE OVERLAID WITH DATA FROM SETS
ROLS Call without a Token: Use a CALL FUNCTION statement to contain the ROLS function. The CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLS
ROLX Call: Use a CALL FUNCTION statement to contain the ROLX function. The CALL DATA statement is optional. The ROLX function is treated as a ROLS call with no token.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ROLX
SETO Call: Use a CALL FUNCTION statement to contain the SETO function. The DATA statement is optional; however, if an OPTION statement is passed on the call, the DATA statement is required. Also, if a FEEDBACK statement is passed on the call, then both the DATA and OPTION statements are required. The following is an example of a SETO statement using the OPTION statement and SETO token of SET1.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SETO SET1 5000 L OPT PRTO=11OPTION1,OPTION2, L CONT OPTION3, L CONT OPTION4
11 is the hex value of the length of 11OPTION,.........OPTION4. The following is an example of a SETO statement using the OPTION statement and SETO token of SET1.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SETO SET1 7000 L OPT PRTO=11OPTION1,OPTION2,OPTION3,OPTION4
11 is the hex value of the length of 11OPTION,.........OPTION4. The following is an example of a SETO statement using the OPTION statement and SETO token of SET2 and FDBK statement.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SETO SET2 5500 L OPT PRTO=11OPTION1,OPTION2,OPTION3,OPTION4 L Z0099 FDBK OPTION ERROR FEEDBACK AREA
11 is the hex value of the length of 11OPTION,.........OPTION4. SETS Call with a Token: Use a CALL FUNCTION statement to contain the SETS function and token; use the CALL DATA statement to provide the data that is to be returned to ROLS call.
320
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SETS TOKEN1 L Z0033 DATA RETURN THIS DATA ON THE ROLS CALL
SETS Call without a Token: Use a CALL FUNCTION statement to contain the SETS function; CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SETS
This section (SNAP call) contains product-sensitive programming interface information. SNAP Call: Use a CALL FUNCTION statement to contain the SNAP function and a CALL DATA statement to contain the SNAP data.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SNAP 10103210 L V0022 DATA PRINTDD 22222222 10103212
This section (STAT call) contains product-sensitive programming interface information. STAT Call: OSAM statistics require only one STAT call. STAT calls for VSAM statistics retrieve only one subpool at a time, starting with the smallest. See IMS Version 8: Application Programming: Design Guide for further information about the statistics returned by STAT.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L STAT DBASF L STAT VBASS L STAT VBASS L STAT VBASS L STAT VBASS
SYNC Call: Use a CALL FUNCTION statement to contain the SYNC function. The CALL DATA statement is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SYNC
Initial XRST Call: Use a CALL FUNCTION statement to contain the XRST FUNCTION and a CALL DATA statement that contains a checkpoint ID of blanks to indicate that you are normally starting a program that uses symbolic checkpoints.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L XRST 10101400 L DATA L CKPT L DATA YOURID01
Basic XRST Call: Use a CALL FUNCTION statement to contain the XRST function and a CALL DATA statement to contain the checkpoint ID.
321
CALL Statement
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L XRST 10101400 L DATA TESTCKPT
Symbolic XRST Call: Use a CALL FUNCTION statement to contain the XRST function, a CALL DATA statement to contain the checkpoint ID data, and one or more CALL DATA statements where the data is to be returned. The XRST call is used with the symbolic CHKP call.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L XRST L DATA TSTCHKP2 X L 8 DATA OVERLAY2 X L 16 DATA OVERLAY2OVERLAY2 U EIGHT BYTES OF DATA (OVERLAY2) SHOULD BE OVERLAID WITH CHECKPOINTED DATA U SIXTEEN BYTES OF DATA (OVERLAY2OVERLAY2) IS OVERLAID ALSO
10-13
b xxxx CONT
Reserved SSA name Reserved Start character for SSA SSA field name Reserved
b s-name b ( f-name b Required if call contains SSA. Separator field. Required if segment is qualified. Required if segment is qualified. Separator field. Required if segment is qualified.
322
CALL Statement
Table 46. CALL FUNCTION Statement (Column-Specific SSAs) (continued) Column 37 38-nn nn+1 72 Function Reserved Field value End character for SSA Continuation column Code b nnnnn ) b x Description Separator field. Required if segment is qualified. Note: Do not use '5D' or ')' in field value. Required if segment is qualified. No continuations for this statement. Alone, it indicates multiple SSAs each beginning in column 16 of successive statements. With CONT in columns 10-13 of the next statement, indicates a single SSA that is continued beginning in column 16 of the following statement For SYSIN2 statement override.
73-80
Sequence indication
nnnnnnnn
If a CALL FUNCTION statement contains multiple SSAs, the statement must have a nonblank character in column 72 and the next SSA must start in column 16 of the next statement. If a field value extends past column 71, put a nonblank character in column 72. In the next statement insert the keyword CONT in columns 10 through 13 and continue the field value starting at column 16. Maximum length for field value is 256 bytes, maximum size for an SSA is 290 bytes, and the maximum number of SSAs for this program is 15, which is the same as the IMS limit.
9 10-15
b STAK END SKIP START Stack control statements for later execution. Stop stacking and begin execution. Skip statements until START function is encountered. Start processing statements again.
323
CALL Statement
Table 47. CALL FUNCTION Statement with DFSDDLT0 Call Functions (continued) Column 73-80 Function Sequence indication Code nnnnnnnn Description For SYSIN2 statement override.
v STAK/END (stacking control statements) With the STAK statement, you repeat a series of statements that were read from SYSIN and held in memory. All control statements between the STAK statement and the END statement are read and saved. When DFSDDLT0 encounters the END statement, it executes the series of calls as many times as specified in columns 5 through 8 of the STAK statement. STAK calls imbedded within another STAK cause the outer STAK call to be abnormally terminated. v SKIP/START (skipping control statements) With the SKIP and START statements, you identify groups of statements that you do not want DFSDDLT0 to process. These functions are normally read from SYSIN2 and provide a temporary override to an established SYSIN input stream. DFSDDLT0 reads all control statements occurring between the SKIP and START statements, but takes no action. When DFSDDLT0 encounters the START statement, it reads and processes the next statement normally.
SKIP/START Call: The following example demonstrates the use of the SKIP and START call functions in SYSIN2 to override and stop the processing of the STAK and END call functions in SYSIN. DFSDDLT0 executes the GU call function in SYSIN, skips the processing of STACK, WTO, T comment, GN, and END in SYSIN, and goes to the COMMENT.
324
COMMENT Statement
//BATCH.SYSIN DD * 10000700 |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< O SNAP= ,ABORT=0 10000800 S 1 1 1 1 1 10001000 L GU SEGA (KEYA =A300) 10001100 L 0003 STAK 10001150 WTO THIS IS PART OF THE STAK 10001200 T THIS COMMENT IS PART OF THE STAK 10001300 L GN 10001400 L END 10001450 U THIS COMMENT SHOULD GET PRINTED AFTER THE STAK IS DONE 3 TIMES 10001500 L 0020 GN 10001600 /* //BATCH.SYSIN2 DD * |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L SKIP 10001150 L START 10001450 U THIS COMMENT SHOULD REPLACE THE STAK COMMENT 10001500 U ********THIS COMMENT SHOULD GET PRINTED BECAUSE OF SYSIN2********* 10001650 /*
COMMENT Statement
Use the COMMENT statement to print comments in the output data. The two types of COMMENT statements, conditional and unconditional, are described below. Table 48 shows the format of the COMMENT statement.
325
COMPARE Statement
//BATCH.SYSIN DD * 10000700 |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< O SNAP= ,ABORT=0 10000800 S 1 1 1 1 1 10001000 L GU SEGB (KEYA =A400) 10001100 T THIS COMMENT IS A CONDITIONAL COMMENT FOR THE FIRST GN 10001300 L GN 10001400 U THIS COMMENT IS AN UNCONDITIONAL COMMENT FOR THE SECOND GN 10001500 L 0020 GN 10001600 /*
COMPARE Statement
The COMPARE statement compares the actual results of a call with the expected results. The three types of COMPARE statements are the COMPARE PCB, COMPARE DATA, and COMPARE AIB. When you use the COMPARE PCB, COMPARE DATA, and COMPARE AIB statements you must: v Code COMPARE statements in the DFSDDLT0 stream immediately after either the last continuation, if any, of the CALL DATA statement or another COMPARE statement. v Specify the print option for the COMPARE statements in column 7 of the STATUS statement. For all three COMPARE statements: v The condition code returned for a COMPARE gives the total number of unequal comparisons. v For single fixed-length segments, DFSDDLT0 uses the comparison length to perform comparisons if you provide a length. The length comparison option (column 3) is not applicable. When you use the COMPARE PCB statement and you want a snap dump when there is an unequal comparison, request it on the COMPARE PCB statement. A snap dump to a log with SNAP ID COMPxxxx is issued along with the snap dump options specified in column 3 of the COMPARE PCB statement. The numeric part of the SNAP ID is initially set to 0000 and is incremented by 1 for each SNAP resulting from an unequal comparison.
326
COMPARE Statement
Table 49. COMPARE DATA Statement (continued) Column Function Code L Description The length in columns 5-8 is converted to binary and compared against the LL field of the segment.
b V For a variable-length segment only, or for the first variable-length segment of multiple variable-length segments in a path call, or for a concatenated logical child/logical parent segment. For the second or subsequent variable-length segment of a path call, or for a concatenated logical child/logical parent segment. For fixed-length segments in path calls. For message segment. Length to be used for comparison. (Required for length options V, M, and P if L is coded in column 3.)
9 10-13
b DATA Required for the first I/O COMPARE statement and the first statement of a new segment if data from previous I/O COMPARE statement is not continued.
14-15 16-71
b Data against which the segment in the I/O area is to be compared. b x If blank, data is NOT continued. If not blank, data will be continued, starting in columns 16-71 of the subsequent statements for a maximum of 3840 bytes. For SYSIN2 statement override.
72
Continuation column
73-80
Sequence indication
nnnnnnnn
327
COMPARE Statement
Table 49. COMPARE DATA Statement (continued) Column Notes: v If you code an L in column 3, the value in columns 5 through 8 is converted to binary and compared against the LL field of the returned segment. If you leave column 3 blank and the segment is not in a path call, then the value in columns 5 through 8 is used as the length of the comparison. v If you code column 4 with a V, P, or M, you must enter a value in columns 5 through 8. v If this is a path call comparison, code a P in column 4. The value in columns 5 through 8 must be the exact length of the fixed segment used in the path call. v If you specify the length of the segment, this length is used in the COMPARE and in the display. If you do not specify a length, DFSDDLT0 uses the shorter of the following for the length of the comparison and display: The length of data supplied in the I/O area by IMS The number of DATA statements read times 56 Function Code Description
To execute the same COMPARE AIB after a series of calls, put an H in column 2. When you specify an H, the COMPARE statement executes after each call. The H COMPARE statement is particularly useful when comparing with the same status code on repeated calls. The H COMPARE statement stays in effect until another COMPARE AIB statement is read.
328
COMPARE Statement
Table 51. COMPARE PCB Statement Column 1 2 Function Identifies control statement Hold compare option Code E H b 3 Snap dump options b (if compare was unequal) 1 2 4 8 S Description COMPARE statement. Hold compare statement. Reset hold condition for a single COMPARE statement. Use default value. (You can change the default value or turn off the option by coding the value in an OPTION statement.) The complete I/O buffer pool. The entire region (batch regions only). The DL/I blocks. Terminate the job step on miscompare of DATA or PCB. To SNAP subpools 0 through 127. Requests for multiple SNAP dump options can be obtained by summing their respective hexadecimal values. If anything other than a blank, 1-9, A-F, or S is coded in column 3, the SNAP dump option is ignored. Ignore extended option. SNAP the complete buffer pool (batch). SNAP subpools 0 through 127 (batch). An area is never snapped twice. The SNAP option is a combination of columns 3 (SNAP dump option) and 4 (extended SNAP option). 5-6 7 8-9 Segment level Reserved Status code nn b b xx XX OK 10 11-18 Reserved Segment name User Identification b xxxxxxxx Segment name for DB PCB compare. Logical terminal for I/O. Destination for ALT PCB. 19 20-23 Reserved Length of key b nnnn 'nnnn' is length of the feedback key. Allow blank status code only. Allow specified status code only. Do not check status code. Allow the following: blank, GA, GC, or GK. 'nn' is the segment level for COMPARE PCB. A leading zero is required.
b P S
329
COMPARE Statement
Table 51. COMPARE PCB Statement (continued) Column 24-71 or 24-31 72 Function Concatenated key User ID Continuation column b x Code Description Concatenated key feedback for DB PCB compare. User identification for TP PCB. If blank, key feedback is not continued. If not blank, key feedback is continued, starting in columns 16-71 of subsequent statements. For SYSIN2 statement override.
73-80 Note:
Sequence indication
nnnnnnnn
Blank fields are not compared to the corresponding field in the PCB, except for the status code field. (Blanks represent a valid status code.) To accept the status codes blank, GA, GC, or GK as a group, put OK in columns 8 and 9. To stop comparisons of status codes, put XX in columns 8 and 9. To execute the same compare after a series of calls, put an H in column 2. This executes the COMPARE statement after each call. This is particularly useful to compare to a blank status code only when loading a database. The H COMPARE statement stays in effect until another COMPARE PCB statement is read.
COMPARE PCB Statement for SSA Level, Status Code, Segment Name, Concatenated Key Length, and Concatenated Key: The COMPARE PCB statement is a request to compare the SSA level, a status code of OK (which includes blank, GA, GC, and GK), segment name of SEGA, concatenated key length of 0004, and a concatenated key of A100.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU E 01 OK SEGA 0004A100
COMPARE PCB Statement for SSA Level, Status Code, Segment Name, Concatenated Key Length, and Concatenated Key: The COMPARE PCB statement causes the job step to terminate based on the 8 in column 3 when any of the fields in the COMPARE PCB statement are not equal to the corresponding field in the PCB.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU 10105100 E 8 01 OK SEGK 0004A100 10105200
330
COMPARE Statement
COMPARE PCB Statement for Status Code with Hold Compare: The COMPARE PCB statement is a request to compare the status code of OK (which includes blank, GA, GC, and GK) and hold that compare until the next COMPARE PCB statement. The compare of OK is used on GN following GU and is also used on a GN that has a request to be repeated six times.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU SEGA (KEYA = A300) 20201100 L GN 20201300 EH OK 20201400 L 0006 GN 20201500
COMPARE DATA Statement for Fixed-Length Segment: The COMPARE DATA statement is a request to compare the data returned. 72 bytes of data are compared.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU E DATA A100A100A100A100A100A100A100A100A100A100A100A100A100A100X10102200 E A100A100A100A100 10102300
COMPARE DATA Statement for Fixed-Length Data for 64 Bytes: The COMPARE DATA statement is a request to compare 64 bytes of the data against the data returned.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU 10101600 E 0064 DATA A100A100A100A100A100A100A100A100A100A100A100A100A100A100X10101700 E A100A100B111B111 10101800
COMPARE DATA Statement for Fixed-Length Data for 72 Bytes: The COMPARE DATA statement is a request to compare 72 bytes of the data against the data returned.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L GU 10103900 E LP0072 DATA A100A100A100A100A100A100A100A100A100A100A100A100A100A100X10104000 E A100A100A100A100 10104100
COMPARE DATA Statement for Variable-Length Data of Multiple-Segments Data and Length Fields: The COMPARE DATA statement is a request to compare 36 bytes of the data against the data returned for segment 1 and 16 bytes of data for segment 2. It compares the length fields of both segments.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT D (DSS = DSS01) X38005500 L DJ (DJSS = DJSS01) X38005600 L QAJAXQAJ 38005700 L V0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38005800 L M0016 DATA QAJSS01*IQAJ** 38005850 L GHU D (DSS = DSS01) X38006000 DJ (DJSS = DJSS01) X38006100 QAJAXQAJ (QAJASS = QAJASS97) 38006200 E LV0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38006300 E LM0016 DATA QAJSS01*2QAJ** 38006350
COMPARE DATA Statement for Variable-Length Data of Multiple Segments with no Length Field COMPARE: The COMPARE DATA statement is a request to
331
COMPARE Statement
compare 36 bytes of the data against the data returned for segment 1 and 16 bytes of data for segment 2 with no length field compares of either segment.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT D (DSS = DSS01) X38005500 L DJ (DJSS = DJSS01) X38005600 L QAJAXQAJ 38005700 L V0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38005800 L M0016 DATA QAJSS01*IQAJ** 38005850 L GHU D (DSS = DSS01) X38006000 DJ (DJSS = DJSS01) X38006100 QAJAXQAJ (QAJASS = QAJASS97) 38006200 E V0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38006300 M0016 DATA QAJSS01*2QAJ** 38006350
COMPARE DATA Statement for Variable-Length Data of Multiple Segments and One Length Field COMPARE: The COMPARE DATA statement is a request to compare 36 bytes of the data against the data returned for segment 1 and 16 bytes of data for segment 2. It compares the length field of segment 1 only.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< L ISRT D (DSS = DSS01) X38005500 L DJ (DJSS = DJSS01) X38005600 L QAJAXQAJ 38005700 L V0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38005800 L M0016 DATA QAJSS01*IQAJ** 38005850 L GHU D (DSS = DSS01) X38006000 DJ (DJSS = DJSS01) X38006100 QAJAXQAJ (QAJASS = QAJASS97) 38006200 E LV0036 DATA QSS02QASS02QAJSS01QAJASS97*IQAJA** *38006300 M0016 DATA QAJSS01*2QAJ** 38006350
IGNORE Statement
DFSDDLT0 ignores any statement with an N or a period (.) in column 1. You can use the N or . (period) to comment out a statement in either the SYSIN or SYSIN2 input streams. Using an N or . (period) in a SYSIN2 input stream causes the SYSIN input stream to be ignored as well. See SYSIN2 DD Statement on page 342 for information on how to override SYSIN input. Table 52 gives the format of the IGNORE statement. An example of the statement follows.
Table 52. IGNORE Statement Column 1 2-72 73-80 Function Identifies control statement Ignored Sequence indication nnnnnnnn For SYSIN2 statement override. Code N or . Description IGNORE statement.
Example of IGNORE (N or .)
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< . NOTHING IN THIS AREA WILL BE PROCESSED. ONLY THE SEQUENCE NUMBER 67101010 N WILL BE USED IF READ FROM SYSIN2 OR SYSIN. 67101020
332
OPTION Statement
OPTION Statement
Use the OPTION statement to override various default options. Use multiple OPTION statements if you cannot fit all the options you want in one statement. No continuation character is necessary. Once you set an option, it remains in effect until you specify another OPTION statement to change the first parameter. Table 53 shows the format of the OPTION statement. An example follows.
Table 53. OPTION Statement Column Function 1 2 3-72 Identifies control statement Reserved Keyword parameters: ABORT= v 0 v 1 to 9999 v Turns the ABORT parameter off. v Number of unequal compares before aborting job. Initial default is 5. Number of lines printed per page. Must be filled with zeros. Initial default 54. SNAP option default, when results of compare are unequal. To turn the SNAP option off, code 'SNAP='. See COMPARE PCB Statement on page 328 for the appropriate values for this parameter. (Initial default is 5 if this option is not coded. This causes the I/O buffer pool and the DL/I blocks to be dumped with a SNAP call.) Produce/do not produce dump if job abends. Default is NODUMP. v H v C v Hexadecimal representation for lower case characters. This is the initial default. v Character representation for lower case characters. STATCD/NOSTATCD Issue/do not issue an error message for the internal, end-of-job stat call that does not receive a blank or GA status code. NOSTATCD is the default. Issue/do not issue a DFSDDLT0 ABENDU0249 when an invalid status code is returned for any of the internal end-of-job stat calls in a batch environment. NOABU249 is the default. For SYSIN2 statement override. Code O b Description OPTION statement (free-form parameter fields).
LINECNT=
10 to 99
SNAP1
DUMP/NODUMP LCASE=
ABU249/NOABU249
73 - 80
Sequence indication
nnnnnnnn
333
OPTION Statement
Table 53. OPTION Statement (continued) Column Function Note: 1. SNAP is a Product-sensitive programming interface. Code Description
PUNCH Statement
The PUNCH CTL statement allows you to produce an output data set consisting of COMPARE PCB statements, COMPARE DATA statements, COMPARE AIB statements, other control statements (with the exceptions noted below), or combinations of the above. Table 54 shows the format and keyword parameters for the PUNCH CTL statement.
Table 54. PUNCH CTL Statement Column 1-3 Function Identifies control statement Reserved Punch control Code CTL Description PUNCH statement.
4-9 10-13
b PUNC NPUN Begin punching (no default values). Stop punching (default value).
14-15 16-72
Reproduces all input control statements except: v CTL (PUNCH) statements. v N or . (IGNORE) statements. v COMPARE statements. v CALL statements with functions of SKIP and START. Any control statements that appear between SKIP and START CALLs are not punched. (See SKIP/START 324). v CALL statements with functions of STAK and END. Control statements that appear between STAK and END CALLS are saved and then punched the number of times indicated in the STAK CALL. (See STAK/END 324).
334
PUNCH Statement
Table 54. PUNCH CTL Statement (continued) Column Function DATAL Code Description Create a full data COMPARE using all of the data returned to the I/O area. Multiple COMPARE statements and continuations are produced as needed. Create a single data COMPARE statement using only the first 56 bytes of data returned to the I/O area. Create a full PCB COMPARE using the complete key feedback area returned in the PCB. Multiple COMPARE statements and continuations are produced as needed. Create a single PCB COMPARE statement using only the first 48 bytes of the key feedback area returned in the PCB. If a GB status code is returned on a Fast Path call while in STAK, but prior to exiting STAK, this function issues or does not issue SYNC. 00000001 to 99999999. This is the starting sequence number to be used for the punched statements. Eight numeric bytes must be coded. INCR= 1 to 9999. Increment the sequence number of each punched statement by this value. Leading zeros are not required. AIB 73-80 Sequence indication nnnnnnnn Create an AIB COMPARE statement. For SYSIN2 statement override.
DATAS
PCBL
PCBS
SYNC/NOSYNC
START=
To change the punch control options while processing a single DFSDDLT0 input stream, always use PUNCH CTL statements in pairs of PUNC and NPUN. One way to use the PUNCH CTL statement is as follows: 1. Code only the CALL statements for a new test. Do not code the COMPARE statements. 2. Verify that each call was executed correctly. 3. Make another run using the PUNCH CTL statement to have DFSDDLT0merge the proper COMPARE statements and produce a new output data set that can be used as input for subsequent regression tests.
335
PUNCH Statement
You can also use PUNCH CTL if segments in an existing database are changed. The control statement causes DFSDDLT0 to produce a new test data set that has the correct COMPARE statements rather than you having to manually change the COMPARE statements. Parameters in the CTL statement must be the same length as described in Table 54, and they must be separated by commas.
The DD statement for the output data set is labeled PUNCHDD. The data sets are fixed block with LRECL=80. Block size as specified on the DD statement is used. If not specified, the block size is set to 80. If the program is unable to open PUNCHDD, DFSDDLT0 issues abend 251.
STATUS Statement
With the STATUS statement, you establish print options and name the PCB that you want subsequent calls to be issued against. Table 55 shows the format of the STATUS statement.
Table 55. STATUS Statement Column Function 1 2 Identifies control statement Output device option Code S b 1 Description STATUS statement. Use PRINTDD when in a DL/I region; use I/O PCB in MPP region. Use PRINTDD in MPP region if DD statement is provided; otherwise, use I/O PCB. Same as if 1, and disregard all other fields in this STATUS statement. Do not print. Print for each call. Print only if compare done and unequal. Do not print. Print for each call. Print only if compare done and unequal. Do not print. Print for each call. Print only if compare done and unequal.
A 3 Print comment option b 1 2 4 Print AIB option b 1 2 5 Print call option b 1 2 6 Reserved b
336
STATUS Statement
Table 55. STATUS Statement (continued) Column Function 7 Print compare option Code b 1 2 8 9 Reserved Print PCB option b b 1 2 10 11 Reserved Print segment option b b 1 2 12 Set task and real time b 1 2 13-14 15 Reserved PCB selection option b 1 2 3 4 5 b PCB name passed in columns 16-23 (use option 1). DBD name passed in columns 16-23 (use option 2). Relative DB PCB passed in columns 16-23 (use option 3). Relative PCB passed in columns 16-23 (use option 4). $LISTALL passed in columns 16-23 (use option 5). If column 15 is blank, DFSDDLT0 selects options 2 through 5 based on content of columns 16-23. These columns must contain the name of the label on the PCB at PSBGEN, or the name specified on the PCBNAME= operand for the PCB at PSBGEN time. The default PCB is the first database PCB in the PSB. If columns 16-23 are blank, current PCB is used. If DBD name is specified, this must be the name of a database DBD in the PSB. When columns 16 through 18 are blank, columns (19-23) of this field are interpreted as the relative number of the DB PCB in the PSB. This number must be right-justified to column 23, but need not contain leading zeros. Do not print. Print for each call. Print only if compare done and unequal. Do not time Time each call. Time each call if compare done and unequal. Do not print. Print for each call. Print only if compare done and unequal. Description Do not print. Print for each call. Print only if compare done and unequal.
alpha
b alpha
b numeric
337
STATUS Statement
Table 55. STATUS Statement (continued) Column Function Opt. 4 PCB selection 16-18 I/O PCB 19-23 Relative position of PCB in PSB Code TPb numeric Description When columns 16 through 18 = 'TP ', columns (19-23) of this field are interpreted as the relative number of the PCB from the start of the PCB list. This number must be right-justified to column 23, but need not contain leading zeros. I/O PCB is always the first PCB in the PCB list in this program. Prints out all PCBs in the PSB for test script. Use print options to print this STATUS statement. Do not use print options in this statement; print this STATUS statement. Do not print this STATUS statement but use print options in this statement. Do not print this STATUS statement and do not use print options in this statement. This is optional and is only used when two PCBs have the same name but different processing options. If not blank, it is used in addition to the PCB name in columns 16 through 23 to select which PCB in the PSB to use.
Opt. 5 List all PCBs in the 16-23 PSB 24 Print status option
$LISTALL b 1 2 3
25-28
xxxx
29 30-32
b AIB Indicates that the AIB interface is used and the AIB is passed rather than passing the PCB. (Passing the PCB is the default.) Note: When the AIB interface is used, the PCB must be defined at PSBGEN with PCBNAME=name. IOPCB is the PCB name used for all I/O PCBs. DFSDDLT0 recognizes that name when column 15 contains a 1 and columns 16 through 23 contain IOPCB.
33 37-72 73-80
If DFSDDLT0 does not encounter a STATUS statement, all default print options (columns 3 through 12) are 2 and the default output device option (column 2) is 1. You can code a STATUS statement before any call sequence in the input stream, changing either the PCB to be referenced or the print options. The referenced PCB stays in effect until a subsequent STATUS statement selects another PCB. However, a call that must be issued against an I/O PCB (such as LOG) uses the I/O PCB for that call. After the call, the PCB changes back to the original PCB.
338
STATUS Statement
To Print Each CALL Statement, Select a PCB: The following STATUS statements tell DFSDDLT0 to print the COMMENTS, CALL, COMPARE, PCB, and SEGMENT DATA options for all calls, and select a PCB. The 1 in column 15 is required for PCBNAME. If omitted, the PCBNAME is treated as a DBDNAME.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< S 1 1 1 1 1 1PCBNAME |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< S 1 1 1 1 1 1PCBNAME AIB
To print each CALL statement, select PCB based on a DBD name: The following STATUS statements tell DFSDDLT0 to print the COMMENTS, CALL, COMPARE, PCB, and SEGMENT DATA options for all calls, and select a PCB by a DBD name. The 2 in column 15 is optional.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< S 1 1 1 1 1 2DBDNAME |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< S 1 1 1 1 1 2DBDNAME AIB
If you do not use the AIB interface, you do not need to change STATUS statement input to existing streams; existing call functions will work just as they have in the past. However, if you want to use the AIB interface, you must change the STATUS statement input to existing streams to include AIB in columns 30 through 32. The existing DBD name, Relative DB PCB, and Relative PCB will work if columns 30 through 32 contain AIB and the PCB has been defined at PSBGEN with PCBNAME=name.
WTO Statement
The WTO (Write to Operator) statement sends a message to the MVS console without waiting for a reply. Table 56 shows the format for the WTO statement.
Table 56. WTO Statement Column 1-3 4 5-72 Function Identifies control statement Reserved Message to send Code WTO b Message to be written to the system console. Description WTO statement.
339
WTO Statement
Table 56. WTO Statement (continued) Column 73-80 Function Sequence indication Code nnnnnnnn Description For SYSIN2 statement override.
WTOR Statement
The WTOR (Write to Operator with Reply) statement sends a message to the MVS system console and waits for a reply. Table 57 shows the format of the WTO statement.
Table 57. WTOR Statement Column 1-4 5 6-72 73-80 Function Identifies control statement Reserved Message to send Sequence indication nnnnnnnn Code WTOR b Message to be written to the system console. For SYSIN2 statement override. Description WTOR statement.
JCL Requirements
This section defines the DD statements that DFSDDLT0 uses. Execution JCL depends on the installation data set naming standards as well as the IMS environment (batch or online). See Figure 85 on page 341.
340
JCL Requirements
//SAMPLE JOB ACCOUNTING,NAME,MSGLEVEL=(1,1),MSGCLASS=3,PRTY=8 33001100 //GET EXEC PGM=DFSRRC00,PARM=DLI,DFSDDLT0,PSBNAME 33001200 //STEPLIB DD DSN=IMS.SDFSRESL,DISP=SHR 33001300 //IMS DD DSN=IMS2.PSBLIB,DISP=(SHR,PASS) 33001400 // DD DSN=IMS2.DBDLIB,DISP=(SHR,PASS) 33001500 //DDCARD DD DSN=DATASET,DISP=(OLD,KEEP) 33001600 //IEFRDER DD DUMMY 33001700 //PRINTDD DD SYSOUT=A 33001800 //SYSUDUMP DD SYSOUT=A 33001900 //SYSIN DD * 33002000 |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< U THIS IS PART OF AN EXAMPLE 33002100 S 1 1 1 1 1 PCB-NAME 33002200 L GU 33002300 /* //SYSIN2 DD * |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< ABEND 33002300 /*
Figure 86 is an example of coding JCL for DFSDDLT0 in a BMP. Use of a procedure is optional and is only shown here as an example.
//SAMPLE JOB ACCOUNTING,NAME,MSGLEVEL=(1,1),MSGCLASS=A 00010047 //************************************************************* //* BATCH DL/I JOB TO RUN FOR RSR TESTING * //************************************************************* //BMP EXEC IMSBATCH,MBR=DFSDDLT0,PSB=PSBNAME //BMP.PRINTDD DD SYSOUT=A //BMP.PUNCHDD DD SYSOUT=B //BMP.SYSIN DD * U ***THIS IS PART OF AN EXAMPLE OF SYSIN DATA 00010000 S 1 1 1 1 1 1 00030000 L GU 00040000 L 0099 GN 00050000 /* |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< //BMP.SYSIN2 DD * U ***THIS IS PART OF AN EXAMPLE OF SYSIN2 DATA ******************* 00020000 ABEND 00050000 /*
SYSIN DD Statement
The data set specified by the SYSIN DD statement is the normal input data set for DFSDDLT0. When processing input data that is on direct-access or tape, you may want to override certain control statements in the SYSIN input stream or to add other control statements to it. You do this with a SYSIN2 DD statement and the control statement sequence numbers. Sequence numbers in columns 73 to 80 for SYSIN data are optional unless a SYSIN2 override is used. If a SYSIN2 override is used, follow the directions for using sequence numbers as described in SYSIN2 DD Statement on page 342.
341
JCL Requirements
SYSIN2 DD Statement
DFSDDLT0 does not require the SYSIN2 DD statement, but if it is present in the JCL, DFSDDLT0 will read and process the specified data sets. When using SYSIN2, the following items apply: v The SYSIN DD data set is the primary input. DFSDDLT0 attempts to insert the SYSIN2 control statements into the SYSIN DD data set. v You must code the control groups and sequence numbers properly in columns 73 to 80 or the merging process will not work. v Columns 73 and 74 indicate the control group of the statement. v Columns 75 to 80 indicate the sequence number of the statement. v Sequence numbers must be in numeric order within their control group. v Control groups in SYSIN2 must match the SYSIN control groups, although SYSIN2 does not have to use all the control groups used in SYSIN. DFSDDLT0 does not require that control groups be in numerical order, but the control groups in SYSIN2 must be in the same order as those in SYSIN. v When DFSDDLT0 matches a control group in SYSIN and SYSIN2, it processes the statements by sequence number. SYSIN2 statements falling before or after a SYSIN statement are merged accordingly. v If the sequence number of a SYSIN2 statement matches the sequence number of a SYSIN statement in its control group, the SYSIN2 overrides the SYSIN. v If the program reaches the end of SYSIN before it reaches the end of SYSIN2, it processes the records of SYSIN2 as if they were an extension of SYSIN. v Replacement or merging occurs only during the current run. The original SYSIN data is not changed. v During merge, if one of the control statements contains blanks in columns 73 through 80, DFSDDLT0 discards the statement containing blanks, sends a message to PRINTDD, and continues the merge until end-of-file is reached.
PRINTDD DD Statement
The PRINTDD DD statement defines output data set for DFSDDLT0, including displays of control blocks using the SNAP call. It must conform to the MVS/ESA SNAP data set requirements.
PUNCHDD DD Statement
The DD statement for the output data set is labeled PUNCHDD. The data sets are fixed block with LRECL=80. Block size as specified on the DD statement is used; if not specified, the block size is set to 80. If the program is unable to open PUNCHDD, DFSDDLT0 issues abend 251. Here is an example of the PUNCHDD DD statement.
//PUNCHDD DD SYSOUT=B
342
JCL Requirements
is processed. For this reason, sequence numbers are required for all such GU calls that are used. On a restart, if the checkpoint field contains a sequence number, the DFSDDLT0 stream starts at the next GU call to an I/O PCB following the sequence number in the checkpoint field; otherwise the DFSDDLT0 stream starts from the beginning. The DFSDDLSI module and the default IMS.PROCLIB member, DFSINTDL, are shipped with IMS and are installed as part of normal IMS installation. The following code shows examples of SYSIN/SYSIN2 and PREINIT.
//TSTPGM JOB CARD //DDLTTST EXEC DFSMPR,PREINIT=DL //MPP.SYSIN DD * |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< S11 1 1 1 1 TP 1 01000000 OPTIONS SNAP= ,ABORT=9999 01000010 U********************************************************************** 01000040 S11 1 1 1 1 TP 1 01000050 L GU 01000060 E OK 01000070 S11 1 1 1 1 DBPCBXXX 01000080 L GU 01000090 E DATA A INIT-LOAD UOW 01000100 E 01 ROOTSEG1 0008A 0004D 01000110 S11 1 1 1 1 TP 1 01000120 L ISRT 01000130 L Z0080 DATA -SYNC INTERVAL 1 SEG 1 -MESSAGE 1 X01000140 L P DATA 11111111111111111111111111111111111111111111111 01000150 L ISRT 01000160 L Z0080 DATA -SYNC INTERVAL 1 SEG 2 -END EOM 1 X01000170 L P DATA 11111111111111111111111111111111111111111111111 01000180 U********************************************************************** 01000190 U* ENDING FIRST SYNC INTERVAL 01000200 U********************************************************************** 01000210 L GU 01000220 E QC 01000230 L GU 01000240 E OK 01000250 S11 1 1 1 1 DBPCBXXX 01000260 WTO GETTING DATA BASE SEGMENT 1 FROM DBPCBXXX 01000270 L U GHU 01000280 E DATA INIT-LOAD UOW. 1 A.P. 1 01000290 E OK 01000300 L U0003 GN 01000310 E OK 01000320 S11 1 1 1 1 TP 1 01000330 L ISRT 01000340 L Z0080 DATA -SYNC INTERVAL 2 SEG 1 -MESSAGE 1 X01000350 L P DATA 22222222222222222222222222222222222222222222211 01000360 L ISRT 01000370 L Z0080 DATA -SYNC INTERVAL 2 SEG 2 -END EOM 1 X01000380 L P DATA 22222222222222222222222222222222222222222222211 01000390 U********************************************************************** 01000400 U* ENDING SECOND SYNC INTERVAL 01000410 U********************************************************************** 01000420 L GU 01000430 E QC 01000440 L GU 01000450 E OK 01000460 S11 1 1 1 1 DBPCBXXX 01000470 S11 1 1 1 1 TP 1 01000480 L ISRT 01000490 L Z0080 DATA -SYNC INTERVAL 3 SEG 1 -MESSAGE 1 X01000500 L P DATA 33333333333333333333333333333333333333333333311 01000510 L ISRT 01000520
Appendix B. The DL/I Test Program (DFSDDLT0)
343
JCL Requirements
L Z0080 DATA -SYNC INTERVAL 3 SEG 2 -END EOM 1 X01000530 L P DATA 33333333333333333333333333333333333333333333311 01000580 U********************************************************************** 01000590 U* ENDING THIRD SYNC INTERVAL 01000600 U********************************************************************** 01000610 L GU 01000620 E QC 01000630 //MPP.SYSIN2 DD * |---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----< ABEND 01000430 /*
Notes for the SYSIN/SYSIN2 and PREINIT examples shown above: 1. The PREINIT= parameter coded in the EXEC statement invokes the restart process. 2. When DFSDDLT0 starts processing, it substitutes the SYSIN2 ABEND statement for the statement in SYSIN with the same sequence number. (It is the GU call with sequence number 01000430.) 3. DFSDDLT0 begins with statement 01000000 and processes until it encounters the ABEND statement (statement number 01000430). The GU calls to the I/O PCB have already been tracked in the checkpoint field (statements 01000060, 01000220, and 01000240). 4. When DFSDDLT0 is rescheduled, it examines the checkpoint field and finds 01000240. DFSDDLT0 begins processing at the next GU call to the I/O PCB, statement 01000450. If the statement currently numbered 01000240 did not have a sequence number, DFSDDLT0 would restart from statement 01000000 when it was rescheduled.
344
To Load a Database
Use DFSDDLT0 for loading only very small databases because you must to provide all the calls and data rather than have them generated. The following example shows CALL FUNCTION and CALL DATA statements that are used to load a database.
|---+----1----+----2----+----3----+----4----+----5----+----6----+----7---+-----< O SNAP= ,ABORT=0 S 1 2 2 1 1 L ISRT COURSE L DATA FRENCH L ISRT COURSE L DATA COBOL L ISRT CLASS L DATA 12 L ISRT CLASS L DATA 27 L ISRT STUDENT L DATA SMITH THERESE L ISRT STUDENT L DATA GRABOWSKY MARION
345
Both of the above examples request the GN to be repeated 9999 times. Note that the first example uses a COMPARE PCB of EH8 while the second uses a COMPARE PCB of EH. The difference between these two examples is that the first halts the job step the first time the status code is not blank, GA, GC, or GK. The second example halts repeating the GN and goes on to process any remaining DFSDDLT0 control statements when a GB status code is returned or the GN has been repeated 9999 times.
To Delete a Segment
Use the following sequence of control statements to delete a segment.
|----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8---S 1 1 1 1 1 4 L GHU COURSE (TYPE =FRENCH) X CLASS *L X INSTRUC (NUMBER =444) L DLET
To Do Regression Testing
DFSDDLT0 is ideal for doing regression testing. By using a known database, DFSDDLT0 can issue calls and then compare the results of the call to expected results using COMPARE statements. The program then can determine if DL/I calls are executed correctly. If you code all the print options as 2s (print only if comparisons done and unequal), only the calls not properly satisfied are displayed.
346
347
348
Thread Concepts
A DRA thread is a DRA structure that connects: v A CCTL task (which makes database calls to IMS DB) with an IMS DB task that can process those calls. A CCTL thread is a CCTL task that issues IMS DB requests using the DRA. v An OS/390 application program task (which makes database calls to IMS DB) with an IMS DB task that can process those calls. An ODBA thread is an OS/390 task that issues IMS DB calls using the DRA. A single DRA thread is associated with every CCTL or ODBA thread. CCTL or ODBA threads cannot establish a connection with more than one DRA thread at a time.
Processing Threads
The way that the DRA processes a CCTL thread is different from how it processes an ODBA thread.
349
Thread Concepts
the PSB. If the scheduling is successful, the DRA thread is considered complete because it now connects a CCTL thread to a IMS DB task using a specific DRA thread TCB. Subsequent DRA requests from this CCTL thread must use the same CCTL thread token in order to ensure that the request goes to the correct DRA thread. When the application program finishes and the CCTL thread no longer needs the services of the DRA thread, the CCTL issues a TERMTHRD (Terminate Thread) request to remove the CCTL thread token from the DRA thread TCB and terminates the DRA thread. The thread TCB can then become part of a new DRA thread.
350
Thread Concepts
Table 58. Example of Events in a Multithreading System CCTL TCB Events Application program1 needs a PSB, so CCTL thread1 is created. CCTL thread1 events: v DFSRTNA builds the SCHED PAPL and calls DFSPRRC0. v DFSPRRC0 creates a DRA thread, and the thread token (PAPLTTOK) is assigned to DRA thread TCB1. v DFSPRRC0 activates thread TCB1. v DFSPRRC0 calls the Suspend exit routine. v The Suspend exit routine suspends CCTL thread1. v The DRA processes the SCHED request and asks IMS DB to perform a schedule process. v Scheduling is in progress. CCTL can now dispatch other CCTL threads for the CCTL TCB. Application program2 needs a PSB, so CCTL thread2 is created. CCTL thread2 events: v DFSRTNA builds the SCHED PAPL and calls DFSPRRC0. v DFSPRRC0 creates a DRA thread, and a new thread token (PAPLTTOK) is assigned to DRA thread TCB2. v DFSPRRC0 activates thread TCB2. v DFSPRRC0 calls the Suspend exit routine. The Suspend exit routine suspends CCTL thread2. DRA thread TCB2 events: DRA thread TCB1 events: DRA TCB Events
v The DRA processes the SCHED request and asks IMS DB to perform a schedule process. v Scheduling is in progress. Both threads are now suspended. The CCTL TCB is inactive until one of the threads resumes execution. TCB2 scheduling finishes first. DRA thread TCB2 events: v Scheduling completes in IMS DB, and the PAPL is filled in with the results. v The DRA calls the Resume exit routine and passes the PAPL back to the CCTL. Thread2 can resume immediately because the CCTL TCB is idle. It resumes execution directly after the point at which it was suspended by the Suspend exit routine. v The Resume exit routine sees the thread token (PAPLTTOK) and flags CCTL thread2 as ready to resume. v The Resume exit routine returns to the DRA, and TCB2 becomes inactive. TCB1 scheduling completes.
351
Thread Concepts
Table 58. Example of Events in a Multithreading System (continued) CCTL TCB Events DRA TCB Events DRA thread TCB1 events: v Scheduling completes in IMS DB and the PAPL is filled in with the results. v The DRA calls the Resume exit routine and passes the PAPL back to the CCTL. Thread1 must wait until the Resume exit v The Resume exit routine sees the thread routine is available because thread2 has just token (PAPLTTOK) and flags CCTL resumed. thread1 as ready to resume. v The Resume exit routine returns control to the DRA and TCB1 becomes inactive. CCTL thread2 events: v The Suspend exit routine returns to its caller, DFSPRRC0. v DFSPRRC0 returns to DFSRTNA. v DFSRTNA gets the results from the SCHED PAPL and gives them to the application program2. v DFSRTNA finishes the thread2 SCHED request. After thread2 completes in CCTL TCB, the CCTL can dispatch thread1, which is currently waiting. CCTL thread1 events: v The Suspend exit routine returns to its caller, DFSPRRC0. v DFSPRRC0 returns to DFSRTNA. v DFSRTNA gets the results from the SCHED PAPL and gives them to the application program1. v DFSRTNA finishes the thread1 SCHED request.
Sync Points
Sync-point processing finalizes changes to resources. Sync point requests specify actions to take place for the resource changed (for example, commit or abort). A sync point is when IMS DB actually processes the request. Each sync point is based on a unit of recovery (UOR). A UOR covers the time during which database resources are allocated and can be updated until a request is received to commit or abort any changes. Normally, the UOR starts with a CCTL SCHED (schedule a PSB) request or an ODBA APSB call and ends with a sync-point request. Other DRA thread requests can also define the start and end of a UOR. A CCTL UOR is identified by a recovery token (PAPLRTOK) that is received as part of a thread request that creates a new UOR. It is 16 bytes in length. The first 8 bytes contain the CCTL identification. This identification is the same as the CCTL ID
352
Sync Points
that was a final DRA startup parameter determined from USERID or PAPLUSID in INIT request. The second 8 bytes must be a unique identifier specified by the CCTL for each UOR. Related Reading: See the request descriptions under CCTL-Initiated DRA Function Requests on page 360 for more information on the DRA thread requests. IMS DB expects the CCTL or the ODBA application to make the sync-point decision and the resulting request. In the case of a CCTL, the CCTL is the sync-point manager and coordinates the sync-point process with all of the database resource managers (including those other than IMS DB) that are associated with a UOR. In the case of an ODBA application, RRS/MVS is the sync-point manager and coordinates all the resource managers (including those other than IMS) that are associated with the UOR. A CCTL working with a single resource manager may request a sync-point in a single request or can use the two-phase sync-point protocol which is required for a CCTL working with multiple resource managers. The single-phase sync-point request can be issued when the CCTL has decided to commit the UOR, and when IMS DB owns all of the resources modified by the UOR. An ODBA application must use the two-phase sync-point protocol for committing changes to the IMS database.
A UOR has two states: in-flight and in-doubt. The UOR is in an in-flight state from its creation time until the time IMS DB logs the phase 1 end (point C in figures Table 59 on page 354 and Table 60 on page 354). The UOR is in an in-doubt state from (point C) until IMS DB logs phase 2 (point D inTable 59 on page 354 and point H in Table 60 on page 354). The in-doubt state for a single-phase sync-point request is a momentary state between points C and D in Table 59 on page 354. The in-flight and in-doubt states are important because they define what happens to the UOR in the event of a thread failure. If a thread fails while its IMS DB UOR is in-flight, the UOR database changes are backed out. If a thread fails when its IMS DB UOR is in-doubt, during single-phase commit, the UOR database changes are kept for an individual thread abend, but are not kept for a system abend. If a thread fails when its IMS DB UOR is in-doubt, during two-phase commit, the database changes are kept. Thread failure refers to either of these cases: v Individual thread abends. v System abends: IMS DB failure, CCTL failure, ODBA application failure, or MVS failure (which abends all threads).
353
Sync Points
The following figure shows the system events that occur when CCTL is used for single-phase sync-point processing.
Time ABCDE Table 59. CCTL Single-Phase Sync-Point Processing Points In Time A B C D E System Events CCTL phase 1 send IMS DB phase 1 receive IMS DB log phase 1 end IMS DB log phase 2 CCTL phase 2 receive
Table 60 below shows the system events that occur when CCTL is used for two-phase sync-point processing.
Time ABCDEFGHJK Table 60. CCTL Two-Phase Sync-Point Processing Points In Time A B C D E F G H J K System Events CCTL phase 1 send IMS DB phase 1 receive IMS DB log phase 1 end IMS DB phase 1 respond CCTL phase 1 receive CCTL phase 2 send IMS DB phase 2 receive IMS DB log phase 2 IMS DB phase 2 respond CCTL phase 2 receive
The following figure shows the system events that occur when two-phase sync-point processing is done using ODBA.
354
Sync Points
Notes: 1. The ODBA application and IMS DB make a connection via the ODBA interface. 2. IMS expresses protected interest in the work started by the ODBA application. This informs RRS/MVS that IMS will participate in the two-phase commit process. 3. 4. 5. 6. The ODBA application makes a read request to an IMS resource. The ODBA application updates a protected resource. Control is returned to the ODBA application following its update request. The ODBA application requests that the update be made permanent by issuing the SRRCMIT call. 7. RRS/MVS calls IMS to do the prepare (phase 1) process. 8. IMS returns to RRS/MVS with its vote to commit. 9. RRS/MVS calls IMS to do the commit (phase 2) process. 10. IMS informs RRS/MVS that it has completed phase 2. 11. Control is returned to the ODBA application following its commit request.
355
Sync Points
2. If identification is successful, the DRA notifies the CCTL control exit, passing to it a list of IMS DB UORs that are in-doubt. 3. The CCTL must resolve each in-doubt by making a RESYNC call, which causes a phase 2 action, commit or abort. For CCTL to resolve a IMS DB in-doubt UOR, the CCTL must have a record of this UOR and the appropriate phase 2 action it must take. In this example, the CCTL record of a possible IMS DB in-doubt UOR is called a transition UOR. 4. The CCTL must define a transition UOR for the interval A-K (refer to Table 60 on page 354). Because this interval encompasses the IMS DB in-doubt period C-H, CCTL can resolve any in-doubts. If a CCTL defines a transition UOR as interval E-K, the following problem can arise: If IMS DB fails while a thread is between C and D, IMS DB has an in-doubt UOR for which CCTL has no corresponding transition UOR, even though the phase 1 call failed. CCTL cannot resolve this UOR during the identify process. The only way to resolve this in-doubt is by using the IMS DB command, CHANGE INDOUBT. ODBA Example: For ODBA, all in-doubts are resolved through OS/390 using the Recoverable Resource Service (RRS).
CNBA=
DBCTLID=
356
FPBOF=
FPBUF=
FUNCLV= IDRETRY=
TIMER=
USERID=
Figure 88. Copying the DRA Startup/Router Routine into a CCTL Load Library
The system programmer can copy the routine from the IMS.SDFSRESL library (built by the IMS generation process), or can concatenate the IMS.SDFSRESL library to the ODBA step library.
357
Related Reading: For an example of DFSPZP00, see IMS Version 8: Installation Volume 2: System Definition and Tailoring. DFSPZP00 contains default values for the DRA initialization parameters. If you want to specify values other than the defaults, write your own module (naming it DFSPZPxx), assemble it, and load it in the CCTL load library. Use the supplied module, DFSPZP00, as an example. The remainder of the DRA modules reside in a load library that is dynamically allocated by DFSPRRC0. The DDNAME and DSNAME of this load library are specified in the startup table. The default DSNAME (IMS.SDFSRESL) contains all the DRA code and is specified in the default startup table, DFSPZP00.
358
The remainder of the DRA modules reside in a load library that is dynamically allocated by DFSAERA0. The DDNAME and DSNAME of this load library are specified in the startup table. The default DSNAME (IMS.SDFSRESL) contains all the DRA code.
359
The DRA Startup/Router routine puts itself into 31-bit addressing mode and will return to the calling routine in the callers original addressing mode with all its registers restored. Register 15 is always returned with a zero in it. The return code for the request is in the PAPLRETC field of the PAPL.
360
INIT Request
The INIT request initializes the DRA. The DRA startup parameter table contains all of the required parameters that you need to define the DRA. You can use the parameters given in the default module, DFSPZP00, or you can write your own module and link-edit it into the IMS.SDFSRESL. Related Reading: For more information, see Enabling the DRA for a CCTL on page 357. The INIT PAPL also contains some parameters needed to initialize the DRA. If the same parameter appears in both the INIT PAPL and in the DRA startup parameter table, the specification in the INIT PAPL will override that in the startup table. In addition to the required parameters, you can also include the following optional parameters in the INIT PAPL: Field PAPLFUNC PAPLSUSP PAPLRESM PAPLCNTL PAPLTSTX Contents PAPLINIT The address of the Suspend exit routine The address of the Resume exit routine The address of the Control exit routine The address of the Status exit routine
After the INIT request and the startup table have been processed, the DRA returns the following data to the CCTL in the INIT PAPL: Field PAPLDBCT PAPLCTOK PAPLTIMO PAPLRETC PAPLDLEV Contents The IMS DB identifier (this is the IMSID parameter from system generation) The request token that identifies the CCTL to the DRA DRA TERM request timeout value (in seconds) A code returned to the CCTL specifying the status of the request A flag indicating to CCTL which functions the DRA supports. (For the latest version of PAPL mapping format see the IMS. library; member name is DFSPAPL.)
361
RESYNC Request
The RESYNC request tells IMS DB what to do with in-doubt UORs. The following 4 subfunction values indicate possible actions: PAPLRCOM PAPLRABT PAPLSCLD PAPLSUNK Commit the in-doubt UOR. Abort the in-doubt UOR. Changes made to any recoverable resource are backed out. The UOR was lost to the transaction manager due to a coldstart. The in-doubt UOR is unknown to the CCTL. This can occur when the CCTLs in-doubt period does not include the start of phase 1. (See Table 60 on page 354 for an illustration of in-doubt periods.)
You must fill in the following input fields of the PAPL: Field PAPLCTOK Contents Request token
362
TERM Request
The TERM request results in a termination of the IMS DB/CCTL connection and a removal of the DRA from the CCTL environment. The DRA terminates after all threads have been resolved. No new DRA or thread requests are allowed, and current requests in progress must complete. You must fill in the following input fields in the PAPL: Field PAPLFUNC PAPLCTOK Contents PAPLTERM, DRA terminate function code The DRA request token (output from an INIT request)
After receiving the TERM request results, the CCTL may remove DFSPPRC0. The following output fields are returned in the PAPL to the CCTL: Field PAPLRETC PAPLMXNB PAPLMTNB PAPLHITH PAPLTIMX Contents The return code The number of times the maximum thread count was encountered during this DRA session The number of times the minimum thread count was encountered during this DRA session The largest number of thread TCBs that were scheduled during this DRA session The elapsed time at maximum thread for this DRA session
SCHED Request
The SCHED request schedules a PSB in IMS DB. The first SCHED request made by a CCTL thread requires a new DRA thread. If any existing DRA thread TCBs are not currently processing a DRA thread, one of these is used. If no TCBs are available, the DRA either creates a new thread TCB (until the maximum number of threads as specified by the MAXTHRD parameter in the INIT request is reached), or makes the SCHED request wait until a thread becomes available.
363
PAPLFTRD
364
CCTLs currently using the IMS Database Manager and migrating to DBCTL will experience a change in the PCBLIST and user PCB area on a schedule request. The first PCB pointer in the PCBLIST contains the address of an I/O PCB. The I/O PCB is internally allocated during the schedule process in a DBCTL environment. The I/O PCB is normally used for output messages or to request control type functions to be processed. The PCBLIST and the PCBs reside in a contiguous storage area known as UPSTOR. If the PSB was generated with LANG=PLI, the PCBLIST points to pointers for the PCBs. If LANG= was not PLI, the PCBLIST points to the PCBs directly.
IMS Request
This request makes an IMS or Fast Path database request against the currently scheduled PSB. You must fill in the following input fields in the PAPL: Field PAPLFUNC PAPLSFNC PAPLCTOK PAPLCTK2 PAPLTTOK PAPLRTOK Contents PAPLTFUN PAPLDLI, DL1 request subfunction code DRA request token (output from an INIT request) Thread Token number 2. This is the DRA request token that is part of the output from a SCHED request. Thread token set up by the CCTL RTOKEN
365
SYNTERM Request
This is a single-phase sync-point request to commit the UOR. It also releases the PSB. You must fill in the following input fields in the PAPL: Field PAPLFUNC PAPLSFNC PAPLCTOK PAPLCTK2 PAPLTTOK PAPLRTOK Contents PAPLTFUN PAPLSTRM, sync-point commit/terminate subfunction code DRA request token (output from INIT request) The thread request token number 2. This DRA token is the output from the SCHED request. The thread token set up by the CCTL A 16-byte UOR token (RTOKEN). For information on UORs see Sync Points on page 352.
You can also specify the following, optional input fields: Field PAPLSTAT Contents Address of an area where transaction statistical data is returned to the CCTL.
The following output fields are returned in the PAPL to the CCTL: Field PAPLRETC Contents Code returned
366
PREP Request
This is a phase 1 sync-point request that asks IMS DB if it is ready to commit this UOR. You must fill in the following input fields of the PAPL: Field PAPLFUNC PAPLSFNC PAPLCTOK PAPLCTK2 PAPLTTOK PAPLRTOK Contents PAPLTFUN PAPLPREP, sync-point prepare subfunction code DRA request token (output from an INIT request) Thread Token number 2. This is the DRA request token which is output from a SCHED request. The thread token set up by the CCTL A 16-byte UOR token (RTOKEN). See Sync Points on page 352 for more information about UORs.
The following output fields are returned in the PAPL to the CCTL: Field PAPLRETC PAPLSTCD Contents Code returned Fast Path status code If the value in the PAPLRETC field is decimal 35, the PAPLSTCD field contains a status code that further describes the error.
COMTERM Request
This is a phase 2 sync-point request to commit the UOR. It also releases the PSB. You must issue a PREP request prior to issuing a COMTERM request. You must fill in the following input fields in the PAPL: Field PAPLFUNC PAPLSFNC PAPLCTOK PAPLCTK2 PAPLTTOK PAPLRTOK Contents PAPLTFUN PAPLCTRM, sync-point commit/terminate subfunction code DRA request token (output from an INIT request) Thread Token number 2. This is the DRA request token, which is output from a SCHED request. The thread token set up by the CCTL A 16-byte UOR token (RTOKEN). See Sync Points on page 352 for more information about UORs.
Specifying the following input field is optional: Field PAPLSTAT Contents Address of an area where transaction statistical data is returned to the CCTL
Appendix C. The Database Resource Adapter (DRA)
367
ABTTERM Request
This is a phase 2 sync-point request for abort processing. It also releases the PSB. It does not require a preceding PREP request. You must fill in the following input fields of the PAPL: Field PAPLFUNC PAPLSFNC PAPLCTOK PAPLCTK2 PAPLTTOK PAPLRTOK Contents PAPLTFUN PAPLATRM, sync-point abort/terminate subfunction code DRA request token (output from an INIT request) Thread Token number 2. This is the DRA request token, which is output from a SCHED request. The thread token set up by the CCTL A 16-byte UOR token (RTOKEN). See Sync Points on page 352 for more information about UORs.
Specifying the following input field is optional: Field PAPLSTAT Contents Address of an area where transaction statistical data is returned to the CCTL.
The following output fields are returned in the PAPL to the CCTL: Field PAPLRETC PAPLSTAT Contents Code returned The address of the transaction statistical data area. This address must be specified on the input field.
368
The following output fields are returned in the PAPL to the CCTL: Field PAPLRETC PAPLSTAT Contents Code returned The address of the transaction statistical data area. This address must be specified on the input field.
369
370
371
Table 62. Information Provided at UOR Termination: PAPL Field PAPLGU1 PAPLGN PAPLGNP PAPLGHU PAPLGHN PAPLGHNP PAPLISRT PAPLDLET PAPLREPL PAPLTOTC PAPLTENQ PAPLWTEQ PAPLTSDQ PAPLUENQ PAPLWUEQ PAPLUPDQ PAPLEXEQ PAPLWEXQ PAPLEXDQ PAPLDATS PAPLDATN PAPLDECL PAPLDERD PAPLMSCL PAPLOVFN PAPLUOWC PAPLBFWT PAPLUSSN Field Length (Hexadecimal) 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8 8 2 2 2 2 2 2 4 Contents Number of database GU calls issued Number of database GN calls issued Number of database GNP calls issued Number of database GHU calls issued Number of database GHN calls issued Number of database GHNP calls issued Number of database ISRT calls issued Number of database DLET calls issued Number of database REPL calls issued Total number of DL/I database calls Number of test enqueues Number of WAITS on test enqueues Number of test dequeues Number of update enqueues Number of WAITs on updates and enqueues Number of update dequeues Number of exclusive enqueues Number of WAITs on exclusive enqueues Number of exclusive dequeues STCK time schedule started STCK time schedule completed Number of DEDB calls Number of DEDB read operations Reserved for Fast Path Number of overflow buffers used Number of UOW contentions Number of WAITs for DEDB buffers Unique schedule sequence number
372
DRA Statistics
DRA statistics are contained in the returned PAPL as a result of a DRA TERM request, or in the Control exit routines PAPL when it is called for DRA termination. This routine is called when the DRA fails or when a previous Control exit routine invocation resulted in return code 4. The statistics in the returned PAPL are: 1. The number of times the MAXTHRD value was reached. 2. The number of times the MINTHRD value was reached (only includes the times the value is reached when the thread TCB number is decreasing.) 3. The largest number of thread TCBs ever reached during this DRA session. (This is the number of TCBs, not the number of DRA threads, so it is at least the minimum thread value.) 4. The time (in seconds) during which the DRA thread TCB count was at the MAXTHRD value. You can find the field names for the previous statistics in the PAPL extensions for the TERM PAPL and control exit routine PAPL. Before attempting to evaluate the statistics DRA performance, remember: v If the DRA is using the maximum number of threads (MAXTHRD), when the DRA receives any new SCHED requests it will make these requests wait until a thread is available. v As active threads become available (for example, as a result of TERMTHRD call), some of the available threads might be collapsed. The above facts can adversely affect performance, but both improve IMS DB resource availability because fewer DRA threads require fewer IMS DB resources. The IMS DB resources (PSTs) are then available for other BMPs or other CCTLs to use. Statistics 1, 2, and 4 can serve as measures of the two facts mentioned above, and will help you decide how to balance performance and resource usage. For the sake of the discussion here, these statistics are presented solely from a performance point of view (for example, assume only 1 CCTL connected to a IMS DB).
373
Tracing
There is no tracing (logging) of activity in the DRA, but there is tracing in IMS DB of DL/I and Fast Path activity. The setup and invocation of DL/I tracing for IMS DB is the same as for IMS. The output trace records for CCTL threads contain the recovery token. Fast Path tracing in IMS DB is different from IMS. Fast Path tracing in IMS DB is activated when a SCHED request to the DRA has the PAPLFTRD equal to ON (Fast Path trace desired for this UOR). When this UOR completes, a trace output file is closed and sent to SYSOUT Class A. If a thread request fails during Fast Path processing, the DRA might return the PAPL with the PAPLFTRR field equal to ON. This recommends to the CCTL that it request the PAPLFTRD field be equal to ON (Fast Path trace desired) in the SCHED PAPL if this failing transaction is run again by the CCTL.
Problem Determination
Failed DRA requests have a nonzero value in the PAPLRETC field of the PAPL returned to the CCTL. The format of PAPLRETC is:
HHSSSUUU
X'88'- No output SSS UUU All MVS non-retryable abend codes (for example, 222, 13E) or, IMS abend codes (775, 777, 844, 849, 2478, 2479, 3303)
X'84'- SNAP only UUU IMS abend codes (260, 261, 263)
374
Diagnostic information is provided by the DRA in the form of an SDUMP, or a SNAP dataset output. For X'80', the SDUMP is attempted first. If it fails, SNAP is done. For X'84', no SDUMP is attempted, but a SNAP is attempted. An MVS or IMS abend code failure results in DRA thread termination and thread TCB collapse. A IMS DB return code has no affect on the DRA itself or the thread TCB. DRA thread TCB failures that occur when not processing a thread request result in a SDUMP/SNAP process. DRA control TCB failures that occur when not processing a DRA request result in a SDUMP/SNAP process and the Control exit routine is called. For a SCHED type of thread request, a failure with X'80' or X'84' can result in either SNAP or SDUMP.
SDUMP
SDUMP output contains: v The IMS control region. v DLISAS address space. v Key 0 and key 7 CSA. v Selected parts of DRA private storage, including the ASCB, TCB, and RBs. You can format the IMS control blocks by using the Offline Dump Formatter (ODF). Related Reading: The ODF is described in IMS Version 8: Diagnosis Guide and Reference. The ODF will not format DRA storage. You can use IPCS to format the MVS blocks in the CCTLs private storage. DRA SDUMPS have their own SDUMP options. As a result of this, any CHNGDUMP specifications cannot cause sections of DRA SDUMPs to be omitted. If these specifications arent in the DRAs list of options, they can have an additive effect on DRA SDUMPS.
SNAPs
The SNAP dump datasets are dynamically allocated whenever a SNAP dump is needed. A parameter in the DRA Startup Table defines the SYSOUT class. The SNAP output contains: v Selected parts of DRA private storage, including the ASCB, TCB, and RBs. v IMS DBs control blocks.
375
376
Bibliography
This bibliography includes all the publications cited in this book, including the publications in the IMS library. v CICS/ESA Application Programming Guide, SC33-1169 v CICS/ESA Application Programming Reference, SC33-1170 v CICS/ESA CICS-IMS Database Control Guide, SC33-1184 v CICS/MVS Installation Guide, SC33-0506 v CICS/ESA System Definition Guide, SC33-1164 v IBM Language Environment Installation and Customization on MVS, SC26-4817 v IBM Language Environment for MVS & VM Programming Guide, SC26-4818 v MVS/ESA: JCL Reference MVS/ESA System Product: JES2 Version 5 , GC28-1479 v MVS/ESA System Programming Library: Application Development Guide, GC28-1852 v System Application Architecture Common Programming Interface: Resource Recovery Reference, SC31-6821 v IBM TSO Extensions for MVS/REXX Reference, SC28-1883
SC27-1292 CQS IMS Version 8: Common Queue Server Guide and Reference IMS Version 8: Common Service Layer Guide and Reference IMS Version 8: Customization Guide IMS Version 8: DBRC Guide and Reference IMS Version 8: Diagnosis Guide and Reference IMS Version 8: Failure Analysis Structure Tables (FAST) for Dump Analysis IMS Version 8: IMS Java Users Guide IMS Version 8: Installation Volume 1: Installation Verification IMS Version 8: Installation Volume 2: System Definition and Tailoring IMS Version 8: Master Index and Glossary IMS Version 8: Messages and Codes, Volume 1 IMS Version 8: Messages and Codes, Volume 2 IMS Version 8: Open Transaction Manager Access Guide IMS Version 8: Operations Guide IMS Version 8: Release Planning Guide IMS Version 8: Utilities Reference: Database and Transaction Manager IMS Version 8: Utilities Reference: System
SC27-1293
CSL
SC27-1296 GC27-1297
IJUG IIV
GC27-1298
ISDT
OG RPG URDBTM
SC27-1309
URS
SC27-1287 SC27-1288
APDG APCICS
Supplementary Publications GC27-1299 SC27-1307 LPS SOC IMS Version 8: Licensed Program Specifications IMS Version 8 Summary of Operator Commands
SC27-1289
APTM
SC27-1290
BPE
SC27-1291
CR
377
Publication Collections Hardcopy Licensed Bill of Forms (LBOF): and CD IMS Version 8 Hardcopy and Softcopy Library SBOF-7781 Hardcopy Unlicensed Bill of Forms (SBOF): IMS Version 8 Unlicensed Hardcopy Library SK2T-6700 CD OS/390 Collection SK3T-4270 CD z/OS Software Products Collection LBOF-7780
Accessibility Titles Cited in this Book SA22-7787 SA22-7794 SC34-4822 z/OS TSO Primer TSO/E Users Guide ISPF Users Guide, Volume 1
378
263
Numerics
12-byte time stamp, field in I/O PCB 8-blanks (null) 148 88
A
abend statement 303 accessing GSAM databases 211 AD/Cycle C/370 111 addressability to UIB, establishing 97 addressing environments 254, 259 addressing mode (AMODE) 114 AIB (application interface block) address return 108 AIB identifier (AIBID) 92 in APSB call 144 in CHKP (basic) call 145 in CHKP (symbolic) call 146 in DPSB call 147 in GMSG call 148 in GSCD call 150 in ICMD call 151 in INIT call 153 AIB Identifier (AIBID) in INQY call 158 AIB0LEN (maximum output area length) in ICMD call 151 AIBERRXT (reason code) 93 AIBFUNC (subfunction code) in DPSB call 147 in GMSG call 148 AIBLEN in GSCD call 150 in INIT call 153 AIBLEN (DFSAIB allocated length) in APSB call 144 in CHKP (basic) call 145 in CHKP (symbolic) call 146 in DPSB call 147 in GMSG call 148 in ICMD call 151 in INQY 158 AIBOALEN (maximum output area length) in CHKP (symbolic) call 146 in GMSG call 149
Copyright IBM Corp. 1974, 2002
93
379
AND (continued) independent 205 logical 191 AO (automated operator) application GMSG call 148 ICMD call 151 RCMD call 166 AOI token usage 149 APPC environment 254 application program DB Batch environment, in 12 DBCTL environment, in 10 DBD, using 18 deadlock occurrence, in 157 environments 9 HALDB environment scheduling 112 interface 9 PSB, using 18 sample hierarchies 19 applications, sample 43 APSB (Allocate PSB) call 144 format 144 parameters 144 usage 144 area in CHKP (symbolic) call 146 area length in CHKP (symbolic) call 146 assembler language DL/I call format, example 74 DL/I call-level sample 50 DL/I program structure 48 entry statement 106 parameters, DL/I call format 73 program entry 106 register 1, program entry 106 return statement 106 SSA definition examples 101 syntax diagram, DL/I call format 72 UIB, specifying 97
batch regions and GSAM 219 Boolean operators dependent AND 204 independent AND 205 logical AND 191 logical OR 191 SSA, coding 101
C
C language 106 __pcblist 106 batch program, coding 52 DL/I call formats, example 77 DL/I program structure 52 entry statement 106 exit 106 I/O area 77 parameters, DL/I call format 75 PCBs, passing 106 return statement 106 SSA definition examples 102 syntax diagram, DL/I call format 74 system function 107 C/C++ for MVS/ESA 111 call functions, DL/I 313 CALL statement CALL DATA 307 CALL FUNCTION 304 call-level programs, CICS online 13 calls, DB CIMS 115 CLSE 117 DEQ 117 DLET 119 FLD 120 GN 122 GNP 127 GU 129 ISRT 132 OPEN 135 POS 136 REPL 140 CCTL (coordinator controller) design recommendation 370 in DBCTL environment 10 performance considerations thread monitoring 371 CEETDLI 111 address return 108 program entry statement 71, 108 checkpoint call See CHKP call CHKP (basic checkpoint) call description 144 format 145 parameters 145 usage 145 CHKP (checkpoint) call, necessary information CHKP (symbolic checkpoint) call description 145
B
Basic Checkpoint (CHKP Basic) 144 format 145 parameters 145 usage 145 batch environments DB TM 9 batch programs assembler language 48 C language 52 COBOL 54 deadlock occurrence, in 157 overview 12 Pascal 62 PL/I 65 structure 12
47
380
CHKP (symbolic checkpoint) call (continued) format 145 parameters 146 usage 147 with GSAM 216 CHKP call function 310 CHNG call function 310 CICS DL/I call program, compiling 47 CICS online programs 165 assembler language, sample 50 COBOL, establishing addressability 62 COBOL, optimization feature 62 COBOL, sample 57 PCB call 165 PL/I, sample 67 structure 13 TERM call 177 CIMS call description 115 format 115 parameters 116 usage 116 class, record segment 35 closing a GSAM database explicitly 117, 214 CLSE (Close) call description 117 format 117 parameters 117 usage 117 CMD call function 310 COBOL CICS online, establishing addressability 62 CICS online, optimization feature 62 DL/I call formats, example 79 DL/I call-level, sample 57 DL/I program structure 54 entry statement 106 parameters, DL/I call format 78 return statement 106 SSA definition examples 102 syntax diagram, DL/I call format 77 UIB, specifying 97 COBOL for MVS & VM and Language Environment 111 COBOL/370 and Language Environment 111 codes, status checking 17 logical relationships 209 command codes 24, 29 C description 28 SSAs 24 D examples 26, 29 Get calls 30 ISRT call 30 P processing option 29 DEDBs 27 description 26 DL/I calls 28
command codes (continued) F Get calls 31 HERE insert rule 134 ISRT call 31 restrictions 239 L FIRST insert rule 33, 134 Get calls 32 M 39 N 33 Null 38 overview 26 P 33 Q 34, 248 qualified SSAs 27 R 40 reference 293 restrictions 100 S 41 subset pointers 27, 232, 234 summary 26 unqualified SSAs 27 V 37 Z 43 Command codes U 36 COMMENT statement conditional (T) 325 unconditional (U) 325 commit point processing DEDB 237 MSDB 227 COMPARE statement COMPARE AIB 328 COMPARE DATA 326 COMPARE PCB 328 introduction 326 concatenated key and PCB mask 91, 213 concatenated segments, logical relationships connector 122 CTL (PUNCH) statement 334 current position determining 181 multiple positioning 195 qualification 36 unsuccessful calls 186
208
D
data areas, coding 46 data availability, status codes 90 data entry database (DEDB) See DEDB (data entry database) data locking 228 data mapping, define with MAXDEF command data redundancy, reducing 206 data structures 47 database calls Fast Path 239
264
Index
381
database (continued) summary 289 DB PCB, name 90, 213 deallocating resources 147 position after XRST 179 determining 181 establishing using GU 131 multiple positioning 195 unsuccessful calls 186 recovery with ROLL call 244 recovery, back out changes 243 sample hierarchy 19 database management calls 16 database resource adapter 349 DB batch, program considerations 12 DB PCB database name 90, 213 entry statement, pointer 212 fields 89, 90 in GSCD 150 key feedback area 213 key feedback area length field 91, 213 mask 89, 90 fields 213 fields, GSAM 212 name 212 relation 89 multiple DB PCBs 200 number of sensitive segments field 91 processing options field 91, 213 relation to DB PCB 89 secondary indexing, contents 206 segment level number field 90 segment name field 91 sensitive segments 91 status code field 90, 213 status codes NA 154 NU 154 DB PCB mask, GSAM reference 105 DB/DC environment overview 10 DBB batch region 219 DBD (database description), description 18 DBDCTL environment CCTL 10 overview 10 using DRA 10 using ODBA 11 DBQUERY using with INIT call 154 deadlock occurrence application programs 157 batch programs, in 157 debugging, IMSRXTRC 264 DEDB (data entry database) call restrictions 238 command codes 38 DL/I calls 238 PCBs and DL/I calls 85
DEDB (data entry database) (continued) processing commit point 237 fast path 221 H option 237 overview 223 P option 237 POS call 234 subset pointers 230 root segments, order 126 updating with subset pointers 230 define a data mapping with MAXDEF command delete call See DLET Call dependent AND 204 dependents, direct 223 DEQ (Dequeue) call and Q command code 35, 118 description 117 format Fast Path 118 full function 117 parameters Fast Path 118 full function 118 restrictions 119 summary 289 usage 118 DEQ call function 310 DFSDDLT0 (DL/I Test Program) See DL/I Test Program (DFSDDLT0) DFSDDLT0 internal control statements AB0C1 statement (INTERNAL CALL STATEMENT) 301 WTSR statement (INTERNAL CALL STATEMENT) 301 DFSPRP macro keywords 356 DFSPSP00 (DRA startup table) 356 DFSREXXU (Example User Exit Routine) sample 299 DFSSAM01 (Loads the Database) 280 DL/I call formats, example assembler language 74 C language 77 COBOL 79 Pascal 82 PL/I 84 DL/I call functions 310, 313 special DFSDDLT0 END 323 SKIP 323 STAK 323 START 323 supported CHKP 310 CHNG 310 CMD 310 DEQ 310 DLET 311 FLD 311
264
382
DL/I call functions (continued) supported (continued) GCMD 311 GHN 311 GHNP 311 GHU 311 GMSG 311 GN 311 GNP 311 GU 311 ICMD 311 INIT 311 INQY 311 ISRT 311 LOG 311 POS 311 PURG 312 RCMD 312 REPL 312 ROLB 312 ROLL 312 ROLS 312 ROLX 312 SETO 312 SETS 312 SNAP 312 STAT 313 SYNC 313 XRST 313 DL/I calls (general information) qualifying your calls 23 command codes 26 concatenated key 28 field 24 segment type 24 relationships to PCBs FF PCBs 85 REXXTDLI 258 SSAs 23 types 24 DL/I calls, database management CIMS 115 CLSE 117 DEQ 117 DLET 119, 120 FLD 120, 122 general description 16 GHNP call 129 GHU call 131 GN 122, 127 GNHP call 126 GNP 127, 129 GU 129, 132 ISRT 132, 135 OPEN 135 POS 136, 139 REPL 140, 141 summary 16, 289 DL/I calls, general information coding 46 getting started with 12
DL/I calls, general information (continued) using 16 DL/I calls, system service 143, 144 APSB 144 CHKP 144, 145, 147 DPSB 147 GMSG 148 GSCD 150, 151 INIT 153, 157 INQY 157 LOG 163, 164 PCB 165 ROLB 167, 168, 244 ROLL 168, 243 ROLS 168, 170 SETS/SETU 170, 171 SNAP 171, 174 STAT 174, 176, 177 summary 16, 290 SYNC 176 XRST 177 DL/I language interfaces overview 71 supported interfaces 71 DL/I options logical relationships 206 secondary indexing 203 DL/I program structure 12 DL/I return codes (REXX) 259 DL/I Test Program (DFSDDLT0) control statements 301, 340 execution in IMS regions 344, 345 explanation of return codes 345 hints on usage 345, 347 JCL requirements 340, 344 overview 301 restarting input stream 342 DL/I, CICS online getting started with 13 DL/I, ODBA interface getting started with 15 DLET (Delete) call description 119 format 119 parameters 117, 119, 136 SSAs 120 usage 120 with MSDB, DEDB or VSO DEDB 223 DLET call function 311 DLI batch region and GSAM 219 DLIINFO . (period) usage 263 REXX extended command 262, 263 DLITCBL 107 DLITPLI 108 DOCMD exec 281 DPSB call description 147 format 147 parameters 147 usage 147
Index
383
DRA (database resource adapter) 349 CCTL function requests 360 INIT 361 RESYNC 362 TERM 363 CCTL recovery process 370 communicating with DBCTL 10 DRA statistics 373 enabling CCTL 357 ODBA 358 initializing CCTL 358 ODBA 359 macro keywords 356 multithreading 350 PAPL 369 problem determination 374 processing CCTL requests 359 ODBA calls 360 startup table 356 DFSPZPxx 356 sync-point processing 352 in-doubt state 355 protocol 353 termination 369 thread ODBA 350 processing 349 structure 349 thread function requests 363 ABTTERM 368 COMTERM 367 IMS 365 PREP 367 SCHED 363 SYNTERM 366 TERMTHRD 368 thread statistics 371 tracing 374
E
E (COMPARE) statement 326 enabling data availability status codes 90 END call function 323 entry and return conventions 106 environment (REXX) address 254, 259 determining 262 extended 259 equal-to relational operator 24 error routines 18 I/O errors 18 programming errors 18 system errors 18 types of errors 18 ESAF (External Subsystem Attach Facility)
examples Boolean operators 192 D command code 26, 30 DFSDDLT0 statements COMMENT 325 DATA/PCB COMPARE 330 DD 342 DL/I call functions 313 IGNORE 332 OPTION 334 PUNCH 336 STATUS 339 SYSIN, SYSIN2, and PREINIT 343 WTO 340 WTOR 340 FLD/CHANGE 227 FLD/VERIFY 227 L command code 32 medical database 19 multiple qualification statements 192 N command code 33 Null command code 38 P command code 34 path call 26 SSAs, secondary indexing 204 U Command Code 36 UIB, defining 97 V command code 37 exceptional conditions 17 EXECIO example 280 managing resources 254 explicitly opening and closing a GSAM database extended commands See REXXIMS commands extended environment See environment (REXX) extended functions See IMSQUERY extended function Extended Restart (XRST) 147 description 177 parameters 177 position in database 179 restarting your program 179 restrictions 180 starting your program normally 179 usage 178 External Subsystem Attach facility (ESAF) 10
214
F
F command code restrictions 239 Fast Path database calls 221 databases, processing 221 DEDB (data entry database) 221 FSA 121 MSDB (main storage database) 221 processing MSDBs and VSO DEDBs 223 subset pointers, using with DEDBs 230
10
384
Fast Path (continued) types of databases 221 field changing contents 226 checking contents: FLD/VERIFY 224 Field (FLD) call See FLD (Field) call field name FSA 121, 225 SSA, qualification statement 24 field search argument description 224 reference 121 field value FSA 225 SSA, qualification statement 24, 25 fields in a DB PCB mask 90, 213 file I/O See EXECIO FIRST insert rule, L command code 33 fixed-length records 215 FLD (Field) call description 120, 223 FLD/CHANGE 226 FLD/VERIFY 224 format 120 FSAs 121 parameters 120 summary 289 usage 121 FLD call function 311 free space, identifying 236 FSA (field search argument) connector 122 description 224 Field name 121 FSA status code 121 Op code 122 operand 122 reference 121 with DL/I calls 224 FSA status code 121 full-function database PCBs and DL/I calls 85 segment release 35
G
GCMD call function 311 Get calls D command code 30 F command code 31 function 311 L command code 32 Null command code 38 P command code 33 Q command code 34 U Command Code 36 V command code 37 Get Message (GMSG) call See GMSG call 148
GHU (Get Hold Unique) description 131 GMSG call description 148, 150 format 148 parameters 148 restrictions 150 use 149 GN (Get Next) call description 122 format 122 hold form (GHN) 126 parameters 123 SSAs 125 usages 124 GNP (Get Next in Parent) call description 127 effect in parentage 128 format 127 hold form (GHNP) 129 parameters 127 SSAs 129 usages 128 linking with previous DL/I calls 128 processing with parentage 128 GPSB (generated program specification block), format 109 greater-than relational operator 24 greater-than-or-equal-to relational operator 24 group name, field in I/O PCB 88 GSAM (generalized sequential access method) accessing databases 211 call summary 216 CHKP 216 coding considerations 216 data areas 104 data set attributes, specifying 219 characteristics, origin 217 concatenated 219 DD statement DISP parameter 218 extended checkpoint restart 218 database, explicitly opening and closing 214 DB PCB mask, fields 212 DB PCB masks 105 description 211 designing a program 211 DLI or DBB region types 219 fixed-length records 214 I/O areas 215 PCBs and DL/I calls 85 record formats 214 records, retrieving and inserting 213 restrictions on CHKP and XRST 216 RSA 105, 213 status codes 215 undefined-length records 214 variable-length records 214 XRST 216 GSCD (Get System Contents Directory) call description 150
Index
385
GSCD (Get System Contents Directory) call (continued) format 150 parameters 150 usage 151 GU (Get Unique) call 129 description 129 format 130 hold form (GHU) 131 parameters 130 restrictions 132 SSAs 131 usage 131
H
H processing option 237 HALDB (High Availability Large Database) HALDB application programs, scheduling against 112 HALDB partitions data availability 18 error settings 18 handling 18 initial load of 113 restrictions for loading logical child segments 18 scheduling 18 status codes 18 HDAM database, order of root segments 126 HERE insert rule F command code 31 L command code 33 hierarchic sequence 124 hierarchy data structures 47 sample database 19 High Availability Large Database (HALDB) 18 HOUSHOLD segment 21
I
I/O area C language 77 coding 100 for XRST 179 in CHKP (symbolic) call 146 in GMSG call 149 in GSCD call 151 in INIT call 153 in INQY call 158 I/O area length in CHKP (symbolic) call 146 I/O PCB in GSCD 150 in INIT call 153 PCBs and DL/I calls 85 I/O PCB mask 12-byte time stamp 88 general description 86 group name field 88 input message sequence number logical terminal name field 87
87
I/O PCB mask (continued) message output descriptor name 87 specifying 86 status code field 87 userid field 88 userid indicator field 89 ICMD call commands that can be issued 152 description 151, 153 format 151 parameters 151 restrictions 153 use 152 IGNORE (N or .) statement 332 ILLNESS segment 20 IMSQUERY extended function arguments 272 usage 272 IMSRXTRC command 262, 264 independent AND 205 indexed field in SSAs 204 indexing, secondary effect on program 203 SSAs 203 infinite loop, stopping 258 INIT using with DBQUERY 154 INIT (Initialize) call automatic INIT DBQERY 155 database availability, determining 154 description 153 enabling data availability, status codes 155 enabling deadlock occurrence, status codes 156 format 153 INIT STATUS GROUPA 155 INIT STATUS GROUPB 156 parameters 153 performance 155 performance considerations (IMS online) 155 restrictions 157 status codes 155 usage 153 INIT call function 311 input for a DL/I program 46 input message sequence number, field in I/O PCB 87 INQY (Inquiry) call description 157 format 158 map of INQY subfunction to PCB type 162 parameters 158 querying data availability 159 environment 160 PCB 161 program name 162 restriction 163 return and reason codes 162 usage 158 INQY call querying LERUNOPT, using LERUNOPT subfunction 161
386
INQY call function 311 INQY DBQUERY 159 INQY ENVIRON, data output 160 INQY FIND 161 INQY PROGRAM 162 inserting first occurrence of a segment 31 last occurrence 32 segments 133 inserting a segment as first occurrence 31 as last occurrence 32 GSAM records 213 in sequence 30 path of segments 30 root 134 rules to obey 133 specifying rules 134 interfaces, DL/I 111 See DL/I interfaces ISRT (Insert) call D command code 30 description 132 F command code 31 format 132 L command code 33 loading a database 33 parameters 132 RULES parameter 31 SSAs 134 with MSDB, DEDB or VSO DEDB 223 ISRT call function 311 Issue Command (ICMD) call See ICMD call 151 IVPREXX exec 285 IVPREXX sample application 257
length of key feedback area 213 less-than relational operator 24 less-than-or-equal-to relational operator 24 level number, field in DB PCB 90 limiting number of full-function database calls 34 link-editing, reference 50, 67 locating dependents in DEDBs last-inserted sequential dependent, POS call 235 POS call 235 specific sequential dependent, POS call 234 lock class and Q command code 34 lock management 248 LOG (Log) call description 163 format 163 parameters 163 restrictions 164 usage 164 LOG call function 311 logical AND, Boolean operator 191 logical child 206 logical child segments restrictions for HALDBs 18 logical OR, Boolean operator 191 logical parent 206 logical relationships effect on programming 208 introduction 206 logical child 206 logical parent 206 physical parent 206 processing segments 206 programming, effect 206 status codes 209 logical structure 206 logical terminal name, field in I/O PCB 87
J
JCL (job control language), requirements 340, 344
M
M command code examples 39 subset pointers, moving forward 39 main storage database (MSDB) See MSDB (main storage database) managing subset pointers in DEDBs with command codes 222 MAP definition (MAPDEF) 262, 264 map name See *mapname MAP reading (MAPGET) 262, 266 MAP writing (MAPPUT) 262, 267 mapping MAPDEF 264 MAPGET 266 MAPPUT 267 mask, DB PCB 89 MAXQ and Q command code 34 medical database example 19 message output descriptor name, field in I/O PCB 87 mixed-language programming 113
Index
K
key feedback area DB PCB, length field 91 length field in DB PCB 213 overview 91 keys concatenated 28 non unique 21
L
L (CALL) statement 304 LANG= Option on PSBGEN for PL/I Compatibility with Language Environment 112 Language Environment LANG = option for PL/I compatibility 112 Language Environment for MVS & VM 111 language interfaces, DL/I 111 language interfaces, DL/I. See DL/I interfaces 71
387
modifiable alternate PCBs 241 MSDB (main storage database) call restrictions 229 commit point processing 227 nonrelated 222 PCBs and DL/I calls 85 processing 223 terminal related 222 types description 222 nonrelated 23 related 22 MSDBs (main storage database) processing commit points 227 multiple DB PCBs 200 positioning 195 processing 195 qualification statements 191 MVS environment 254 MYLTERM 229
P
P command code 33 P processing option 29, 237 parameters assembler language, DL/I call format 73 C language, DL/I call format 75 COBOL, DL/I call format 78 Pascal, DL/I call format 81 PL/I, DL/I call format 83 parentage, P command code 33 PART exec 278 PARTNAME exec 279 PARTNUM exec 279 parts of DL/I program 12 Pascal batch program, coding 62 DL/I call formats, example 82 DL/I program structure 62 entry statement 106, 107 parameters, DL/I call format 81 PCBs, passing 107 SSA definition examples 103 syntax diagram, DL/I call format 80 path call D command code 30 definition 26 example 26 overview 26 PATIENT segment 20 PAYMENT segment 21 PCB (program communication block) address list, accessing 96 DL/I calls, relationship 85 DLIINFO call 263 masks DB PCB 89 description 13 GSAM databases 211 I/O PCB 86 modifiable alternate PCBs 241 types 109 PCB (schedule a PSB) call description 165 format 165 parameters 165 usage 165 PCBINFO exec 276 period usage See usage physical parent 206 PL/I batch program, coding 65 DL/I call formats, example 84 DL/I call-level sample 67 DL/I program, multitasking restriction 65 entry statement 106 parameters, DL/I call format 83 PCBs, passing 108 pointers in entry statement 108 return statement 106 SSA definition examples 104
N
N command code 33 NA 154 name field, segment 24 nonrelated (non-terminal-related) MSDB not-equal-to relational operator 24 not-found status code description 186 position after 186 NU 154 Null command code 38 222
O
O (OPTION) Statement 333 op code 122 OPEN (Open) call description 135 format 135 usage 136 operand FSA 122 operation parameter, SNAP external call 172 operator FSA 225 SSA 24 operators Boolean 191 relational 191 OPTION statement 333 options, processing; field in DB PCB 91, 213 OR, logical 191 OS/VS COBOL and Language Environment 111 overriding FIRST insert rule 33 HERE insert rule 31, 33 insert rules 134
388
PL/I (continued) syntax diagram, DL/I call format 82 UIB, specifying 97 PL/I for MVS & VM and Language Environment PLI/370 and Language Environment 111 PLITDLI 247 POS (Position) call description 136, 234 examples 139 format 136 I/O area 137 parameters 137 usage 139 POS call function 311 POS(positioning)=MULT(multiple) 195 position establishing in database 131 positioning after unsuccessful calls 186 CHKP, effect 241 determining 181 multiple 195 PREINIT parameter, input restart 340 processing database, several views 200 DEDBs 230 Fast Path databases 221 GSAM databases 211 MSDBs and VSO DEBDs 223 multiple 195 options field in DB PCB 91, 213 H (position), for Fast Path 237 P (path) 29 P (position), for Fast Path 237 segments in logical relationships 206 program batch structure 12 design 46 program communication block See PCB (program communication block) program deadlock 156 programming guidelines 45 mixed language 113 secondary indexing 203 PSB (program specification block) description 18 format 109 PUNCH statement 334 PURG call function 312
111
qualification statement coding 100 field name 24 field value 24, 25 multiple qualification statements 191 overview 24 relational operator 24 segment name 24 structure 24 qualified call definition 24 overview 19, 23 qualified SSA qualification statement 24 structure 24 structure with command code 27 qualifying DL/I calls with command codes 26 SSAs 24
R
R command code 40 RACF signon security 88 RACROUTE SAF 88 randomizing routine exit routine 126, 193 RCMD call description 166, 167 format 166 parameters 166 restrictions 167 use 166 reading segments in MSDBs 224, 229 record search argument See RSA (record search argument) regions, batch DBB 219 DLI 219 related (terminal related) MSDB 222 relational operators Boolean operators 191 independent AND 191 list 24 logical AND 191 logical OR 191 overview 24 SSA, coding 100 SSA, qualification statement 24 REPL (Replace) call description 140 format 140 N command code 33 parameters 140 SSAs 141 usage 141 with MSDB, DEDB or VSO DEDB 223 REPL call function 312 requesting a segment using GU 131
Q
Q command code 248 and the DEQ call 35 example 35 full function and segment release lock class 34 MAXQ 34 35
Index
389
reserving place for command codes 239 segment command code 248 lock management 248 resetting a subpointer 41 residency mode (RMODE) 114 Restart, Extended parameters 177 position in database 179 restarting your program 179 restrictions 180 starting your program normally 179 usage 178 Restart, Extended (XRST) 147 description 177 restarting your program XRST call 179 restarting your program, basic checkpoints 241 restrictions CHKP and XRST with GSAM 216 database calls to DEDBs 238 to MSDBs 229 F command code 31 number of database calls and Fast Path 34 retrieval calls D command code 30 F command code 31 L command code 32 status codes, exceptional 17 Retrieve Command (RCMD) call See RCMD call 166 retrieving dependents sequentially 127 first occurrence of a segment 31 last occurrence 32 segments Q command code, Fast Path 34 Q command code, full function 34 sequentially 29 segments with D 30 return codes UIB 96, 295 REXX . (period) usage 261 calls return codes 259 summary 259 syntax 259 commands DL/I calls 258 summary 258 DL/I calls, example 261 execs DFSSAM01 280 DOCMD 281 IVPREXX 285 PART 278 PARTNAME 279 PARTNUM 279
REXX (continued) execs (continued) PCBINFO 276 SAY 275 IMSRXTRC, trace output 264 REXX, IMS adapter . (period) usage 263 address environment 254 AIB, specifying 260 description 253 DFSREXX0 program 253, 257 DFSREXX1 253 DFSREXXU user exit 253 DFSRRC00 257 diagram 256 DL/I parameters 260 environment 262 example execs 275 feedback processing 260 I/O area 260 installation 253 IVPREXX exec 257 IVPREXX PSB 254 IVPREXX setup 254 LLZZ processing 260 LNKED requirements 253 non-TSO/E 253 PCB, specifying 260 programs 253 PSB requirements 253 sample generation 254 sample JCL 254 SPA processing 260 SRRBACK 253 SRRCMIT 253 SSA, specifying 260 SYSEXEC DD 253, 254 system environment 253, 254 SYSTSIN DD 254 SYSTSPRT DD 253, 254 TSO environment 253 TSO/E restrictions 253 ZZ processing 260 REXXIMS commands 264, 266 See also IMSQUERY extended function DLIINFO 262, 263 IMSRXTRC 262, 264 MAPDEF 262 MAPGET 262 MAPPUT 262, 267 SET 262, 268 SRRBACK 262, 269 SRRCMIT 262, 269 STORAGE 262, 270 WTL 262, 271 WTO 262, 271 WTOR 262, 271 WTP 262, 271 REXXTDLI commands 258 RMODE 114
390
ROLB (Roll Back) call compared to ROLL call 242 description 167, 244 format 167 maintaining database integrity parameters 167 usage 244 ROLB call function 312 ROLL (Roll) call compared to ROLB call 242 description 168, 243 format 168 maintaining database integrity ROLL call function 312 ROLS (Roll Back to SETS) call description 168 format 168 maintaining database integrity parameters 169 TOKEN 245 ROLS call function 312 ROLX call function 312 routines, error 18 RSA (record search argument) description 213 GSAM, reference 105 overview 213 RULES parameter FIRST, L command code 33 HERE F command code 31 L command code 33
242
242
242
S
S (STATUS) statement 336 S command code examples 41 subpointer, resetting 41 sample JCL 340 sample programs call-level assembler language, CICS online call-level COBOL, CICS online 57 call-level PL/I, CICS online 67 SAY exec 275 scheduling HALDBs 18 application programs, against 112 secondary indexing DB PCB contents 206 effect on programming 203 information returned by DL/I 206 SSAs 203 status codes 206 secondary processing sequence 204 segment requesting using GU 131 segment level number field 90 segment name DB PCB, field 91 SSA, qualification statement 24
50
segment search argument See SSA (segment search argument) segment, information needed 47 sensitive segments in DB PCB 91 sequence hierarchy 124 sequence field virtual logical child, in 25 sequence, indication for statements 340 sequential dependent segments how stored 223 sequential dependents 223 overview 223 SET command (REXX) 262, 268, 269 SET SUBFUNC command (REXX) 269 SET ZZ 269 SETO call function 312 SETO, DFSDDLT0 description 304 SETS (Set a Backout Point) call description 170, 246 format 170 parameters 170 SETS call function 312 setting parentage with the P command code 33 subset pointer to zero 43 SETU (Set a Backout Point Unconditional) call description 170, 246 format 170 parameters 170 signon security, RACF 88 single positioning 195 skeleton programs assembler language 48 C language 52 COBOL 54 Pascal 62 PL/I 65 SKIP call function 323 SNAP call description 171 format 171 parameters 171 status codes 174 SNAP call function 312 specifying command codes for DEDBs 232 DB PCB mask 89 GSAM data set attributes 219 processing options for DEDBs 237 Spool API STORAGE command example 271 SRRBACK command (REXX) description 262 format, usage 269 SRRCMIT command (REXX) description 262 format, usage 269
Index
391
SSA (segment search argument) coding formats 101 restrictions 101 rules 100 command codes 26 definition 23 overview 23 qualification statement 100 qualified 24 reference 100 relational operators 24 restrictions 100 segment name field 24, 100 structure with command code 27 unqualified 24 usage 120 command codes 27 DLET 120 GN 125 GNP 129 GU 131 guidelines 25 ISRT 134 multiple qualification statements REPL 141 secondary indexing 203 virtual logical child, in 25 SSAs (segment search arguments) unqualified 24 STAK call function 323 START call function 323 STAT (Statistics) call description 174 format 174 parameters 174 usage 175 STAT call function 313 status codes blank 17 checking 17 DB PCB, for 154 error routines 18 exception conditions 17 field in DB PCB 90, 213 FSA 225 H processing option 237 HALDB partitions 18 logical relationships 209 P processing option 237 retrieval calls 17 subset pointers 234 status codes, field in I/O PCB 87 STATUS statement 336 storage !token 270 STORAGE command 270 STORAGE command (REXX) description 262 format, usage 270
191
subset pointer command codes restrictions 27 subset pointers DEDB, managed by command codes 27 defining, DBD 232 defining, PCB 232 description 230 M command 39 preparing to use 232 R command code 40 resetting 41 S command code 41 sample application 38, 233 status codes 234 using 230 Z command code 43 summary of command codes 26 Symbolic Checkpoint (CHKP Symbolic) 145 format 145 parameters 146 restrictions 147 usage 147 SYNC (Synchronization Point) call description 176 format 176 parameters 176 usage 176 SYNC call function 313 syntax diagram assembler language, DL/I call format 72 C language, DL/I call format 74 COBOL, DL/I call format 77 Pascal, DL/I call format 80 PL/I, DL/I call format 82 SYSIN input 340 SYSIN2 input processing 340 system service calls See also DL/I calls, system service APSB (Allocate PSB) 144 CHKP (Basic) 144 CHKP (Symbolic) 145 DPSB (deallocate) 147 GMSG (Get Message) 148 ICMD (Issue Command) 151 INIT (Initialize) 153 INQY (Inquiry) 157 LOG (Log) 163 PCB (schedule a PSB) 165 RCMD (Retrieve Command) 166 ROLB (Roll Back) 167 SETS/SETU (Set a Backout Point) 170 SNAP 171 STAT (Statistics) 174 SYNC (Synchronization Point) 176 TERM (Terminate) 177 XRST (Extended Restart) 177
T
T (Comment) statement 325
392
TERM (Terminate) call description 177 format 177 usage 177 test program See DL/I Test Program (DFSDDLT0) testing status codes 17 TREATMNT segment 20 TSO/E REXX See REXX, IMS adapter
W
WAITAOI 148 WTL command (REXX) description 262 format, usage 271 WTO command (REXX) description 262 format, usage 271 WTO statement 339 WTOR command (REXX) description 262 format, usage 271 WTOR statement 340 WTP command (REXX) description 262 format, usage 271
U
U (Comment) statement 325 U Command Code 36 UIB (user interface block) defining, in program 96 field names 98 PCB address list, accessing 96 return codes, accessing 96 return codes, list 295 UIBDLTR introduction 97 return codes, checking 295 UIBFCTR introduction 97 return codes, checking 295 UIBPCBAL introduction 97 return codes, checking 295 undefined-length records 213 unqualified call overview 19 unqualified calls, definition of 24 unqualified SSA segment name field 24 structure with command code 27 usage with command codes 27 UOW boundary, processing DEDB 237 updating segments in an MSDB, DEDB or VSO DEDB user interface block See UIB (user interface block) userid indicator, field in I/O PCB 89 userid, field in I/O PCB 88
X
XRST (Extended Restart) 147 XRST (Extended Restart) call description 177 format 177 parameters 177 restrictions 180 usage 178 with GSAM 216 XRST call function 313
Z
Z command code examples 43 setting a subpointer to zero 43
223
V
V command code 37 variable-length records 213 virtual logical child 25 virtual storage option data entry database (VSO DEDB) See VSO DEDB (virtual storage option data entry database), processing VS COBOL II and Language Environment 111 VSAM, STAT call 175 VSO DEDB (virtual storage option data entry database), processing 223
Index
393
394
Overall satisfaction
How satisfied are you that the information in this book is: Very Satisfied h h h h h h Satisfied h h h h h h Neutral h h h h h h Dissatisfied h h h h h h Very Dissatisfied h h h h h h
Accurate Complete Easy to find Easy to understand Well organized Applicable to your tasks
h Yes
h No
When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any way it believes appropriate without incurring any obligation to you.
Address
___________________________________________________________________________________________________
Fold and _ _ _ _ _ _ _ _ _ _Fold and_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Please _ _ _ _ _ staple _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Tape _ _ _ _ _ _ _ _ Tape _ _ _ _ do not _ _ _ _ NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES
IBM Corporation H150/090 555 Bailey Avenue San Jose, CA U.S.A. 95141-9989
_________________________________________________________________________________________ Fold and Tape Please do not staple Fold and Tape
SC27-1286-00
Printed in U.S.A.
SC27-1286-00
Spine information:
IMS Version 8