create a GLOBAL subschema from a SCHEMA

Document created by ChrisHoelscher on Nov 2, 2015
Version 1Show Document
  • View in full screen mode

ever need a "global" subschema for DBAN or other purposes ? it can be time-consuming and error prone - here is the source from a weekly job we run to guarantee a current global subschema for each application schema:

 

DATABASE DICTNAME=SYSDIRL  DBNAME=APPLDICT           

IN 1600 F DB(D) SS=IDMSNWKA,IDMSNTWK                 

PATH01 OOAK-012 S-010                                

PATH02 OOAK-012 S-010 SA-018                         

PATH03 OOAK-012 S-010 SRCD-113 RCDSYN-079            

PATH04 OOAK-012 S-010 SOR-046                        

KEY OOAK-KEY-012 'OOAK'                              

REC TEMP-NAME    1501 008                            

REC DBA-OVERLAY  1501 003                            

010 HOLD-SCHEMA 'XXXXXXXXXX'                         

010 X-AREA.999 '******************'                  

010 X-RECORD.999 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'  

010 X-SET.999 '******************'                   

010 AREA-COUNT 0                                     

010 RECORD-COUNT 0                                   

010 SET-COUNT 0                                      

010 SUB1 0                                           

01OUT 080 PS DD=OFA                                  

01SORT NOSORT                                        

01510001 'DEL SUBSCHEMA NAME IS '                    

01510023 TEMP-NAME                SZ=008             

01510031 ' OF SCHEMA '                               

01510042 HOLD-SCHEMA              SZ=008             

01510050 ' VERSION IS 1.'                            

01520001 'ADD SUBSCHEMA NAME IS '                    

01520023 TEMP-NAME                SZ=008             

01520031 ' OF SCHEMA '                               

01520042 HOLD-SCHEMA              SZ=008             

01520050 ' VERSION IS 1'                             

01530001 'USAGE IS DML.'                             

01540001 'ADD AREA NAME IS '                         

01540018 X-AREA.SUB1    SZ=018                       

01540036 '.'                                         

01550001 'ADD RECORD NAME IS '                       

01550020 X-RECORD.SUB1    SZ=032                     

01550052 '.'                                         

01560001 'ADD SET NAME IS '                          

01560017 X-SET.SUB1    SZ=016 

01560033 '.'                                             

01570001 'GENERATE. COMMIT.'                             

017    IF EOF EQ 100                                     

017    IF S-NAME-010 EQ 'NON IDMS' DROP                  

017    IF PATH-ID EQ '01' 100                            

017    IF PATH-ID EQ '02' 200                            

017    IF PATH-ID EQ '03' 300                            

017    IF PATH-ID EQ '04' 400                            

017    DROP                                              

017100 IF HOLD-SCHEMA EQ 'XXXXXXXX' 150                  

017    IF AREA-COUNT EQ 0 150                            

017    IF RECORD-COUNT EQ 0 150                          

017    CALL US43(HOLD-SCHEMA TEMP-NAME 8)                

017    CALL US43 ('DBA' DBA-OVERLAY 3)                   

017    RELS (1,2,3)                                      

017110 MOVE 0 TO SUB1                                    

017111 SUB1 + 1 SUB1                                     

017    IF SUB1 GT AREA-COUNT 120                         

017    RELS 4                                            

017    B 111                                             

017120 MOVE 0 TO SUB1                                    

017121 SUB1 + 1 SUB1                                     

017    IF SUB1 GT RECORD-COUNT 130                       

017    RELS 5                                            

017    B 121                                             

017130 MOVE 0 TO SUB1                                    

017131 SUB1 + 1 SUB1                                     

017    IF SUB1 GT SET-COUNT 140                          

017    RELS 6                                            

017    B 131                                             

017140 RELS 7                                            

017150 MOVE 0 TO AREA-COUNT                              

017    MOVE 0 TO RECORD-COUNT                            

017    MOVE 0 TO SET-COUNT                               

017    MOVE S-NAME-010 TO HOLD-SCHEMA                    

017    DROP                                              

017200 IF HOLD-SCHEMA NE 'SCPGH01' 201                   

017    IF SA-NAM-018 EQ ('MC-CALCD-AREA' 'MC-CAUSCD-AREA' << native VSAM

* 'MC-POLICY-AREA' 'MC-TYPCD-AREA' 'MC-TYPEDT-AREA') DROP        

017201 AREA-COUNT + 1 AREA-COUNT                                

017    MOVE SA-NAM-018 TO X-AREA.AREA-COUNT                     

017    DROP                                                     

017300 IF RSYN-NAME-079 EQ 'SR' DROP                            

017    IF HOLD-SCHEMA NE 'SCPGH01' 301  << schema with native VSAM areas ...                        

017    IF RSYN-NAME-079 EQ ('MC9019-CALCD' 'MC9018-TYPCD'   << native VSAM     

* 'MC9017-TYPEDT' 'MC9016-CAUSCD' 'MC9015-POLICY') DROP          

017301 RECORD-COUNT + 1 RECORD-COUNT                            

017    MOVE RSYN-NAME-079 TO X-RECORD.RECORD-COUNT              

017    DROP                                                     

017400 IF SET-NAM-046 EQ 'CALC' DROP                            

017    IF HOLD-SCHEMA NE 'SCPGH01' 401                          

017    IF SET-NAM-046 EQ ('MC9019-CALCD-IX' 'MC9018-TYPCD-IX'  << batice VSAM   

* 'MC9017-TYPEDT-IX' 'MC9016-CAUSCD-IX' 'MC9015-POLICY-IX') DROP 

017401 SET-COUNT + 1 SET-COUNT                                  

017    MOVE SET-NAM-046 TO X-SET.SET-COUNT                      

017    DROP                                                                     

 

This document was generated from the following discussion: create a GLOBAL subschema from a SCHEMA

Attachments

    Outcomes