《最新IMS Database(共90张PPT课件).pptx》由会员分享,可在线阅读,更多相关《最新IMS Database(共90张PPT课件).pptx(90页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 第一页,共九十页。 What is IMS DB Some General Concepts DBD PSB第二页,共九十页。 IMS Information Management System Hierarchical Structure Each Box in the hierarchy represents a segment第三页,共九十页。B3A2D1B2A1C1ROOT SEGMENT (PARENT)SEGMENT OCCURRNCESTWIN SEGMENTSDEPENDENT SEGMENTS- Level 1- Level 2B1HIERARCHICAL STRUCTUR
2、EFOLLOWS INVERTED TREE STRUCTUREROOT SEGMENT WILL BE ON TOPEACH SEGMENT (EXCEPT ROOT SEGMENT) IS DIRECTLY DEPENDENT ON ONLY ONE SEGMENTContinued .第四页,共九十页。 Segment Smallest unit of data that DL/I can fetch Each segment will have unique 8 characters name- ARINVHDR (Invoice DB root segment) It is like
3、 a file record It has one or more fields like file record第五页,共九十页。 Segment type Category of data for ex In invoice DB ARINVHDR, ARINVDTL, ARINVPMT etc represents the segment type Segment Occurrence One specific segment of a particular segment type. Within a DB there is one of segment type but an unl
4、imited no of occurrences of segment type第六页,共九十页。 15 Levels 255 segment type 1000 fields Unlimited number of occurrences第七页,共九十页。 Root segment The segment at the top of the hierarchy is root segment Database Record One occurrence of root segment along with all subordinate occurrences.第八页,共九十页。 Depen
5、dent segments All segments other than the root segment are dependent segments Parent segment Child Segment 第九页,共九十页。2413576891. WHICH SEGMENTS ARE DEPENDENT ON SEGMENT 4?2. WHICH SEGMENTS ARE CHILD SEGMENTS OF SEGMENT 1?3. WHICH SEGMENTS ARE DEPENDENT SEGMENTS OF SEGMENT 1?4. HOW MANY LEVELS?Continu
6、ed .第十页,共九十页。DATABASE RECORDContinued .第十一页,共九十页。 Sequential Processing Random Processing Position in a DB第十二页,共九十页。 More Into IMS第十三页,共九十页。ApplicationProgramCalls to DL/IDL/IOperating systemAccess Method Database ordata setApplicationProgramStandard COBOL i/O StatementsOperating systemAccess Method
7、 Database ordata set第十四页,共九十页。 DL/I acts as an interface between the application program and the access method No direct COBOL file I/O statements rather CALL statements to invoke DL/I DL/I invokes the access method and not the application program第十五页,共九十页。 DFSRRC00 第十六页,共九十页。 DBD Data Base Descript
8、or PSB Program Specification Block第十七页,共九十页。 It defines the physical structure of the database One DBD for each database第十八页,共九十页。 Parent = 0 for the root segment is optional and can be omitted If two segments have the same parent their sequence in the DBDGEN job determines their sequence in the dat
9、a base hierarchy Ex ARCINVCF DB. Field is defined as a key or search field第十九页,共九十页。DATA BASE DESCRIPTION (DBD)STATEMENTDESCRIPTIONDBDSPECIFIES DATABASE NAME, ACCESS METHODDATASETSPECIFIES DD NAME TO BE USED IN JCL, DISK TYPESEGMSPECIFIES SEGMENT NAME,SEGMENT LENGTH, PARENTFIELDSPECIFIES FIELD NAME,
10、 LENGTH, STARTING POSITIONIDENTIFIES A FIELD AS KEY OR SEARCH FIELDContinued .第二十页,共九十页。PRINTNOGENDBDNAME=COUNTRY,ACCESS=HDAMDATASETDD1=CTRY,DEVICE=3380SEGMNAME=CTRYSEG,PARENT=0,BYTES=10FIELDNAME=(CTRCODE,SEQ,U),BYTES=10,START=1,TYPE=CSEGMNAME=STATSEG,PARENT=CTRYSEG,BYTES=5FIELDNAME=(STATCODE,SEQ,U)
11、,BYTES=5,START=1,TYPE=CSEGMNAME=DISTSEG,PARENT=STATSEG,BYTES=9FIELDNAME=(DISTCODE,SEQ),BYTES=3,START=1,TYPE=CFIELDNAME=POPULTON,BYTES=6,START=4,TYPE=PDBDGENFINISHENDContinued .第二十一页,共九十页。 It defines the application program view of the database Specify the data bases (one or more) the program can acc
12、ess Specify the processing the program can do on the data elements described in the PSB Application program can share PSB第二十二页,共九十页。TYPEDESCRIPTIONCCharacter (Default)COBOL PICTUREXPPacked DecimalCOMP-3ZZoned DecimalS9HHalf Word Binary9(4) COMPFFull Word Binary9(8) COMPContinued .第二十三页,共九十页。ABCDE PC
13、B GIVES LOGICAL VIEW OF A DATABASE PORTION OF DATABASE THAT THE PROGRAM PROCESSES IS CALLED APPLICATION DATA STRUCTUREACEContinued .第二十四页,共九十页。PRINT NOGENPCB TYPE=DB,DBDNAME=COUNTRY,KEYLEN=15,PROCOPT=LSSENSEG NAME=CTRYSEGSENSEG NAME=STATSEG,PARENT=CTRYSEGPSBGENEND KEYLEN IS THE LENGTH OF CONCATENATE
14、D KEYSAMPLE PSBGENContinued .第二十五页,共九十页。PROCOPTDESCRIPTIONGGet or ReadIInsertRReplaceDDeleteAAll Options (G, I, R, D)LInitial LoadLSSequential Initial LoadKAccess only Key of segmentOUsed with G to Indicate that Hold is not allowedPPath Calls PROCOPTS IN PSB DEFINES SECURITY LEVEL FOR THE PROGRAMCon
15、tinued .第二十六页,共九十页。DBD1DBD3DBD2PCB1PCB2PCB3PCB4 APPLICATION PROGRAM CAN HAVE MULTIPLE VIEWS OF A DATABASE BY USING SEPARATE PCBS FOR A SINGLE DATABASEContinued .第二十七页,共九十页。PRINT NOGENPCB TYPE=DB,DBDNAME=COUNTRY,KEYLEN=15SENSEG NAME=CTRYSEG,PROCOPT=GSENSEG NAME=STATSEG,PARENT=CTRYSEG,PROCOPT=RSENSEG
16、NAME=DISTSEG,PARENT=STATSEG,PROCOPT=APSBGENEND1. LIST THE SEGMENTS THAT MAY BE UPDATED USING THIS PSB2. LIST THE SEGMENTS THAT CANNOT BE UPDATED3. GIVE THE VALID PROCOPT TO BE CODED FOR ADDING AND REPLACING RECORDS IN CTRYSEG SEGMENTContinued .第二十八页,共九十页。EMPDATAWORKDATADEPTDATABENDATABASED ON THE AB
17、OVE VIEW OF DATABASE FILL IN THE MISSING PIECES OF PCBPCB TYPE=DB,DBDNAME=EMPDB,KEYLEN=16,PROCOPT=GSENSEG NAME=_,PARENT=_SENSEG NAME=_,PARENT=_SENSEG NAME=_,PARENT=_SENSEG NAME=_,PARENT=_PSBGEN LANG=COBOL,PSBNAME=EMPPSBYENDContinued .第二十九页,共九十页。 Segment Level Sensitivity The program can access the s
18、egments defined in PCB and all fields of that segment. Field Level Sensitivity Within a segment access to specific fields One program has one PSB or multiple programs can have one第三十页,共九十页。 One PCB for each database the application program can access If PROCOPT coded at segment level will overwrite
19、the one at the segment level. Ex ARC0766 第三十一页,共九十页。 ENTRY DLITCBL USING PCB-1 PCB-2 . . PCB-n第三十二页,共九十页。 It Links all the PCBs defined in the PSBGEN to the program Order mentioned must be same as that specified in the PSBGEN The control is transferred to the program The address of each PCB defined
20、in the PSB is supplied第三十三页,共九十页。 GOBACK is used instead of STOP RUN It transfers control back to DL/I which then deallocates the resources and closes all DB and data sets第三十四页,共九十页。 The programs use the call statement rather than direct Access method like Read, write, Rewrite etc. The control is tr
21、ansferred from COBOL to DL/I which in turn does the processing第三十五页,共九十页。 CALL CBLTDLI USING FUNC-CD PCB-MASK I-O AREA SSA第三十六页,共九十页。 It determines the Function to be perform on the DB. ARC includes a copybook YKDBFUNC which contains all the function which can be performed on the DB. Defined as PIC
22、X(4) field.第三十七页,共九十页。01 DB-FUNCTION-CODES. 05 GU PIC X(4) VALUE GU. 05 GHU PIC X(4) VALUE GHU. 05 GN PIC X(4) VALUE GN. 05 GHN PIC X(4) VALUE GHN. 05 GNP PIC X(4) VALUE GNP. 05 GHNP PIC X(4) VALUE GHNP. 05 ISRT PIC X(4) VALUE ISRT. 05 REPL PIC X(4) VALUE REPL. 05 DLET PIC X(4) VALUE DLET. 第三十八页,共九十
23、页。 GU GN GNP GHU GHN GHNP第三十九页,共九十页。 ISRT DLET REPL第四十页,共九十页。 Defined in Linkage section Tells which DB to use for the request made A field is used after every call to know whether the call is successful or not第四十一页,共九十页。 01DB-PCB-1.03 DBD-NAMEPIC X(8).03 SEG-LEVELPIC X(2). 03 STATUS-CODEPIC X(2).03
24、 PROC-OPTIONSPIC X(4).03 IMS-RESERVEDPIC S9(5) COMP. 03 SEG-NAMEPIC X(8).03 KEY-LENPIC S9(5) COMP.03 NUM-SENS-SEGSPIC S9(5) COMP.03 KEY-FEEDBACKPIC X(?). = length depends on segment key THE PCB MASKContinued .第四十二页,共九十页。 There should be at least one PCB for each database used Status code of PCB mask
25、 explains whether a call is successful or not The sequence in which PCB masks are defined in linkage section need not be same as that in PSBGEN macro THE PCB MASKContinued .第四十三页,共九十页。 Defined in the working storage Contains the retrieved data after the call is successful Used to update the segment
26、from the contained data第四十四页,共九十页。 THE SSA IS AN AREA IN WORKING STORAGE USED TO IDENTIFY THE SEGMENT TO WHICH ACCESS IS REQUIRED IT IS AN OPTIONAL DL/I CALL PARAMETER THAT QUALIFIES A CALL BY SPECIFIYING A PARTICULAR SEGMENT TYPE OR OCCURRENCEWHEN SPECIFIED IN A DL/I CALL THE SSA ALWAYS FOLLOWS I/O
27、 PARAMETER THERE MAY BE 1 TO 15 SSAs IN A CALL STATEMENT THE SSAs MUST APPEAR IN HIERARCHICAL ORDER BY SEGMENT TYPE THE SSA CONTAINS INFORMATION TO OBTAIN THE REQUIRED SEGMENT. THE INFORMATION COULD BY SEGMENT NAME OR SEGMENT NAME & SEGMENT KEY OR SEGMENT NAME & SEARCH FIELD第四十五页,共九十页。SEARCHES FOR A
28、 SPECIFIC SEGMENT TYPESEARCHES FOR A SPECIFIC SEGMENT OCCURRENCEMORE EFFICIENT THAN UNQUALIFIED SSAContinued .第四十六页,共九十页。.01 HISTORY-SSA. 05 SEGMENT-NAMEPIC X(8) VALUE CTRYSEG . 05 FILLERPIC X(1) VALUE SPACE.Blank in 9th position CT RYSEGContinued .第四十七页,共九十页。 First 8 bytes contains the name of the
29、SSA 9th byte contains a blank Segment name must be the one defined in DBDGEN If segment name less than eight characters - ?第四十八页,共九十页。.01 SSA-EMPLOYEE. 03SEGMENT-NAMEPIC X(8)VALUE EMPLOYEE 03BEGIN-QUALIFYPIC X(1)VALUE (. 03KEY-NAMEPIC X(8)VALUE EMPKEY . 03OPERATORPIC X(2)VALUE =. 03KEY-VALUEPIC X(12
30、). 03END-QUALIFYPIC X(1)VALUE ).PROCEDURE DIVISION.MOVE 123456789000 TO KEY-VALUE.CALL CBLTDLI USING FUNC-CODE, PCB-MASK-1, IO-AREA, SSA-EMPLOYEE.Continued .第四十九页,共九十页。 First 8 bytes contains the name of the SSA 9th byte contains a ( Position 10 to 17 is an eight character field name. 18 and 19 2 ch
31、aracter relational operator End a field value with the ) parenthesis Segment name must be the one defined in DBDGEN第五十页,共九十页。 Used to specify a specific segment occurrence based on the field passed Field can be key field or the search field Field must be defined in the DBDGEN The key value varies第五十
32、一页,共九十页。OPERATORS USED IN QUALIFIED SSAOPERATORSYMBOLSEqual toEQ, = , =Not Equal toNE, =, =Less thanLT, , Less than or Equal toLE, =, = , Greater than or Equal toGE, =, =SEGMENT SEARCH ARGUMENTContinued .第五十二页,共九十页。COMMAND CODES INCREASE THE FUNCTIONALITY OF IMS CALLS COMMAND CODES ARE DESIGNATED BY
33、 AN ASTERISK * FOLLOWED BY CHARACTERS第五十三页,共九十页。 ONE OR MORE COMMAND CODES CAN BE USED IN SSA EACH COMMAND CODE IS REPRESENTED BY A SINGLE CHARACTER FOLLOWING AN ASTERISK AFTER SEGMENT NAMEHISTORY*- DL/I CONSIDERS ALL CHARACTERS FOLLOWING * TO BE COMMAND CODES TILL IT ENCOUNTERS A BLANK OR ( RESULTS
34、 IN MINIMIZING THE NUMBER OF CALLS AND HENCE IMPROVE PROGRAM EFFICIENCY第五十四页,共九十页。 * at the 9th byte of SSA Command code at 10th byte Space or left parenthesis to know a unqualified SSA or a qualified SSA第五十五页,共九十页。COMMAND CODEDESCRIPTIONDRETRIEVE A PATHFFIRST OCCURRENCE OF SEGMENT TYPELLAST OCCURRE
35、NCE OF SEGMENT TYPEUMAINTAIN CURRENT POSITION AT THIS LEVELVMAINTAIN CURRENT POSITION AT THIS AND HIGHER LEVELSNDO NOT REPLACE THIS SEGMENTCUSE A CONCATENATED KEYPESTABLISH PARENTAGE AT THIS LEVEL-NULL/IGNOREContinued .第五十六页,共九十页。 NULL COMMAND CODE PRESENT IN ALL SSAS IN ARC ANY SPECIFIC COMMAND COD
36、E CAN BE USED AND MODIFY THIS FIELD TO FUNCTION ACCORDINGLYContinued .第五十七页,共九十页。 REQUESTS DL/I TO USE PATH CALLS ALLOWS ENTIRE PATH IN SEGMENT HIERARCHY TO BE RETRIEVED IN ONE SINGLE CALL FOR PROGRAMS USING PATH CALLS PROCOPT IN PSB SHOULD HAVE “P” AS ONE OF THE VALUES DL/I DOES NOT RETRIEVE SEGMEN
37、TS IF THE CORRESPONDING SSA DOES NOT HAVE PATH COMMAND CODE “D”Continued .第五十八页,共九十页。 SEGMENT IN THE LAST SSA WILL ALWAYS BE RETRIEVED EVEN IF SSA DOES NOT HAVE COMMAND CODE “D” FOR ISRT CALLS SSAS FOR LOWER LEVEL SEGMENTS NEED NOT HAVE “D” COMMAND CODE, “D” COMMAND CODE IS PROPAGATED TO ALL SPECIFI
38、ED SEGMENTS AUTOMATICALLY I/O AREA USED SHOULD BE BIG ENOUGH TO ACCOMMODATE ALL SEGMENTS IN PATHContinued .第五十九页,共九十页。CALL CBLTDLI USING GN , LS-PCB-MASK, WS-SEG-IO-AREA,SEGMENTA*D(AKEY=1)SEGMENTB*D(BKEY=2)SEGMENTD*-(DKEY=5)AFTER THE CALLSEGMENTS #1, #2 & #5 WILL BE RETURNED IN I/O AREA1651171042839
39、AKEYBKEYEKEYCKEYDKEYFKEYContinued .第六十页,共九十页。 CALL PROCESSES FIRST OCCURRENCE OF THE SEGMENT TYPEEXAMPLE:SEGMENT 2 CAN BE RETRIEVED AFTER SEGMENT 4 BY USINGCALL CBLTDLI USING GNP LS-PCB-MASK, WS-SEG-IO-AREA, SEGMENTB*F4312SEGMENTASEGMENTBSEGMENTCContinued .第六十一页,共九十页。 CALL PROCESSES LAST OCCURRENCE
40、OF THE SEGMENT TYPEEXAMPLE:SEGMENT 4 CAN BE RETRIEVED AFTER SEGMENT 2 BY USINGCALL CBLTDLI USING GNP LS-PCB-MASK, WS-SEG-IO-AREA, SEGMENTC*L4312SEGMENTASEGMENTBSEGMENTCContinued .第六十二页,共九十页。 USED IN REPL CALLS FOLLOWING PATH CALLS IF ANY SEGMENT RETRIEVED DURING PATH CALL NEED NOT BE REPLACED COMMAN
41、D CODE “N” IS USED IN SSA OF THAT SEGMENTContinued .第六十三页,共九十页。第六十四页,共九十页。 Qualified Call Call with SSA Unqualified Call Call without SSA第六十五页,共九十页。ONE OF THE FOLLOWING FUNCTIONS WILL BE USED IN A RETRIEVAL DL/I CALL GU- GET UNIQUE GN- GET NEXT GNP- GET NEXT WITHIN PARENTWHEN A RETRIEVAL IS DONE WIT
42、H AN INTENT TO UPDATE OR DELETE RECORDS, THE ABOVE FUNCTION CODES WILL BE PREFIXED WITH HOLD GHU- GET HOLD UNIQUE GHN- GET HOLD NEXT GHNP- GET HOLD NEXT WITHIN PARENT第六十六页,共九十页。 Random processing of records Independent of the position established by previous calls Can be used with Qualified or unqua
43、lified SSA Returns 1st occurrence with unqualified Returns 1st occurrence with non-unique key第六十七页,共九十页。CALL CBLTDLI USING GU , PCB-MASK,SEGMENT-IO-AREASEGMENTA*-(AKEY=1)SEGMENTB*-(BKEY=2)SEGMENTD*-(DKEY=6)AFTER THE CALLSEGMENTD WITH DKEY=6 WILL BE IN SEGMENT-IO-AREA1651171042839AKEYBKEYEKEYCKEYDKEY
44、FKEY: WRITE A GU TO RETRIEVE FKEY=10第六十八页,共九十页。WHAT WILL BE THE OUTPUT OF A GU CALL WITH NO SSA?第六十九页,共九十页。 Space if call is successful GE Segment not found If GE not handled - ?第七十页,共九十页。 TOP TO BOTTOM FRONT TO BACK LEFT TO RIGHT1651171042839AKEYBKEYEKEYCKEYDKEYFKEYGKGAContinued .第七十一页,共九十页。 Sequen
45、tial processing of DB Used mostly when no of segments are to read or process Can use unqualified or Qualified SSA第七十二页,共九十页。CALL CBLTDLI USING GN , PCB-MASK,SEG-IO-AREA,SEGMENTA*-(AKEY=1)SEGMENTE*-(EKEY=8)AFTER THE CALLSEGMENTE WITH EKEY=8 WILL BE IN PROGRAM I/O AREA1651171042839AKEYBKEYEKEYCKEYDKEY
46、FKEY: WHAT WILL BE THE RESULTS OF FOUR CONSEQUETIVE GNs AFTER EKEY=8 IS RETRIEVED第七十三页,共九十页。CALL CBLTDLI USING GN , LS-PCB-MASK, SEGMENT-IO-AREA,SEGMENTA*-(AKEY=1)SEGMENTB*-(BKEY=2)CALL CBLTDLI USING GNP , LS-PCB-MASK, SEGMENT-IO-AREAAFTER THE CALLSEGMENTC WITH CKEY=3 WILL BE IN SEGMENT-IO-AREA16511
47、71042839AKEYBKEYEKEYCKEYDKEYFKEY第七十四页,共九十页。WHAT WILL BE THE OUTPUT IF GNP IS DONE 4 MORE TIMES IN PREVIOUS EXAMPLE?Continued .第七十五页,共九十页。 Spaces if the call is successful GE Segment not found GB End of database (with GN only) GA Unqualified GN or GNP call. Never for qualified call GK - Unqualified G
48、N or GNP call. Never for qualified call. Same level GP Without establishing parentage if GNP issued第七十六页,共九十页。CALLCBLTDLI USING GN , LS-PCB-MASK, WS-SEG-IO-AREA,SEGMENTA*D(AKEY=1)SEGMENTE*D(EKEY=8)SEGMENTF*-(FKEY=10)WHAT WILL BE THE RESULT AFTER SUCCESSFUL COMPLETION OF THE ABOVE CALL?1651171042839B
49、KEYEKEYCKEYDKEYFKEYContinued .第七十七页,共九十页。 FUNCTIONS IDENTICAL TO GU/GN/GNP INDICATES THE REQUESTED SEGMENT(S) MAY BE DELETED OR REPLACED FORCING IMS TO PUT A LOCK ON THESE SEGMENTS WHICH WILL BE RELEASED ONLY AFTER ANOTHER CALL BY SAME PCB THIS ENSURES DATA INTEGRITYContinued .第七十八页,共九十页。 MUST HAVE
50、BEEN OBTAINED WITH A GET HOLD CALL (GHU, GHN, GHNP) NO INTERVENING CALLS BETWEEN GET HOLD CALL AND REPLACE/DELETE CALLS MULTIPLE REPLACE ALLOWED AFTER GET HOLDContinued .第七十九页,共九十页。CALL CBLTDLI USING GHU , LS-PCB-MASK, WS-SEGMENT-IO-AREASEGMENTA*-(AKEY=1)SEGMENTB*-(BKEY=2)CALL CBLTDLI USING DLET, LS