|SAS/ACCESS Interface to IMS-DL/I Software|
A physical database is defined to IMS-DL/I in one DBD, which is described later in this section. A physical database is limited to 15 hierarchical levels and 255 segment types (up to 254 dependent segments organized over 14 levels, plus the root segment). There is no limit to the number of segment occurrences, however. Hierarchical File Structure, earlier in this chapter, illustrates the physical database ACCTDBD.
A program view of a database consists of the hierarchically structured segments used in a program or application. A particular program view can be composed of all segments in a database or a subset of the segments, depending on the program's requirements. Program views are defined to IMS-DL/I in Program Communication Blocks (PCBs), which are contained in Program Specification Blocks (PSBs). (See the next several sections for more information on DBDs, PCBs, and PSBs.)
Sample Program View illustrates a program view that consists of some segments from the ACCTDBD database. This program view might be used by a program that prints monthly checking account statements. However, a SAS/ACCESS view descriptor can access data in only one path in the database. Therefore, in one invocation, the view descriptor can retrieve data in either the CHCKDEBT segment or the CHCKCRDT segment.(footnote 1)
Sample Program View
In order for the SAS/ACCESS interface to access an IMS-DL/I database, certain information about the database must be defined. These definitions are contained in DBDs and PSBs.
|What You Need to Know to Create Descriptors|
Typically, DBDs and PSBs are generated by the database administration staff, not by application programmers or users. Users do not need to know how to create DBDs, PSBs, or PCBs in order to use the SAS/ACCESS interface to IMS-DL/I. If you will be creating access descriptors and view descriptors, you need to know
You can get all of this information from your installation's database administrator (DBA).
The descriptions of DBDs and PSBs that follow do not need to be understood in detail. They are included here for readers who want this additional information.
The Database Description (DBD) is usually created by the DBA at an installation. The DBD specifies characteristics of a database, including
|the name of the DBD, which is also used as a shorthand name for the IMS-DL/I database (1-8 characters).|
|the type and access method for the database (DEDB, MSDB, HDAM, HIDAM, HSAM, HISAM, GSAM, SHISAM, or SHSAM). These database types are defined in the next section.|
|the randomizing method to assign an address to each record's key (HDAM only).|
|the DDname for the database.|
|the device type.|
|the block size.|
|the name, parent, and length of each segment type in the database. The parent information enables IMS-DL/I to determine the segment's position in the hierarchy.|
|the name, length, starting position, and type of data for each sequence and search field in each segment. (In the following example, the code that specifies these characteristics is underlined.)|
Note: It is not necessary to specify every
field in a segment in the DBD. Only those fields to be used as sequence and
search fields are specified in the DBD.
The following is the DBD for the ACCTDBD database.
DBD  NAME=ACCTDBD,  ACCESS=(HDAM,OSAM), X  RMNAME=(DFSHDC40,3,71) DATASET  DD1=ACCTDD,  DEVICE=3380, X  BLOCK=2400  SEGM NAME=CUSTOMER,PARENT=0,BYTES=225  FIELD NAME=(SSNUMBER,SEQ,U),BYTES=11,START=1, X TYPE=C FIELD NAME=CUSTNAME,BYTES=40,START=12,TYPE=C FIELD NAME=CUSTADD1,BYTES=30,START=52,TYPE=C FIELD NAME=CUSTADD2,BYTES=30,START=82,TYPE=C FIELD NAME=CUSTCITY,BYTES=28,START=112,TYPE=C FIELD NAME=CUSTSTAT,BYTES=2,START=140,TYPE=C FIELD NAME=CUSTLAND,BYTES=20,START=142,TYPE=C FIELD NAME=CUSTZIP,BYTES=10,START=162,TYPE=C FIELD NAME=CUSTHPHN,BYTES=12,START=172,TYPE=C FIELD NAME=CUSTOPHN,BYTES=12,START=184,TYPE=C  SEGM NAME=CHCKACCT,BYTES=40,PARENT=CUSTOMER  FIELD NAME=(ACNUMBER,SEQ,U),BYTES=12,START=1, X TYPE=X FIELD NAME=STMTAMT,BYTES=5,START=13,TYPE=P FIELD NAME=STMTDATE,BYTES=6,START=18,TYPE=X FIELD NAME=STMTBAL,BYTES=5,START=26,TYPE=P  SEGM NAME=CHCKDEBT,BYTES=80, X PARENT=((CHCKACCT,DBLE)),RULES=(,LAST)  FIELD NAME=DEBTAMT,BYTES=5,START=1,TYPE=P FIELD NAME=DEBTDATE,BYTES=6,START=6,TYPE=X FIELD NAME=DEBTBLNK,BYTES=2,START=12,TYPE=X FIELD NAME=DEBTTIME,BYTES=8,START=14,TYPE=C FIELD NAME=DEBTDESC,BYTES=59,START=22,TYPE=C  SEGM NAME=CHCKCRDT,BYTES=80, X PARENT=((CHCKACCT,DBLE)),RULES=(,LAST)  FIELD NAME=CRDTAMT,BYTES=5,START=1,TYPE=P FIELD NAME=CRDTDATE,BYTES=6,START=6,TYPE=X FIELD NAME=CRDTBLNK,BYTES=2,START=12,TYPE=X FIELD NAME=CRDTTIME,BYTES=8,START=14,TYPE=C FIELD NAME=CRDTDESC,BYTES=59,START=22,TYPE=C  SEGM NAME=SAVEACCT,BYTES=40,PARENT=CUSTOMER  FIELD NAME=(ACNUMBER,SEQ,U),BYTES=12,START=1, X TYPE=X FIELD NAME=STMTAMT,BYTES=5,START=13,TYPE=P FIELD NAME=STMTDATE,BYTES=6,START=18,TYPE=X FIELD NAME=STMTBAL,BYTES=5,START=26,TYPE=P  SEGM NAME=SAVEDEBT,BYTES=80, X PARENT=((SAVEACCT,DBLE)),RULES=(,LAST)  FIELD NAME=DEBTAMT,BYTES=5,START=1,TYPE=P FIELD NAME=DEBTDATE,BYTES=6,START=6,TYPE=X FIELD NAME=DEBTBLNK,BYTES=2,START=12,TYPE=X FIELD NAME=DEBTTIME,BYTES=8,START=14,TYPE=C FIELD NAME=DEBTDESC,BYTES=59,START=22,TYPE=C  SEGM NAME=SAVECRDT,BYTES=80, X PARENT=((SAVEACCT,DBLE)),RULES=(,LAST)  FIELD NAME=CRDTAMT,BYTES=5,START=1,TYPE=P FIELD NAME=CRDTDATE,BYTES=6,START=6,TYPE=X FIELD NAME=CRDTBLNK,BYTES=2,START=12,TYPE=X FIELD NAME=CRDTTIME,BYTES=8,START=14,TYPE=C FIELD NAME=CRDTDESC,BYTES=59,START=22,TYPE=C DBDGEN
The following is the DBD for the WIRETRAN segment of the WIRETRN database.
DBD NAME=WIRETRN,ACCESS=(HDAM,OSAM), X RMNAME=(DFSHDC40,3,71) DATASET DD1=WIREDD,DEVICE=3380, BLOCK=2400 SEGM NAME=WIRETRAN,PARENT=0,BYTES=100 FIELD NAME=(SSNACCT,SEQ,M),BYTES=23,START=1, X TYPE=C FIELD NAME=ACCTTYPE,BYTES=1,START=24,TYPE=C FIELD NAME=WIREDATE,BYTES=8,START=25,TYPE=C FIELD NAME=WIRETIME,BYTES=8,START=33,TYPE=C FIELD NAME=WIREAMMT,BYTES=5,START=41,TYPE=X FIELD NAME=WIREDESC,BYTES=40,START=46,TYPE=C DBDGEN
During installation, the database administrator (DBA) chooses the type of database to use for the IMS-DL/I databases. The DBA decides which type of database to use based on how most of the programs that use an IMS-DL/I database will access the data in the database. The following is a list of database types that the DBA can use to define an IMS-DL/I database that is supported by the SAS/ACCESS interface to IMS-DL/I in Version 7 of the SAS System:
When specifying the characteristics of the physical database in the DBD, the DBA identifies for each segment in the database the fields that IMS-DL/I can use to search or sequence a segment. The DBA can define each individual field, define the entire segment as one field and assign a generic data type, or define some fields individually and other fields as a group. The DBA may define fields in an IMS-DL/I database segment using the following data types:
|Data Type Code||Data Type|
|E||short floating point|
|D||long floating point|
|L||extended floating point|
Note: All COBOL
and PL/I data types are
supported as hexadecimal data types.
To create access and view descriptors to be used by the SAS/ACCESS interface to IMS-DL/I, you need to know how the DBA has defined the database fields. You also need to know how the fields are initialized and the order of all the fields in each segment to be accessed. You can get this information from a layout of the database or a COBOL copybook.
Recommended DBFORMAT= Values to Use for Common COBOL and PL/I Data Types shows the DBFORMAT= value that you specify in an access descriptor for some common COBOL and PL/I data types. This table also shows the SAS variable formats that the SAS/ACCESS interface generates from the IMS-DL/I DBFORMAT= value.
|IMS-DL/I Type||COBOL||PL/I||Description||Standard Length in Bytes||RecommendedDBFORMAT=||SAS Format Generated|
|C||PIC A||Pic 'A'||Alphabetic||<=200
|C||PIC X||Char or Pic 'X'||Alphanumeric||<=200
|Z||PIC 9||Pic '9'||Numeric Edited||w.d|
|Z||PIC S9||Pic '99T'||Zoned-Decimal||ZDw.d||w.d|
|H||PIC 9(4) COMP||Fixed Bin (15)||Fixed-Point Binary||2||IB2.||7.0|
|F||PIC 9(8) COMP||Fixed Bin (31)||Fixed-Point Binary||4||IB4.||10.0|
|Float Bin (21)||Floating-Point||4||Rb4.||E13.0|
When you create an access descriptor, you use the ITEM= statement to describe the IMS-DL/I DBD. When you need to specify a SAS informat that corresponds to a COBOL data description, refer to PICTURE and USAGE. If the USAGE is COMP-1 or COMP-2, there is no PICTURE. If no USAGE is specified, it defaults to DISPLAY.
Use the following information to make the conversions:
Xrepresent character values.
9to represent digits. They might use an
Sto mean signed and a
Vto show the location of an implied decimal point.
The number of characters or digits is specified either
by the number of
9s in the picture or by
the number in parentheses immediately after the
9. For example,
AAAA is the same as
TITLE-MISSING shows other conversions.
|DISPLAY||9(int)V9(fract)||ZDw.d||(int + fract)||(fract)|
|* If the (int + fract) is 1-4, the width is 2 and decimal is a fraction. If the (int + fract) is 5-9, the width is 4 and decimal is a fraction. If the (int + fract) is 10-18, the width is 8 and decimal is a fraction.|
Use SAS formats to print the fractional part read with the IBw.d and RBw.d SAS informats.
|Program Specification Block|
A Program Specification Block (PSB) is also generally created by the DBA at an installation. A PSB consists of one or more program views of one or more databases. A SAS task using the SAS/ACCESS interface to access an IMS-DL/I database must reference one and only one PSB. Information specified in the PSB includes
Here is a sample of a PSB called ACCTSAM, which contains some database PCBs for the ACCTDBD database and one PCB for the WIRETRN database:
PCB TYPE=DB,DBDNAME=ACCTDBD,PROCOPT=G, X KEYLEN=11 SENSEG NAME=CUSTOMER,PARENT=0,PROCOPT=G PCB TYPE=DB,DBDNAME=ACCTDBD,PROCOPT=G, X KEYLEN=23 SENSEG NAME=CUSTOMER,PARENT=0,PROCOPT=GP SENSEG NAME=CHCKACCT,PARENT=CUSTOMER,PROCOPT=G SENSEG NAME=SAVEACCT,PARENT=CUSTOMER,PROCOPT=G PCB TYPE=DB,DBDNAME=ACCTDBD,PROCOPT=A, X KEYLEN=23 SENSEG NAME=CUSTOMER,PARENT=0,PROCOPT=AP SENSEG NAME=CHCKACCT,PARENT=CUSTOMER,PROCOPT=AP SENSEG NAME=CHCKDEBT,PARENT=CHCKACCT,PROCOPT=A SENSEG NAME=CHCKCRDT,PARENT=CHCKACCT,PROCOPT=A SENSEG NAME=SAVEACCT,PARENT=CUSTOMER,PROCOPT=AP SENSEG NAME=SAVEDEBT,PARENT=SAVEACCT,PROCOPT=A SENSEG NAME=SAVECRDT,PARENT=SAVEACCT,PROCOPT=A PCB TYPE=DB,DBDNAME=WIRETRN,PROCOPT=A, X KEYLEN=23 SENSEG NAME=WIRETRAN,PARENT=0,PROCOPT=A PSBGEN LANG=ASSEM,IOASIZE=500,PSBNAME=ACCTSAM, X CMPAT=YES END
IMS-DL/I provides security for databases through data sensitivity, a way of controlling which data the SAS/ACCESS interface to IMS-DL/I can access. The SAS/ACCESS interface is allowed to access only data to which it is sensitive. There are three levels of data sensitivity:
The DBA can specify data sensitivity for an IMS-DL/I database in each database PCB in the PSB.
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.