Examples That Use Remote Objecting

Similar documents
Using Data Transfer Services

Using Cross-Environment Data Access (CEDA)

Introduction. LOCK Statement. CHAPTER 11 The LOCK Statement and the LOCK Command

Permission Program. Support for Version 6 Only. Allowing SAS/SHARE Client Access to SAS Libraries or Files CHAPTER 40

APPENDIX 2 Customizing SAS/ASSIST Software

Chapter 3 Managing Results in Projects. Chapter Table of Contents

CHAPTER 7 Examples of Combining Compute Services and Data Transfer Services

Data Representation. Variable Precision and Storage Information. Numeric Variables in the Alpha Environment CHAPTER 9

Chapter 28 Saving and Printing Tables. Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS OUTPUT OBJECTS...

SAS I/O Engines. Definition. Specifying a Different Engine. How Engines Work with SAS Files CHAPTER 36

SAS Support for TELNET on Windows

Formats. Formats Under UNIX. HEXw. format. $HEXw. format. Details CHAPTER 11

Graphics. Chapter Overview CHAPTER 4

Creating and Executing Stored Compiled DATA Step Programs

Chapter 6 Creating Reports. Chapter Table of Contents

Data Set Options. Specify a data set option in parentheses after a SAS data set name. To specify several data set options, separate them with spaces.

Chapter 25 PROC PARETO Statement. Chapter Table of Contents. OVERVIEW SYNTAX SummaryofOptions DictionaryofOptions...

SAS File Management. Improving Performance CHAPTER 37

SAS Component Language (SCL) Interface to Agent Services

Using the SQL Editor. Overview CHAPTER 11

OS/390 Platform Examples

SCL Arrays. Introduction. Declaring Arrays CHAPTER 4

The SERVER Procedure. Introduction. Syntax CHAPTER 8

SAS Catalogs. Definition. Catalog Names. Parts of a Catalog Name CHAPTER 32

UNIX Spawner Program. Starting the UNIX Spawner Program CHAPTER 36

External Files. Definition CHAPTER 38

CHAPTER 13 Importing and Exporting External Data

UNIX Platform Error Messages

Storing and Reusing Macros

Chapter 23 Animating Graphs. Chapter Table of Contents ANIMATING SELECTION OF OBSERVATIONS ANIMATING SELECTED GRAPHS...347

from the source host, use the FTP put command to copy a file from the source host to the target host.

Informats. Informats Under UNIX. HEXw. informat. $HEXw. informat. Details CHAPTER 13

OS/2: SPX Access Method

Chapter 2 User Interface Features. networks Window. Drawing Panel

Locking SAS Data Objects

The EXPLODE Procedure

Overview. CHAPTER 2 Using the SAS System and SAS/ ASSIST Software

OpenVMS Operating Environment

Windows: SPX Access Method

SAS/ASSIST Software Setup

Alternative ODS HTML Statements for Running Examples in Different Operating Environments

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14

Handling Exceptions. Introduction. Using the Program Halt Handler CHAPTER 10

Introduction to MDDBs

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

Chapter 14 Introduction to the FACTEX Procedure

Tasks Menu Reference. Introduction. Data Management APPENDIX 1

SAS Web Infrastructure Kit 1.0. Overview

DBLOAD Procedure Reference

CHAPTER 5 Macintosh: TCP/IP Access Method

CHAPTER 7 Using Other SAS Software Products

Routing the SAS Log and SAS Procedure Output

10 The First Steps 4 Chapter 2

Using MDP Extensions. What Is the Multidimensional Data Provider? CHAPTER 3

Enterprise Miner Software: Changes and Enhancements, Release 4.1

SAS Data Libraries. Definition CHAPTER 26

Chapter 27 Saving and Printing Graphics

Chapter 9 Selected Examples. Queues with Reneging

QUEST Procedure Reference

Introduction. Understanding SAS/ACCESS Descriptor Files. CHAPTER 3 Defining SAS/ACCESS Descriptor Files

SAS Workflow Manager 2.2: Administrator s Guide

Changes and Enhancements

Optimizing System Performance

Chapter 25 Editing Windows. Chapter Table of Contents

Choosing the Right Procedure

SAS. IT Service Level Management 2.1: Migration Documentation

The correct bibliographic citation for this manual is as follows: SAS Institute Inc Proc EXPLODE. Cary, NC: SAS Institute Inc.

Licensing SAS DataFlux Products

The GTESTIT Procedure

What Is a Communications Access Method? CHAPTER 1 Using Communications Access Methods

Introduction. CHAPTER 3 Working in the SAS Windowing Environment

Chapter 13 Multivariate Techniques. Chapter Table of Contents

Introduction. Getting Started with the Macro Facility CHAPTER 1

The TRANTAB Procedure

Chapter 15 Mixed Models. Chapter Table of Contents. Introduction Split Plot Experiment Clustered Data References...

Chapter 23 Introduction to the OPTEX Procedure

The GSLIDE Procedure. Overview. About Text Slides CHAPTER 27

