13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

112 CONNECTION= LIBNAME Option 4 Chapter 10In the following GLOBAL example <strong>for</strong> DB2 under z/OS, both PROC DATASETSinvocations appropriately report “no members in directory” because SESSION.B, as atemporary table, has no entry in the system catalog SYSIBM.SYSTABLES. However,the DATA _NULL_ step and SELECT * from PROC SQL step both return the expectedrows. For DB2 under z/OS, when SCHEMA=SESSION the database first looks <strong>for</strong> atemporary table be<strong>for</strong>e attempting to access any physical schema named SESSION.libname x db2 connection=global schema=SESSION;proc datasets lib=x;quit;/** DBMS-specific code to create a temporary table impervious* to commits, and then populate the table directly in the* DBMS from another table.*/proc sql;connect to db2(connection=global schema=SESSION);execute ( DECLARE GLOBAL TEMPORARY TABLE SESSION.B LIKE <strong>SAS</strong>DXS.AON COMMIT PRESERVE ROWS) by db2;execute ( insert into SESSION.B select * from <strong>SAS</strong>DXS.A) by db2;quit;/* Get at the temp table through the global libref. */data _null_;set x.b;put _all_;run;/* Get at the temp table through the global connection. */proc sql;connect to db2 (connection=global schema=SESSION);select * from connection to db2( select * from SESSION.B );quit;proc datasets lib=x;quit;In the following SHARED example, DB2DATA.NEW is created in the database TEST.Because the table DB2DATA.OLD exists in the same database, the optionCONNECTION=SHARED enables the DB2 engine to share the connection both <strong>for</strong>reading the old table and <strong>for</strong> creating and loading the new table.libname db2data db2 connection=shared;data db2data.new (in = ’database test’);set db2data.old;run;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!