Remote Execution

In this section:

Remote execution allows users to transmit local FOCUS requests to a remote host for execution. In this operating mode, a request built on the client is shipped to the server for execution. On completion, the server returns the output to the client, which displays it in Hot Screen. The server does all data processing, while the client handles request generation and data presentation. Remote execution also supports server-based requests (Remote Procedures), through Remote Procedure Calls (RPCs).

Before sending a request to a remote server, you must connect to it by either:

Note: All data sources supported by servers can be accessed using remote execution.

Logging On With REMOTE Commands

How to:

To have FOCUS automatically log you on to a server, create a FOCEXEC containing the REMOTE DESTINATION, REMOTE USERID, and REMOTE PASSWORD commands.

Syntax: How to Specify a Target Server: REMOTE DESTINATION Command

REMOTE DEST[INATION] = server

where:

server

Is the server name from the client configuration file. It must match the SERVICE attribute in the server configuration file (allocated to the EDASERVE ddname).

Example: Issuing the REMOTE DESTINATION Command

The following server configuration file contains the attribute SERVICE=IBIEDA:

***************************************************************** 
**                SERVICE for CS/3 Communications              ** 
***************************************************************** 
SERVICE      = IBIEDA 
PROGRAM      = TSCOM3 
NUMBER_READY = 0
MAXIMUM      = 50 
*IDLELIM      = 20 
SERVINIT     = *,++ 
  AUTOSTART  = NO 
...              

The client configuration file that provides access to this server contains the attribute NODE=IBIEDA:

NODE = IBIEDA 
 BEGIN 
;  TRACE = 31 
   PROTOCOL = TCP 
   CLASS = CLIENT 
   HOST = IBIMVS       ; DNS NAME OF HOST 
   SERVICE = 2386      ; TCP/IP PORT THAT SERVER IS LISTENING ON
END             

To connect to the server in a FOCEXEC, issue the following command:

REMOTE DEST = IBIEDA 

Syntax: How to Identify the User: REMOTE USERID Command

REMOTE USERID = serveruserid

where:

serveruserid

Is your user ID.

This user ID remains in effect until you reissue the REMOTE USERID command.

Syntax: How to Authenticate the User: REMOTE PASSWORD (USERPASS)

REMOTE PASSWORD = serverpassword

where:

serverpassword

Is your password.

This password remains in effect until you reissue REMOTE PASSWORD.

Note: By not specifying the REMOTE USERID and/or REMOTE PASSWORD commands, the security ID and password used for your mainframe session (z/OS user ID) are used to sign on onto the server.

Sending Requests to a Remote Server

How to:

You can send FOCUS requests to the server for execution as follows:

When the server returns report output, FOCUS displays the report in Hot Screen.

Syntax: How to Execute a Request Remotely Using the REMOTE EX Command

Issue the following command at the FOCUS Session prompt:

REMOTE EX focexecname

where:

focexecname

Is the name of a FOCEXEC stored on the client that is to be executed on the server. Note that Dialogue Manager amper variables in the FOCEXEC will be expanded on the client before the request is shipped to the server.

Important: A request executed this way may not contain the commands -REMOTE BEGIN and -REMOTE END. REMOTE EX issues those commands automatically.

Example: Executing a Request Remotely Using the REMOTE EX Command

The following sample FOCEXEC (EDHOURS) is executed at the FOCUS Session prompt with the REMOTE EX command.

The following code is stored on the client as FOCEXEC EDHOURS:

TABLE FILE EMPLOYEE
  HEADING CENTER
  "SUMMARY REPORT OF EMPLOYEE CLASSROOM HOURS"
  " "
  SUM ED_HRS BY EMP_ID
END

To execute this procedure on the server, issue the following command:

>> REMOTE EX EDHOURS

Using -REMOTE BEGIN and -REMOTE END to Execute Requests Remotely

How to:

Another way to execute report requests against remote data is to begin the FOCEXEC that you want executed on the server with the command -REMOTE BEGIN, and follow the END command with -REMOTE END. Then execute the FOCEXEC.

Using -REMOTE BEGIN and -REMOTE END provides the following advantages:

Keep the following restrictions in mind:

Example: Executing Requests Using -REMOTE BEGIN and -REMOTE END

The following example demonstrates the use of a Dialogue Manager amper variable (&1) with FOCUS commands in a FOCEXEC named MARGIN. The request executes a JOIN and report request on the server. The numbers on the left refer to the notes that follow.

 
1. -REMOTE BEGIN 
2. JOIN PROD_CODE IN &1 TO PROD_CODE IN PROD AS AJOIN
   TABLE FILE &1
   PRINT UNIT_SALES
   AND COMPUTE
   MARGIN/D8.2= RETAIL_PRICE - UNIT_COST;
   BY STORE_CODE BY PROD_CODE
   END 
3. -REMOTE END
  1. -REMOTE BEGIN identifies the beginning of the command stream to be executed on the server. Any commands already in the FOCUS stack are executed when -REMOTE BEGIN is encountered.
  2. The MARGIN procedure includes FOCUS commands and an amper variable, which is expanded on the client when used with -REMOTE.
  3. -REMOTE END identifies the end of the command stream to be executed on the server.

Execute MARGIN and provide the name of the target data source as an argument on the command line. For example, to obtain the margin report for the SALES data source, issue the following command at the FOCUS prompt:

EX MARGIN SALES

SALES is substituted for the Dialogue Manager variable &1 in the JOIN and TABLE commands, and the commands then execute on the server. The resulting report is returned by the server and displayed in Hot Screen on your terminal.

Syntax: How to Execute Remote Procedures in Remote Execution Mode

In addition to making data available to the client, a server can also hold remote or stored procedures that can be executed from FOCUS.

To execute a procedure that resides on the server, use the following syntax:

>> REMOTE EX focexec

where:

focexec

Is a FOCEXEC on the client that contains a command that executes a procedure on the server.

Example: Executing a Remote Procedure in Remote Execution Mode

FOCEXECL resides on the client, and FOCEXECS resides on the server.

FOCEXECL contains the following command:

EX FOCEXECS

To execute FOCEXECS, issue the following command:

REMOTE EX FOCEXECL

Another way to do this is to issue the following commands:

-REMOTE BEGIN
EX FOCEXECS
-REMOTE END

Example: Using -INCLUDE to Call a FOCEXEC Stored on the Client

You can use the -INCLUDE command in a FOCEXEC to call another FOCEXEC stored on the client.

This example downloads data from a host to a FOCUS Client and updates the EMP data source.

-REMOTE BEGIN
TABLE FILE EMPLOYEE
 PRINT EMP_ID SALARY START_DATE
 ON TABLE HOLD AT CLIENT AS LD
END
-REMOTE END
-INCLUDE FOCEXECL

FOCEXECL contains the following commands:

MODIFY FILE EMP
 FIXFORM FROM LD
 DATA ON LD
END

Note: If you use remote execution to execute a FOCEXEC on the server that uses a -INCLUDE command, the FOCEXEC named must reside on the server and the -INCLUDE command must precede the -REMOTE END command.

Viewing a System or Error Message

How to:

All FOCUS and system messages returned by the server are displayed, as are error messages resulting from remote execution.

FOCUS places the error message numbers in the Dialogue Manager variable &FOCERRNUM, which can then be tested in FOCEXECs.

Syntax: How to Display a System or Error Message

? nnnn

where:

nnnn

Is the error message number.

Terminating the Remote Session: REMOTE FIN

How to:

The REMOTE FIN command logically terminates a FOCUS session with a server. It should be issued at the conclusion of remote data access. The server must be available when you issue this command.

Note: Issuing a FIN command in native FOCUS closes all active sessions.

Syntax: How to Terminate a Remote Session With the REMOTE FIN Command

REMOTE FIN server

where:

server

Must match the server name in the configuration file.

Querying Remote Session Parameter Settings: ? REMOTE

How to:

The ? REMOTE command displays all remote session parameters in effect. Issue it at any time in your FOCUS session.

Syntax: How to Query Remote Session Parameter Settings

? REMOTE

The output is:

Remote Destination   --> IBIEDA
Remote User ID       --> USER1
Remote User Password --> ........
Conversations exist with :
  IBIEDA (EDA5.2)

Information Builders