The SAS Interface to REXX

This chapter is recommended primarily for server administrators.

Batch Importing. Overview CHAPTER 4

Installation Instructions for SAS/ACCESS Interface to SAP BW

SAS Drug Development 3.3_03. December 14, 2007

SAS. Installation Guide Fifth Edition Intelligence Platform

Chapter 28 Command Reference. Chapter Table of Contents TSVIEW COMMAND FORECAST COMMAND

Formats. SAS Formats under OpenVMS. Writing Binary Data CHAPTER 13

SAS Forecast Server 3.1. Administrator s Guide to Installation and Configuration

The G4GRID Procedure. Introduction APPENDIX 1

SAS/ACCESS Interface to R/3

SAS Web Infrastructure Kit 1.0. Overview, Second Edition

Using Unnamed and Named Pipes

SAS Clinical Data Integration 2.4

Chapter 28 INSET Statement. Chapter Table of Contents

Defining Your Data Sources

CV2ODBC Procedure. Overview. CV2ODBC Procedure Syntax APPENDIX 4

SAS Marketing Operations Management 6.0 R14 Update 2

Using Dynamic Data Exchange

DATA Step Debugger APPENDIX 3

Chapter 7 File Access. Chapter Table of Contents

Using CVS Repositories with SAS

Informats. SAS Informats under OpenVMS. Reading Binary Data CHAPTER 15

Transcription:

183 CHAPTER 22 Examples That Use Remote Objecting Example 1 - Create a Remote Instance 183 Example 2 - Gather Class Information 186 Example 1 - Create a Remote Instance This example creates a remote instance of the SASHELP.FSP.DATAST_M class. After the remote instance is created, the methods _SET_DATASET_ and _GET_DATASET_NAME_ are invoked remotely, and the results are returned for local processing. main: r_string = ; c_string = ; rc=0; /* Load class ROBJECT then create an*/ /* instance of that class locally. */ remote_c = loadclass( sashelp.connect.robject ); rid = instance(remote_c); /* Define the remote host and the */ /* location of the class on which */ /* method would be used. */ remval = optgetc( REMOTE ); c_string = sashelp.fsp.datast_m ; r_string = remote// remval; /* Create remote instance of the */ /* class. */ call send(rid, _createremoteinstance, r_string, c_string, rc);

