Chapter Contents

Previous

Next
SAS/ACCESS Interface to IMS-DL/I Software

Creating and Using Descriptor Files

You can use batch mode to create the access descriptor MYLIB.WIRETRN and the view descriptor VLIB.WIREDATA. Because IMS-DL/I does not have a dictionary or store descriptive information about IMS-DL/I databases, you must provide the database definition in the SAS statements following the procedure statement. You can also create view descriptors in the same PROC ACCESS execution after the access descriptor statements are entered. (See ACCESS Procedure Reference for a list of valid options that you can use with PROC ACCESS.) Here is the general format for creating descriptors:

proc access options;
   statements;
   run;


Creating Access and View Descriptors in One PROC Step

Perhaps the most common way to use the ACCESS procedure is to create an access descriptor and one or more view descriptors during a single PROC ACCESS execution.

The following example shows how to create the access descriptor MYLIB.WIRETRN based on the IMS-DL/I database WIRETRN. The view descriptor VLIB.WIREDATA is based on this access descriptor. After the following example, each SAS/ACCESS statement is explained in the order of appearance in the program:

JCL statements;

libname mylib 'access-descriptor libref';
libname vlib 'view-descriptor
libref';

  proc access dbms=ims;
    create mylib.wiretrn.access;
      database=wiretrn dbtype=hdam;
      record='wire transaction' segment=wiretran 
                                seglng=100;
        item='ssn - account' level=2 dbformat=$23.
                             search=ssnacc key=y;
        item='account type'  level=2 dbformat=$1. 
                             search=accttype;
        item='wire date'     level=2 dbformat=$8. 
                             search=wiredate;
        item='wire time'     level=2 dbformat=$8. 
                             search=wiretime;
        item='wire amount'   level=2 dbformat=pd5.2 
                             search=wireammt
                             dbcontent=l;
        item='wire descript' level=2 dbformat=$40. 
                             search=wiredesc;
    an=y;
    list all;

    create vlib.wiredata.view psbname=acctsam 
      pcbindex=5;
      select 'wire transaction';
    list view;
  run;

Here is an explanation of the statements in this example. See Procedure Statements for complete reference information on these statements.

JCL statements;
include for batch and noninteractive line modes.

libname mylib='libref.access-descriptor';
libname vlib='libref.view-descriptor';
use LIBNAME statements to reference the SAS data library in which you will store the access descriptor (MYLIB) and the SAS data library in which you will store the view descriptors (VLIB). You must associate a libref with its data library before you can use it in another SAS statement or procedure.

proc access dbms=ims;
invokes the ACCESS procedure for the SAS/ACCESS interface to IMS-DL/I.

create mylib.wiretrn.access;
identifies the access descriptor, MYLIB.WIRETRN, that you want to create.

database=wiretrn dbtype=hdam;
specifies the IMS-DL/I database named WIRETRN on which the access descriptor is to be created. The database type is HDAM.

record='wire transaction' segment=wiretran seglng=100;
specifies the user-specified record name, as well as the segment name and segment length, as specified in the IMS DBD for the WIRETRN database.

item='ssn - account' level=2 dbformat=$23. search=ssnacc key=y;
identifies the item SSN - ACCOUNT. It has an internal format of type character, length 23 bytes. SSNACC is specified as a search field name. KEY=Y indicates that SSN - ACCOUNT is listed in the DBD as a key field for the WIRETRAN segment.

item='account type' level=2 dbformat=$1. search=accttype;
identifies the item ACCOUNT TYPE with an internal format of type character, length 1 byte. ACCTTYPE is specified as a search field in the DBD.

item='wire date' level=2 dbformat=$8. search=wiredate;
identifies the item WIRE DATE with an internal format of type character, length 8 bytes. The search field WIREDATE is specified.

item='wire time' level=2 dbformat=$8. search=wiretime;
identifies the item WIRE TIME with the same attributes as WIRE DATE except it has the search field name WIRETIME.

item='wire amount' level=2 dbformat=pd5.2 search=wireammt dbcontent=l;
identifies item WIRE AMOUNT with a packed decimal database format of 5 bytes with 2 decimal places. DBCONTENT=L indicates that SAS should display a missing value when it finds low values (hexadecimal zeros) for this item. The search field is WIREAMMT.

item='wire descript' level=2 dbformat=$40. search=wiredesc;
identifies the item WIRE DESCRIPT with an internal format of type character, length 40 bytes. The search field is WIREDESC.

an=y;
generates unique SAS variable names and default formats based on the name of the IMS-DL/I item and its DBFORMAT= value. Using AN=Y in an access descriptor means no changes can be made to the SAS names and formats in any view descriptors that use the access descriptor.

list all;
lists all the items in the access descriptor and SAS information for each item. The output is displayed in the SAS log.

create vlib.wiredata.view psbname=acctsam pcbindex=5;
creates a view descriptor called WIREDATA which references PSB ACCTSAM. The PCBINDEX=5 statement refers to the specific PCB in the PSB to be used at execution time.

select 'wire transaction';
selects the WIRETRAN segment of the IMS-DL/I database to be included in the view, as defined in the access descriptor.

list view;
lists SAS information on the record WIRE TRANSACTION you selected for this view. Output from this statement is shown in the SAS log.

run;
forces execution of the ACCESS procedure.


Creating Access and View Descriptors in Separate PROC Steps

You can create view descriptors and access descriptors in separate PROC ACCESS steps. In the first PROC ACCESS step in the following example, you create the access descriptor MYLIB.WIRETRN, which is based on the WIRETRN database. In the second PROC ACCESS step, you create a view descriptor, VLIB.WIREDATA, which is based on the access descriptor MYLIB.WIRETRN.

proc access dbms=ims;
    create mylib.wiretrn.access;
      database=wiretrn dbtype=hdam;
      record='wire transaction' segment=wiretran 
                                seglng=100;
        item='ssn - account' level=2 dbformat=$23.
                             search=ssnacc
                             key=y;
        item='account type'  level=2 dbformat=$1. 
                             search=accttype;
        item='wire date'     level=2 dbformat=$8. 
                             search=wiredate;
        item='wire time'     level=2 dbformat=$8. 
                             search=wiretime;
        item='wire amount'   level=2 dbformat=pd5.2 
                             search=wireammt
                             dbcontent=l;
        item='wire descript' level=2 dbformat=$40. 
                             search=wiredesc;
    an=y;
    list all;
  run;

  proc access dbms=ims accdesc=mylib.wiretrn;
    create vlib.wiredata.view psbname=acctsam 
        pcbindex=5;
      select 'wire transaction';
    list view;
  run;

Note that the statement proc access dbms=ims is repeated in this example. See Creating Access and View Descriptors in One PROC Step for complete reference information on this statement.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.