You can use the ACCESS procedure in
batch mode to create the
access descriptor MyLib.WireTrn and the
view descriptor Vlib.WireData. Because IMS does not have a dictionary or store descriptive information
about IMS 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
PROC ACCESS Statement Options 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;
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 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
Invoking the ACCESS Procedure for complete reference information about these statements.
JCL statements;
included for batch
and noninteractive line modes.
libname mylib='access-descriptor
libref';
libname
vlib=’view-descriptor libref’;
reference the
SAS library in which you store the access descriptor (MyLib) and the SAS library in which you
store the view descriptors (Vlib). You must
associate a
libref with its 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.
create mylib.wiretrn.access;
identifies the access descriptor, MyLib.WireTrn, that you want to create.
database=wiretrn dbtype=hdam;
specifies the IMS 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 the 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 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 database to be included in the view, as defined
in the access descriptor.
list view;
lists the SAS information
about the record WIRE TRANSACTION that you selected for this view.
Output from this statement is shown in the SAS log.
run;
forces the execution
of the ACCESS procedure.