184 Example 1 - Create a Remote Instance 4 Chapter 22 /* Begin with method "_SET_DATASET_"*/ call send(rid, _beginmethod, "_SET_DATASET_", rc); put _beginmethod of _SET_DATASET_ was successful... ; /* Begin sending information to the */ /* method. Send name of class; */ /* mode INPUT. Be sure the data */ /* set itself exists. */ dsname = work.a ; c_mode = "I"; c_name = "remote dataset name"; put "submitting the name of the remote dataset " dsname c_mode c_name; call send(rid, _addmethodargc, dsname, /* After all required information */ /* has been sent to the method, */ /* invoke _SET_DATASET_. */ put Invoking _SET_DATASET_ method... ; r_list = makelist(); call send(rid, _invokemethod, r_list,rc); put Invoke method _SET_DATASET_ was successful... ; /* Begin method */ /* "_GET_DATASET_NAME_". */ call send(rid, _beginmethod, "_GET_DATASET_NAME_", rc); put _beginmethod of _GET_DATASET_NAME_ was successful... ; /* Begin sending information to the */ /* method; mode OUTPUT because */ /* results are expected now. */ dsname = ; c_mode = "O"; c_name = "return the dataset name"; put "expecting a result variable back "

Examples That Use Remote Objecting 4 Example 1 - Create a Remote Instance 185 dsname c_mode c_name; call send(rid, _addmethodargc, dsname, /* After all required information */ /* has been sent to the method, */ /* invoke _GET_DATASET_NAME_. */ put Invoking _GET_DATASET_NAME_ method... ; r_list = makelist(); call send(rid, _invokemethod, r_list,rc); put Invoke method was successful... ; if (rc eq 0) then mrc = getnitemn(r_list, _mrc, 1, 1, 0); put "method return code= " mrc; put "now we need to fetch the result from the result list"; /**********************************/ /* After the method is invoked, */ /* a list is created that holds */ /* the result. Fetch the results */ /* from the list and display them.*/ /**********************************/ if (mrc = 0) then do index = 1 to listlen(r_list); select(itemtype(r_list, index)); when( C ) rem_varc = getitemc(r_list, c_name= ; c_name = nameitem(r_list, put _GET_DATASET_NAME_ when character: rem_varc c_name; when( N ) rem_varn = getitemn(r_list, c_name= ; c_name = nameitem(r_list, put _GET_DATASET_NAME_ when numeric: rem_varn c_name;

186 Example 2 - Gather Class Information 4 Chapter 22 when( L ) rem_varl = getiteml(r_list, c_name= ; c_name = nameitem(r_list, put _GET_DATASET_NAME_ when list: rem_varl c_name; /**************************************/ /* For clean-up purposes, destroy the */ /* remote instance. */ /**************************************/ put Destroying remote instance... ; call send(rid, _destroyremoteinstance,rc); put remote instance destroyed successful ; return; Example 2 - Gather Class Information In this example, information is gathered remotely about a class. _GET_METHODS_ is used to return the names of all the methods that are defined for a specific class. /* Define rid (remote ID). */ init: rid = 0; return; main: r_string = ; c_string = ; rc=0; remote_c = loadclass( sashelp.connect.robject ); rid = instance(remote_c); /* Define the remote host and */ /* location of the class. */ remval = MARS ; classname = permdata.roclass.ro2tst.class ;

Examples That Use Remote Objecting 4 Example 2 - Gather Class Information 187 r_string = remote// remval; /* Create remote instance of class. */ call send(rid, _createremoteinstance, r_string, classname, rc); /* Begin method "SEND_METHOD_NUM". */ call send(rid, _beginmethod, "SEND_METHOD_NUM", rc); /*****************************************/ /* Method "SEND_METHOD_CHR" accepts the */ /* following parameters: */ /* (1) the first parameter must be */ /* the class name, */ /* (2) the second, is the method name */ /* (3) the third, is the result of the */ /* call that is being returned. */ /*****************************************/ /* Send name of class; mode INPUT. */ cls = permdata.roclass.ro2tst ; c_mode = "I"; c_name = "remote class name"; put "submitting the name of remote class " cls c_mode c_name; call send(rid, _addmethodargc, cls, /* Send name of an SCL method to */ /* be used on the remote side; */ /* mode INPUT. */ mth = _get_methods_ ; c_mode = "I"; c_name = "remote method name"; put "submitting the method to remote side " mth c_mode c_name; call send(rid, _addmethodargc, mth, /* Update the RESULT parameter to */ /* hold new results; mode OUTPUT. */

188 Example 2 - Gather Class Information 4 Chapter 22 result=makelist(); c_mode = "O"; c_name = "result of the remote method"; put "getting the result from remote side " result c_mode c_name; call send(rid, _addmethodargl, result, /* After all the information has */ /* been sent to the remote method, */ /* use INVOKE_METHOD "SEND_METHOD_NUM" */ put Invoking SEND_METHOD_NUM method... ; r_list = makelist(); call send(rid, _invokemethod, r_list, rc); if (rc eq 0) then mrc = getnitemn(r_list, _mrc, 1, 1, 0); put "method return code= " mrc; /*******************************/ /* After the method is invoked,*/ /* a list is created that holds*/ /* the result. */ /* Fetch the results from that */ /* list and display them to */ /* the log. */ /*******************************/ if (mrc = 0) then do index = 1 to listlen(r_list); select(itemtype(r_list, index)); when( C ) rem_varc = getitemc(r_list, c_name = ; c_name = nameitem(r_list, put SEND_METHOD_NUM for character : rem_varc c_name; when( N ) rem_varn = getitemn(r_list,

Examples That Use Remote Objecting 4 Example 2 - Gather Class Information 189 c_name = ; c_name = nameitem(r_list, put SEND_METHOD_NUM for numeric : rem_varn c_name; when( L ) rem_varl = getiteml(r_list, c_name = ; c_name = nameitem(r_list, put SEND_METHOD_NUM for list : rem_varl c_name; /* _GET_METHODS_ returns a */ /* list; so the result is a list */ /* within r_list (the list that */ /* SEND_METHOD_NUM created). The */ /* remote list needs to be captured,*/ /* and its contents displayed. */ if (mrc = 0) then do index = 1 to listlen(rem_varl); select(itemtype(rem_varl, index)); when( C ) varc = getitemc(rem_varl, put **** character RESULT **** : varc ; when( N ) varn = getitemn(rem_varl, put **** numeric RESULT **** : varn ; when( L ) varl = getiteml(rem_varl, put **** list RESULT **** : varl;

190 Example 2 - Gather Class Information 4 Chapter 22 /* For clean-up purposes, destroy */ /* the remote instance. */ put Destroying remote instance... ; call send(rid, _destroyremoteinstance, rc); return;

The correct bibliographic citation for this manual is as follows: SAS Institute Inc., SAS/ CONNECT User s Guide, Version 8, Cary, NC: SAS Institute Inc., 1999. pp. 537. SAS/CONNECT User s Guide, Version 8 Copyright 1999 by SAS Institute Inc., Cary, NC, USA. ISBN 1 58025 477 2 All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc. U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of the software by the government is subject to restrictions as set forth in FAR 52.227 19 Commercial Computer Software-Restricted Rights (June 1987). SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513. 1st printing, September 1999 SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. IBM, AIX, DB2, OS/2, OS/390, RS/6000, System/370 TM, and System/390 are registered trademarks or trademarks of International Business Machines Corporation. ORACLE is a registered trademark or trademark of Oracle Corporation. indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies. The Institute is a private company devoted to the support and further development of its software and related services.