Chapter Contents

Previous

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

Using View Descriptors in SAS Programs

You can use a view descriptor in any SAS procedure in which you could use other SAS data sets. The next two examples include printing and reviewing variables for a view descriptor.


Printing Data

Printing IMS-DL/I data described by a view descriptor is like printing any other SAS data set, as shown in the following example:

options nodate linesize=120;

proc print data=vlib.wiredata;
   title2 'Wire Transactions';
run;

Results of the PRINT Procedure shows the output for the VLIB.WIREDATA view descriptor.

Results of the PRINT Procedure
                                                  The SAS System
                                                Wire Transactions

  OBS  SSN_ACCOUNT             ACCOUNT_TYPE  WIRE_DATE WIRE_TIME   WIRE_AMOUNT  WIRE_DESCRIPT

    1  335-45-3451345620145345    C          03/31/95  15:42:43    1563.23      BAD CUST_SSN
    2  434-62-1224345656336366    L          03/30/95  23:45:32    424.87       WIRED FROM SCNB 37262849393
    3  156-45-5672345689435776    S          04/06/95  12:23:42    -150.00      WIRED TO BOA 9383627274
    4  456-45-3462345620134522    C          04/06/95  13:12:34    -245.73      WIRED TO WELLS FARGO CHICAGO
    5  234-74-4612345689413263    S          04/06/95  15:45:42    -238.73      WIRED TO WELLS FARGO SAN FRANCISCO
    6  667-73-8275345620154633    S          03/31/95  15:42:43    1563.23      BAD ACCT_NUM
    7  234-74-4612345620113263    C          04/06/95  11:12:42    1175.00      WIRED FROM SCNB 73653728343
    8  156-45-5672345620123456    C          04/06/94  10:23:53    -136.29      WIRED TO SCNB 53472019836
    9  156-45-5672345620123456    C          04/06/95   9:35:53    1923.87      WIRED FROM CIBN 37284839328
   10  434-62-1224345620134564    C          04/06/95  13:23:52    -284.42      WIRED TO TVNB 837362636438
   11  667-73-8275345689454633    C          03/28/95  15:42:43    1563.23      BAD ACCT_NUM

When you use the PRINT procedure, you may want to take advantage of the OBS= and FIRSTOBS= data set options. The OBS= option enables you to specify the last observation to be processed; the FIRSTOBS= option enables you to specify the first. The options are not valid with any form of the WHERE expression. The OBS= option improves performance when the view descriptor describes a large amount of data and you just want to see an example of the output. Because each record must still be read and its position calculated, using the FIRSTOBS= option does not improve performance significantly. The POINT= and KEY= options of the MODIFY and SET statements are not currently supported by the IMS-DL/I engine.

The following example uses the OBS= data set option to print the first five observations of data described by the view descriptor VLIB.WIREDATA, which describes the WIRETRAN segment of the IMS-DL/I database WIRETRN:

options nodate linesize=120;

proc print data=vlib.wiredata(obs=5);
   title2 'First Five Observations Described by 
          VLIB.WIREDATA';
run;

Results of Using the FIRSTOBS= Option shows the result of this example.

Results of Using the FIRSTOBS= Option
                                                 The SAS System                                                  
                               First Five Observations Described by VLIB.WIREDATA                                
                                                                                                                 
 OBS  SSN_ACCOUNT              ACCOUNT_TYPE  WIRE_DATE  WIRE_TIME   WIRE_AMOUNT  WIRE_DESCRIPT                              
                                                                                                                 
   1  335-45-3451345620145345    C           03/31/95   15:42:43    1563.23      BAD CUST_SSN                          
   2  434-62-1224345656336366    L           03/30/95   23:45:32     424.87      WIRED FROM SCNB 37262849393           
   3  156-45-5672345689435776    S           04/06/95   12:23:42    -150.00      WIRED TO BOA 9383627274               
   4  456-45-3462345620134522    C           04/06/95   13:12:34    -245.73      WIRED TO WELLS FARGO CHICAGO          
   5  234-74-4612345689413263    S           04/06/95   15:45:42    -238.73      WIRED TO WELLS FARGO SAN FRANCISCO    

For more information on the PRINT procedure, see SAS Language Reference: Concepts and SAS Procedures Guide. For more information on the OBS= and FIRSTOBS= options, see SAS Language Reference: Dictionary.


Reviewing Variables

If you want to use IMS-DL/I data described by a view descriptor in your SAS program, you can use the CONTENTS or DATASETS procedure to display the view's variable and format information. You use these procedures with view descriptors in the same way you use them with other SAS data sets.

The following example uses the DATASETS procedure to give you information on the view descriptor VLIB.WIREDATA, which describes the data in the WIRETRAN segment of the IMS-DL/I database WIRETRN:

options nodate linesize=132;

proc datasets library=vlib memtype=view;
   contents data=wiredata;
   title2 ' ';
run;

Using the DATASETS Procedure with a View Descriptor shows the first display of the information for this example.

Using the DATASETS Procedure with a View Descriptor
                                                                                   
                              DATASETS PROCEDURE                                   
                                                                                   
        Data Set Name: VLIB.WIREDATA          Observations:         .              
        Member Type:   VIEW                   Variables:            6              
        Engine:        SASIOIMS               Indexes:              0              
        Created:       .                      Observation Length:   88             
        Last Modified: .                      Deleted Observations: 0              
        Protection:                           Compressed:           NO             
        Data Set Type:                        Sorted:               NO             
        Label:                                                                     
                                                                                   
                 -----Engine/Host Dependent Information-----                       
                                                                                   
                                                                                   
             -----Alphabetic List of Variables and Attributes-----                 
                                                                                   
  #    Variable       Type    Len    Pos    Format    Informat    Label               
  --------------------------------------------------------------------------       
  2    ACCOUNT_TYPE   Char      1     23    $1.       $1.         ACCOUNT TYPE        
  1    SSN_ACCOUNT    Char     23      0    $23.      $23.        SSN - ACCOUNT       
  5    WIRE_AMOUNT    Num       8     40    12.2      12.2        WIRE AMOUNT         
  3    WIRE_DATE      Char      8     24    $8.       $8.         WIRE DATE           
  6    WIRE_DESCRIPT  Char     40     48    $40.      $40.        WIRE DESCRIPT       
  4    WIRE_TIME      Char      8     32    $8.       $8.         WIRE TIME           

As you can see from the output produced by the DATASETS procedure, the VLIB.WIREDATA view descriptor has six variables: ACCOUNT_TYPE, SSN_ACCOUNT, WIRE_AMOUNT, WIRE_DATE, WIRE_DESCRIPT, and WIRE_TIME. The variables are listed in alphabetic order, and the column labeled with a # (pound sign) in the listing shows the order of each variable as it appears in the WIRETRAN database segment. You cannot change a view descriptor's variable labels using the DATASETS procedure. The labels are generated from the IMS-DL/I item names when the view descriptor is created.

For more information on the DATASETS procedure, see SAS Language Reference: Concepts and the SAS Procedures Guide.


Chapter Contents

Previous

Next

Top of Page

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