# RPC Remote Process Control

> Source: https://manual.pvxplus.com/command-tags/rpc

## Formats

|  |  |
| --- | --- |
| 1\. [Call Remote Subprogram](https://manual.pvxplus.com/command-tags/rpc#Mark4)*:* | **CALL** "\[RPC:*server*\]*subprog*\[;*entry*\]**"**\[,**ERR**=*stmtref*\]\[,*arglist*\] |
| 2\. [Open Remote File](https://manual.pvxplus.com/command-tags/rpc#Mark7)*:* | **OPEN** (*chan*\[,*fileopt*\])"\[RPC:*server*\]*filename*" |

***Where***:

|  |  |
| --- | --- |
| **\[RPC:*server*\]** | RPC clause that initiates the remote **CALL**.*server* is the logical server name. |
| *chan* | Channel or logical file number to open. |
| *;entry* | *(Optional)* Entry point label. If you include a label, precede it with a **;** *(semi-colon)* and append it to your subprogram name. |
| *filename* | Name of the file to open prefixed by **\[RPC:*server*\]**. Use a string literal as in: OPEN (14)"\[RPC:server\]my_file". |
| *fileopt* | File options. Supported options include:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| **BSZ**=*num* \| Block size \|<br>\| **ERR**=*stmtref* \| Error transfer \|<br>\| **IOL**=*iolref* \| Default IOList \|<br>\| **ISZ**=*num* \| Open file in binary mode \|<br>\| **NBF**=*num* \| Dedicated number of buffers \|<br>\| **OPT**=*char$* \| File open options \|<br>\| **REC**=*string$* \| Record prefix (**REC=VIS**(*string$*) can also be used) \| |
| *arglist* | *(Optional)* One or more arguments (comma-separated if you include a list *arg,arg*...) to pass to the subprogram. |
| *server* | Name to be associated with a program server. Established using the [PROCESS SERVER](https://manual.pvxplus.com/directives/process-server) directive. |
| *stmtref* | Program line number or statement label to which to transfer control. |

## Description

The **\[RPC\]** tag is used as a prefix to denote that PxPlus is to CALL a subprogram or open a file that resides on a remote server. Before a remote process control can be initiated, the server must be identified and the *server* name established via the [PROCESS SERVER](https://manual.pvxplus.com/directives/process-server) directive.

Note:  
This feature requires *PxPlus RPC* activation.

## Format 1

***Call Remote Subprogram***

CALL "\[RPC:*server*\]*subprog*\[;*entry*\]**"**\[**,ERR**=*stmtref*\]\[,*arglist*\],*varlist*

The RPC CALL format tells PxPlus that your subprogram is to run (and that your data resides) on a different processor on the network; i.e. on a remote server. Use the same syntax as you would for a standard **[CALL](https://manual.pvxplus.com/directives/call)** directive, except that a **\[RPC:*server*\]** clause designates a remote server to handle the CALL. Since no data is transferred during RPC CALL processing, this helps maximize both network performance and data security.

***Transparent RPC Process***

At run time, PxPlus does not transfer data files or programs across the network for your RPC CALL. Instead, PxPlus puts your called remote subprogram name and parameters into a TCP/IP data packet and sends the packet to your remote server. The remote server loads and runs your subprogram, passing it your parameters. When your subprogram exits, the remote server puts your parameters (as altered by your subprogram) into a TCP/IP response packet and sends this back to the calling program.

Note:  
Since PxPlus RPC processing is true distributed processing handled as a transparent background process, any displays during subprogram processing will appear on the remote server. *Do not* attempt to display subprogram activity on the calling machine.

## Format 2

***Open Remote File***

OPEN (*chan*\[,*fileopt*\])"\[RPC:*server*\]*filename*"

PxPlus supports the **[OPEN](https://manual.pvxplus.com/directives/open)** directive for remote files. Prefix your filename with the **\[RPC:*server*\]** clause to indicate that the server is to handle file requests.

## See Also

[PROCESS SERVER Establish Remote Server](https://manual.pvxplus.com/directives/process-server)  
[OPEN Open a File for Processing](https://manual.pvxplus.com/directives/open)
