SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 31025: Sample code for verifying a table ID from the SAS® Metadata Server

DetailsAboutRate It

Users sometimes need to verify that a table exists in the SAS® IT Management Solutions repository that is used by SAS® IT Resource Management. Two methods for performing this action are presented below. Use either method to verify the presence of a table (an aggregation, for example) in the SAS IT Management Solutions repository.

Note: You should ensure that you have a working backup copy of your SAS IT Resource Management data sets before attempting either of these methods.

There are several things to remember before you proceed:

  • The code samples below verify the table ID and the presence of the table.
  • It is best to run this code with a REGION (job card) of 500Mb or more.
  • Executing this code requires the same SAS® Foundation server that you use from SAS® Data Integration Studio. Therefore, you must ensure that you have set up your Java environment correctly.
  • You can submit this code from the Source Editor in SAS Data Integration Studio.
  • To find the metadata ID for a table, right-click the table in SAS Data Integration Studio, select Properties, and then click the Advanced tab. The last entry in that table is Id.

Method #1:

%let metaPort = %nrquote(port_number); %let metaServer = %nrquote(machine_name); %let metaRepository = %nrquote(ITMS); %let metaUser = %nrquote(Admin userid); %let metaPassword = %nrquote(password); /* Set metadata options */ options metaport = &metaPort metaserver = "&metaServer" metarepository = "&metaRepository"; %macro findTable(tableID=); %if "&tableID" eq "" %then %goto error; data _null_; attrib message length=$32767; dcl javaobj dispatch('com/sas/solutions/itms/omil/FoundationDispatcher'); dispatch.callVoidMethod('initialize',"&metaServer","&metaPort","&metaUser","&metaPassword"); dispatch.callStringMethod('getMessage',message); put message=; _connected=0; /* assume false */ dispatch.callIntMethod('isConnected',_connected); if (_connected) then do; _found=0; /* assume false */ dispatch.callIntMethod('setActiveObject',"&tableID",'PhysicalTable',_found); dispatch.callStringMethod('getMessage',message); put message=; if (_found) then do; put "NOTE: Successfully found physical table by ID=&tableID"; end; else do; put "ERROR: Connected OK but failed to find physical table by ID=&tableID"; end; end; else do; put 'ERROR: Failed to connect, rc= ' _connected; end; run; %goto endit; %error: %put The parameter tableID= is required.; %endit: %mend; %findTable(tableID=A57CX6K3.AJ000003);

Method #2:

%let metaPort = %nrquote(port_number); %let metaServer = %nrquote(machine_name); %let metaRepository = %nrquote(ITMS); %let metaUser = %nrquote(userid); %let metaPassword = %nrquote(password); /* Set metadata options */ options metaport = &metaPort metaserver = "&metaServer" metarepository = "&metaRepository"; %macro findTable(tableID=); %if "&tableID" eq "" %then %goto error; filename output catalog "work.temp.output.source"; filename input catalog "work.temp.input.source"; data _null_; file input; xml= '<GetMetadata><Metadata><PhysicalTable Id="'|| trim("&tableID")|| '" Name="" Desc="" MetadataCreated="" NumRows=""> <ColumnList/> <ObjectNote/> </PhysicalTable> </Metadata> <Ns>SAS</Ns> <Flags>1</Flags> <Options/> </GetMetadata>'; put xml; run; proc METADATA server="&metaServer" port=&metaPort userid="&metaUser" password="&metaPassword" in=input out=output; run; data _null_; infile input length=len; length card $32767; input card $varying32767. len; put _infile_; run; data _null_; infile output length=len; length card $32767; input card $varying32767. len; put _infile_; run; %goto endit; %error: %put The parameter tableID= is required.; %endit: %mend; %findTable(tableID=A57CX6K3.AJ000003);


Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS IT Security Management-Serverz/OS9.1 TS1M3 SP4
Microsoft® Windows® for 64-Bit Itanium-based Systems9.1 TS1M3 SP4
Microsoft Windows Server 2003 Datacenter 64-bit Edition9.1 TS1M3 SP4
Microsoft Windows Server 2003 Enterprise 64-bit Edition9.1 TS1M3 SP4
Microsoft Windows XP 64-bit Edition9.1 TS1M3 SP4
Microsoft® Windows® for x649.1 TS1M3 SP4
Microsoft Windows 2000 Advanced Server9.1 TS1M3 SP4
Microsoft Windows 2000 Datacenter Server9.1 TS1M3 SP4
Microsoft Windows 2000 Server9.1 TS1M3 SP4
Microsoft Windows 2000 Professional9.1 TS1M3 SP4
Microsoft Windows NT Workstation9.1 TS1M3 SP4
Microsoft Windows Server 2003 Datacenter Edition9.1 TS1M3 SP4
Microsoft Windows Server 2003 Enterprise Edition9.1 TS1M3 SP4
Microsoft Windows Server 2003 Standard Edition9.1 TS1M3 SP4
Microsoft Windows XP Professional9.1 TS1M3 SP4
Windows Vista9.1 TS1M3 SP4
64-bit Enabled AIX9.1 TS1M3 SP4
64-bit Enabled HP-UX9.1 TS1M3 SP4
64-bit Enabled Solaris9.1 TS1M3 SP4
HP-UX IPF9.1 TS1M3 SP4
Linux9.1 TS1M3 SP4
Tru64 UNIX9.1 TS1M3 SP4
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.