Previous Page | Next Page

Syntax for the RSUBMIT Statement and Command

%SYSLPUT Statement



Creates a macro variable in the server session.
Valid In: client session

Syntax
Syntax Description
Example 1: %SYSLPUT
Example 2: %SYSLPUT
Example 3: %SYSLPUT

Syntax

%SYSLPUT macro-variable=value </REMOTE=server-ID>;

Syntax Description

macro-variable

specifies the name of a macro variable to be created in the server session.

value

specifies the macro variable reference, a macro invocation, or the character value to be assigned to the server macro-variable. The character value should not contain nested quotation marks.

/REMOTE=server-ID

specifies the name of the server session that the macro variable will be created in. If only one server session is active, the server-ID can be omitted. If multiple server sessions are active, omitting this option causes the macro to be created in the most recently accessed server session. You can find out which server session is currently active by examining the value that is assigned to the CONNECTREMOTE system option.

The /REMOTE= option that is specified with the %SYSLPUT macro statement overrides the CONNECTREMOTE= system option.

See Also: CONNECTREMOTE= System Option

Details

The %SYSLPUT statement is a macro statement that is submitted in the client session to assign a value that is available in the client session to a macro variable that can be accessed from the server session. If you are signed on to multiple server sessions, %SYSLPUT submits the macro assignment statement to the most recently used server session. If you are signed on to only one server session, %SYSLPUT submits the macro assignment statement to that server session. If you are not signed on to any session, an error condition results.

Like the %LET statement, the %SYSLPUT statement assigns a value to a macro variable. Unlike %LET, the %SYSRPUT statement assigns a value to a variable in the server session rather than in the client session where the statement is executed. The %SYSRPUT statement stores the macro variable in the Global Symbol Table in the server session.


Example 1: %SYSLPUT

This example sets the macro variable FLAG to 1 in the current server session.

%syslput flag=1;


Example 2: %SYSLPUT

%SYSLPUT enables you to dynamically assign values to variables that are used by macros that are executed in a server session. The macro statement %SYSLPUT is used to create the macro variable REMID in the server session and to use the value of the client macro variable RUNID. The REMID variable is used by the %DOLIB macro, which is executed in a server session, to find out which operating system-specific library assignment should be used in the server session.

Using %SYSLPUT To Find Out Which Libraries Can be Used in the Server Session

%macro assignlib (runid);

   signon rem&runid;
   %syslput remid=&runid;
   rsubmit rem&runid;
      %macro dolib;
         %if (&remid eq 1) %then %do;
            libname mylib 'h:';
            %end;
         %else %if (&remid eq 2) %then %do;
            libname mylib '/afs/some/unix/path';
            %end;
      %mend;
      %dolib;
   endrsubmit;

%mend;


Example 3: %SYSLPUT

The optional /REMOTE option in the %SYSLPUT statement requires that any value that contains forward slashes should be quoted using the %BQUOTE macro function. The %BQUOTE function masks a character value or a resolved value of a text expression during execution of a macro or macro language statement.

This example uses the %BQUOTE function to mask forward slashes that are used in a UNIX pathname that is assigned using the %SYSLPUT statement.

Using %BQUOTE To Mask Character Values That Are Used in a %SYSLPUT Statement

  2? %let pathineed=/abc/xyz;
  3? %syslput pathineed=%bquote(&pathineed);
  4? rsubmit;

NOTE: Remote submit to computer commencing.

  5? %put &pathineed
  5? endrsubmit;

1    %put &pathineed
/abc/xyz
NOTE: Remote submit to computer complete.

Previous Page | Next Page | Top of Page