Hospital database example
The code examples for the IMS Universal drivers application programming topics use the Hospital database.
The following figure shows the hierarchical structure of the segments in the Hospital database.

- The HOSPITAL segment is the root segment in the database.
- PAYMENTS and WARD are child segments of the HOSPITAL segment.
- WARD has a direct descendent segment named PATIENT.
- ILLNESS and BILLING are the child segments of the PATIENT.
- ILLNESS has a child segment named TREATMENT that stores details about patient treatment.
- The child segment of ILLNESS, DOCTOR, is the lowest level segment in the database hierarchy.
The tables that follow show the layouts of each segment in the Hospital database.
HOSPITAL segment
The following table shows the HOSPITAL segment, which has two fields:
- The hospital code (HOSPCODE)
- The hospital name (HOSPNAME)
HOSPCODE is a unique key field.
Field name | Field length (in bytes) |
---|---|
HOSPCODE | 12 |
HOSPNAME | 17 |
PAYMENTS segment
The following table shows the PAYMENTS segment, which has two fields:
- The patient number (PATNUM)
- The payment amount (AMOUNT)
Field name | Field length (in bytes) |
---|---|
PATNUM | 4 |
AMOUNT | 8 |
WARD segment
The following table shows the WARD segment, which has five fields:
- The ward number (WARDNO)
- The ward name (WARDNAME)
- The patient count (PATCOUNT)
- The nurse count (NURCOUNT)
- The doctor count (DOCCOUNT)
WARDNO is a unique key field.
Field name | Field length (in bytes) |
---|---|
WARDNO | 2 |
WARDNAME | 4 |
PATCOUNT | 8 |
NURCOUNT | 4 |
DOCCOUNT | 2 |
PATIENT segment
The following table shows the PATIENT segment, which has two fields:
- The patient number (PATNUM)
- The patient name (PATNAME)
PATNUM is a unique key field.
Field name | Field length (in bytes) |
---|---|
PATNUM | 12 |
PATNAME | 17 |
ILLNESS segment
The following table shows the ILLNESS segment, which has one field:
- The illness name (ILLNAME)
Field name | Field length (in bytes) |
---|---|
ILLNAME | 15 |
TREATMNT segment
The following table shows the TREATMNT segment, which has three fields:
- The day of treatment (TREATDAY)
- The type of treatment (TREATMNT)
- The treatment comments (COMMENTS)
Field name | Field length (in bytes) |
---|---|
TREATDAY | 8 |
TREATMNT | 15 |
COMMENTS | 10 |
DOCTOR segment
The following table shows the DOCTOR segment, which has two fields:
- The doctor number (DOCTNO)
- The doctor name (DOCNAME)
Field name | Field length (in bytes) |
---|---|
DOCTNO | 4 |
DOCNAME | 20 |
BILLING segment
The following table shows the BILLING segment, which has two fields:
- The bill amount (AMOUNT)
- The bill comments (COMMENTS)
Field name | Field length (in bytes) |
---|---|
AMOUNT | 8 |
COMMENTS | 20 |