Oracle® Database Gateway for IMS User's Guide 11g Release 2 (11.2) Part Number E12072-01 |
|
|
PDF · Mobi · ePub |
This section contains the following topics:
Figure E-1 shows a COBOL copybook that illustrates arrays and nested arrays.
The following are the full source files for the Hospital database example that is used in Hierarchical Modelling and Constructing DLI Commands from SQL Requests.
Example E-1 Hospital Cobol Copybook
01 HOSPITAL. 03 HOSPNAME PIC X(20). 03 HOSP-ADDRESS PIC X(30). 03 HOSP-PHONE PIC X(10). 03 ADMIN PIC X(20). 01 WARD. 03 WARDNO PIC XX. 03 TOT-ROOMS PIC XXX. 03 TOT-BEDS PIC XXX. 03 BEDAVAIL PIC XXX. 03 WARDTYPE PIC X(20). 01 PATIENT. 03 PATNAME PIC X(20). 03 PATADDRESS PIC X(30). 03 PAT-PHONE PIC X(10). 03 BEDIDENT PIC X(4). 03 DATEADMT PIC X(6). 03 PREV-STAY-FLAG PIC X. 03 PREV-HOSP PIC X(20). 03 PREV-DATE PIC X(4). 03 PREV-REASON PIC X(30). 01 SYMPTOM. 03 DIAGNOSE PIC X(20). 03 SYMPDATE PIC X(6). 03 PREV-TREAT-FLAG PIC X. 03 TREAT-DESC PIC X(20). 03 SYMP-DOCTOR PIC X(20). 03 SYMP-DOCT-PHONE PIC X(10). 01 TREATMNT. 03 TRTYPE PIC X(20). 03 TRDATE PIC X(6). 03 MEDICATION-TYPE PIC X(20). 03 DIET-COMMENT PIC X(30). 03 SURGERY-FLAG PIC X. 03 SURGERY-DATE PIC X(6). 03 SURGERY-COMMENT PIC X(30). 01 DOCTOR. 03 DOCTNAME PIC X(20). 03 DOCT-ADDRESS PIC X(30). 03 DOCT-PHONE PIC X(10). 03 SPECIALT PIC X(20). 01 FACILITY. 03 FACTYPE PIC X(20). 03 TOT-FACIL PIC XXX. 03 FACAVAIL PIC XXX.
PRINT NOGEN DBD NAME=HOSPDBD,ACCESS=HDAM,RMNAME=(DFSHDC40,40,100) DATASET DD1=PRIME,DEVICE=3390 SEGM NAME=HOSPITAL,PARENT=0,BYTES=80 FIELD NAME=(HOSPNAME,SEQ,U),BYTES=20,START=1,TYPE=C FIELD NAME=ADMIN,BYTES=20,START=61,TYPE=C SEGM NAME=WARD,PARENT=HOSPITAL,BYTES=31 FIELD NAME=(WARDNO,SEQ,U),BYTES=2,START=1,TYPE=C FIELD NAME=BEDAVAIL,BYTES=3,START=9,TYPE=C FIELD NAME=WARDTYPE,BYTES=20,START=12,TYPE=C SEGM NAME=PATIENT,PARENT=WARD,BYTES=125 FIELD NAME=(BEDIDENT,SEQ,U),BYTES=4,START=61,TYPE=C FIELD NAME=PATNAME,BYTES=20,START=1,TYPE=C FIELD NAME=DATEADMT,BYTES=6,START=65,TYPE=C SEGM NAME=SYMPTOM,PARENT=PATIENT,BYTES=77 FIELD NAME=(SYMPDATE,SEQ),BYTES=6,START=21,TYPE=C FIELD NAME=DIAGNOSE,BYTES=20,START=1,TYPE=C SEGM NAME=TREATMNT,PARENT=PATIENT,BYTES=113 FIELD NAME=(TRDATE,SEQ),BYTES=6,START=21,TYPE=C FIELD NAME=TRTYPE,BYTES=20,START=1,TYPE=C SEGM NAME=DOCTOR,PARENT=PATIENT,BYTES=80 FIELD NAME=DOCTNAME,BYTES=20,START=1,TYPE=C FIELD NAME=SPECIALT,BYTES=20,START=61,TYPE=C SEGM NAME=FACILITY,PARENT=HOSPITAL,BYTES=26 FIELD NAME=FACTYPE,BYTES=20,START=1,TYPE=C FIELD NAME=FACAVAIL,BYTES=3,START=24,TYPE=C DBDGEN FINISH END
PRINT NOGEN PCB TYPE=DB,DBDNAME=HOSPDBD,PROCOPT=AP,KEYLEN=32 * SENSEG NAME=HOSPITAL,PARENT=0 SENSEG NAME=WARD,PARENT=HOSPITAL SENSEG NAME=PATIENT,PARENT=WARD SENSEG NAME=SYMPTOM,PARENT=PATIENT SENSEG NAME=TREATMNT,PARENT=PATIENT SENSEG NAME=DOCTOR,PARENT=PATIENT SENSEG NAME=FACILITY,PARENT=HOSPITAL * PSBGEN LANG=COBOL,PSBNAME=HOSPPSB END
Footnote Legend
Footnote 1: Kapp, Dan and Leben, Joe: IMS Programming Techniques. Van Nostrand Reinhold Company Inc., New York, 1986.