# Application Server

Session Spawning |

The PxPlus Application Server also includes a component, *SERVER, that can be run on the server to programmatically establish a new independent session of PxPlus within which another application may be run. This is commonly referred to as spawning a new session.

The *SERVER program takes information from the current session of PxPlus regarding the Application Server and information from the programmer about what to run. It launches a new instance of PxPlus on the server using the credentials of the user from the current session, while also forcing the client's workstation to start a new instance of the client software.

The *SERVER program generates a session ticket for the Application Server and informs both the new server-side process and the client-side process about the session. At this point, the new server- and client-side processes connect to the Application Server and begin a new independent session. This session will be running the application with the characteristics for which the programmer coded within the CALL list of the *SERVER program.

The session of PxPlus which is issuing the CALL to the *SERVER;SPAWN command must itself be an Application Server-connected session from either a *CLIENT or previous *SERVER;SPAWN.

The *SERVER program has two line label entry points:

| Launch | An internal entry point used by newly invoked processes on the server.
| Spawn | An entry point used by programmers to spawn new independent sessions of PxPlus and the applicable client on the workstation.

Command Line Syntax

> CALL "*SERVER;SPAWN",LeadPrg$,AppName$,StartInDir$,ServINI$,ClientINI$, ClientsState$, ExCMDOpts$,Args$,FIDVal$,NoHup$

Where:

LeadPrg$ | Either null, indicating a console session, or a valid pathname to a PxPlus program.
AppName$ | Either null, or a descriptive name to appear in the configurator's session listing.
StartInDir$ | Either null, indicating the current directory, or a specific directory where the server-side process is to start.
ServINI$ | Either null, or a valid pathname to an INI on the server to use for this new session. If it is null, then the INI used for the new PxPlus session on the server will be the same as that for the current session.
ClientINI$ | (WindX Clients Only) Either null, in which case the WindX client will launch a new instance using the same INI it is currently using, or a valid pathname to an INI on the client PC for the new WindX process to use.
ClientsState$ | Allows you to control the initial viewing state of the new process on the client. This is a string of one-character options:
H | Hide initial dialogue.
M | Minimize initial dialogue.
N | Show new process dialogue in the "Normal" state.
X | Maximize new process dialogue (currently not implemented).
ExCMDOpts$ | Extra Command line options for server-side process, whereby you can request additional Command line options for the server-side process. (May be null if no arguments are required.) Example: "-XT=1" or "XT=0 -NE=1" Extra Command line options are supplied to the server-side process after the program name but before any –ARG values. Example: ServSideCommand LeadProgram$ ExCmdOpts$ -ARG …
Args$ | Additional Command line arguments for the server-side process, whereby you can request Command line arguments for the server-side process. (May be null if no arguments are required.) Embedded quotes should be used as necessary. Extra Command line arguments are supplied to the server-side process as –ARG values. Example: ServSideCommand LeadProgram$ -ARG Args$
FIDVal$ | The FID(0) value requested. If this value is null, then the newly spawned session will have the same FID(0) value as the current session. The maximum FID(0) value is 12 characters.
NoHup$ | (UNIX/Linux Only) Allows you to decide whether the newly spawned session is to be started using Nohup or not. The use of Nohup determines if a process is to remain attached (or not) to the process that spawned it, and if it is attached, then the child process will terminate when the session the parent is running has terminated. This is a one-character string option:
"" (null) | Use the settings in the Application Server to determine if the sessions are Nohup'd or not.
"Y" | Force the session to be Nohup'd.
"N" | Force the session to remain connected to the parent process (not Nohup'd).

Additional Notes about Spawning

The newly spawned session will be spawned as the current user.

If the current session (the one doing the *SERVER;SPAWN) is SSL-connected, then the spawned session will also be SSL-connected.

Access to PxPlus console mode for *SERVER;SPAWN sessions is governed by the Application Server 's configuration. If the user was not allowed to access console mode in the Application Server configuration, then he/she will not be allowed to access it via a spawn.

The full parameter list on the CALL to *SERVER;SPAWNis not required.

> Examples:

> CALL "*server;spawn" Spawns new console session
> CALL "*server;spawn","**" Spawns new session running PxPlus utilities

All text and messages used by *SERVER are stored in the *APPSERV/APSMESG.EN message library. EN can be changed to another language suffix.

%APS is an object identifier that has information available to the session about its characteristics. To view the list of session properties, PRINT %APS'*. The recommendation is that you never set any of these object properties or use any of its functions. Doing so may make the current session unable to spawn new sessions. See Session Object Properties.