Special Command Tags
[WDX] Direct Action to Client Machine
   
Formats
1. Execute: EXECUTE "[WDX]statement"
2. Invoke: INVOKE "[WDX]statement"
3. Call Subprogram: CALL "[WDX]subprog",params
4. Open File: OPEN (chan[,fileopt])"[WDX]filename"
5. Open COM Port: OPEN (chan,OPT=settings$)"[WDX]port_id"
6. Open Tag Process: OPEN (chan[,fileopt])"[WDX][tag]prog;[params]"
7. OPEN Print Devices: OPEN (chan[,fileopt])"[WDX]*device*[;Q_name[;Q_options]]"
8. Create Object: NEW("[WDX]ClassName")
9. Define Windows Object: DEF OBJECT com_id,"[WDX]objname"
10.Call *WindX.utl: CALL "[WDX]*WindX.utl;function",params

Where:  

  [WDX] File tag notifies ProvideX that you are directing the action to the WindX client machine instead of the server.
   
  chan Channel or logical file number to open.
   
  class$ Name of class for creating new object. String expression.
   
  com_id Numeric variable to receive a handle (memory pointer to object).
   
  *device* Identifier and parameters for either of the two [WDX]-supported
  Q_name special device files (*WINDEV* or *WINPRT*). See *WINDEV* Raw
  Q_options Print Mode, and *WINPRT* Windows Printing
   
  filename Name of the file to open (file must exist on the client PC); e.g.,
    OPEN (14)"[WDX]"+TMP$ or
    OPEN (14)"[WDX]temp_file"
   
  function A ProvideX utility/function, part of the *WindX.utl utility program. For instance, the *WindX.utl;Spawn function initiates tasks on the server and/or client.
   
  fileopt File options. Supported options include:
    BSZ=num Block size
ERR=stmtref Error transfer
IOL=iolref Default IOList
ISZ=num Open file in binary mode
NBF=num Dedicated number of buffers
OPT=char$ File open options
ISZ=num Open file in binary mode
NBF=num Dedicated number of buffers
OPT=char$ File open options
REC=string$ Record prefix (REC=VIS(string$) can also be used).
     
  objname$ Name by which the COM object is registered in the Windows system registry subkey HKEY_CLASSES_ROOT.
  params Arguments and variables you pass to the subprogram or function. If you include a list, it's comma-separated.
   
  port_id System identifier for the port; e.g., COM1.
   prog;function
Parameters for the [tag]. For instance, for [DDE] to export to Excel, you can open a worksheet using either,
"[WDX][DDE]EXCEL;existing_worksheet.WK1" or

"[WDX][DDE]EXCEL;"

In the first example, where a spreadsheet name is included, it must exist on the client PC.
   
  tag ProvideX special command file tag. (All are listed in this chapter);
e.g., [DDE], [DLL], etc.
   
  settings$ Serial device's attributes (baud rate, etc.). String expression.
   
  statement Command supported by ProvideX (some are not) for use with EXECUTE or INVOKE + the [WDX] tag in WindX. String expression.
   
  subprog Subprogram for the CALL directive.


*Note* This feature requires WindX activation.


   
Description The [WDX] tag is used as a prefix to perform an action on a remote client machine (if your given command could be used on either client or server, and if the command supports using [WDX]). The [WDX] tag can only be used in specialty commands when running under WindX.
WindX supports the use of the following commands via the [WDX] tag: SERIAL, KEYED, DIRECT, SORT, PROGRAM, DIRECTORY, REFILE, LOCK, UNLOCK, MNEMONIC and ERASE.


*Note* If you are running an earlier version of ProvideX on a WindX PC, you must encapsulate these commands in an EXECUTE "[WDX]..."or design your applications to run on the remote site. Note also, the DIR= option and the PURGE, FILE and INDEXED directives are not supported by WindX and must be encapsulated in an EXECUTE etc.


  To Detect WindX

To detect whether or not you're actually working on a WindX PC in Command mode, look for the special prompt -} ... i.e., a hyphen with curly brace. In your applications, a test for one of the following indicators will tell you that your session is running under WindX:

DEC(MID(MSE, 22,1))>0
TCB(88)<>0

For more information, refer to the TCB( ) Function, and the MSE System Variable.

You can create a global variable in your WindX setup, and use it later to test for the presence of a WindX client PC connection; then, if WindX is running the session, you can use the [WDX] tag. In the following example, the user-defined variable %WDX below is only set when WindX is running, otherwise its value is null:

IF MID(MSE,22,1)>$00$ AND MID(MSE,22,1)<$FF$
 
      THEN %WDX$="[WDX]"

Use such a global variable in a statement like OPEN(30)%WDX$+"*WINPRT*" to bypass an Error#12:Filedoesnotexist(oralreadyexists) when WindX isn't running.

How ProvideX Detects WindX

ProvideX uses terminal type to detect a WindX session. In UNIX, ProvideX recognizes two terminal types as potential WindX stations (TERM="winterm" for the WindX client PC and TERM="ansi"). Since most UNIX systems and applications can't recognize or use the wintermtype, the ProvideX ansi device driver sends a special escape sequence to a terminal to test for a WindX client. If the terminal is a WindX PC, a special response is generated. If no response is generated before a time-out occurs, ProvideX assumes the device is ansi.

GUI Requests

Once the ProvideX session on the server recognizes the terminal as a WindX station, it changes the internal settings to allow graphical requests to be routed correctly. (Then, graphical requests are automatically tokenized and forwarded to WindX for processing. That is, you do not need the [WDX] tag.)

For instance, a server command to print a picture in a UNIX environment would automatically be sent to WindX for the client. ProvideX transmits standard mnemonics to WindX as an escape ($1B$) followed by the mnemonic in native form. Traffic from the host/server is minimized because the WindX client's ProvideX interpreter handles a lot of the functionality locally (on the client) for screen refreshing and graphical requests.

In WindX, your instruction to print is sent to the client, bundled as is. When you use mnemonics and/or graphics like .bmp’s, they must exist on the client or be accessible to the client. The following example uses a 'PICTURE' that is defined and shared on a common Windows server instead of being stored on each individual client machine: print 'picture'(10,10,10,10),"\\serv_name\driveshare\your_bmps\that.bmp"

   
Formats 1 & 2 Initiate Remote Command EXECUTE "[WDX]statement" INVOKE "[WDX]statement"
Use the EXECUTE and INVOKE formats with the [WDX] tag to process commands on the WindX PC (remote client). Common applications of the EXECUTE format would be: changing the client's local directory, setting system parameters, or altering the prefix and in file creation.


*Warning* When you use theEXECUTE and INVOKE directives from your server to initiate action remotely on a client, the client PC might be running a ProvideX activation with a different set of syntax tables. As a result, your MNEMONICs might be invalid.


  The following example illustrates the use of an EXECUTE "[WDX]statement" in an application on the host/server to define a MNEMONIC directive locally on the WindX client:

IF WDX% <> $00$
 
  THEN EXECUTE "[WDX]MNEMONIC(LFO)'5X'=$1B+hex$"
 
  ELSE GOTO MY_LABEL

The following example sets the 'B0' System Parameter, on a WindX PC using a [WDX] command from a UNIX host:

EXECUTE "[wdx]SET_PARAM 'B0'"



*Note* If you run your application with ‘B0' set, make sure that it is set on both the host and the WindX PC. Otherwise, the wrong windows will be addressed. (You can set 'B0' either by executing it from the host, as in the example, or by using -B0 as an argument on the WindX PC's startup command line.


   
Format 3 Call Subprogram

CALL "[WDX]subprog",params

This format enables the server to CALL a subprogram that exists and runs remotely on the client. It is true distributed processing. The server's files and global variables are not accessible to your subprogram. Your remote call passes parameters back and forth, not data files. You can pass a maximum of 20 parameters/arguments, in a comma-separated list.

For example, you can call applications like special printer device drivers you have built on the client to handle print mnemonics:

CALL "[WDX]*dev/your_driver_name"

You can use a similar format to call the ProvideX *WindX.utl (utility) functions. For further information, see format 10 [WDX] and *WindX.utl,
[WDX]*WINDEV* Escape Sequences:.

   
Format 4 & 5 Open Files, Serial Ports on Client

OPEN (chan[,fileopt])"[WDX]filename"
OPEN (chan,OPT=settings$)"[WDX]port_id"

Use this format in programs running on your server when you're opening remote files or ports. That is, using [WDX] as a prefix to the pathname of your file (or port, etc.) tells WindX to open it remotely on the client. WindX automatically forwards requests (i.e., file I/O directives) for processing.
 



*Reminder* When you need a statement that is not supported on a WindX PC, encapsulate your commands in an EXECUTE "[WDX]..." directive or design your applications to run remotely on the client.


  Examples:

The following example opens a remote file,

OPEN (1)"[WDX]CLIENT_PATH\CLIENT_FILE"

Use a similar format to open a COM port for direct access to a serial device (e.g., ,a serial printer or weigh scale) on the client PC without going through a spooler,

LET SETTING$="9600,n,8,1,x"
OPEN (5,OPT=SETTING$)"[WDX]COM2"
or
OPEN (5,OPT="9600,n,8,1,x",ERR=OOPS)"[WDX]COM2"

   
Format 6 [WDX] with Other Tags

OPEN (chan[,fileopt])"[WDX][tag]prog;[params]"

[WDX] can be used in conjunction with other file tags; e.g.,

0010 OPEN (1)"[WDX][DDE]excel;existing_worksheet.wk1"

   
Format 7 Windows Print Subsystem on Client

OPEN [INPUT] (chan[,fileopt])"[WDX]*device*[;Q_name[;Q_options]]"

ProvideX opens the special device files *WINPRT* and *WINDEV* on the PC/server which issues the command. Except in UNIX (where it's done automatically), use [WDX] with OPEN [INPUT] directives for the two specialty files to direct any print jobs and dialogues to the WindX client PC, which will in turn use its Windows print subsystem API to deal with the jobs and send them to the given printer; e.g.,

OPEN (7,ERR=1500)"[WDX]*WINPRT*"

With a WindX client and an NT Server, if you do not use [WDX] in your OPEN directive, then the printer selection dialogue will appear on the server console, and any print queue you name directly must exist on the NT server in the Control Panel printers folder.

See also [WDX]*WINDEV* Escape Sequences:, *WINDEV* Raw Print Mode, and *WINPRT* Windows Printing.

   
Formats 8 & 9 Remote Object Support

NEW("[WDX]ClassName")
DEF OBJECT com_id,"[WDX]objname"

The [WDX] tag can be used to create OOP/COM objects and manipulate them across a WindX connection as if they existed locally.

Methods can be passed arguments and receive results; however, only the result of a method will be returned across a remote connection. Any changes to the arguments of a method by the remote object will not be returned across the connection. Arguments are therefore considered to be passed by value only. If you need to retrieve arguments as well as the result, you must place your code in a program on the WindX workstation and interact with that code.

Event handling is not supported across a remote connection. Event mapping must occur within the remote object. The remote object will not have access to any server resources. At most, the remote event could pass a CTL back to the local server for action. It is recommended that objects requiring event processing exist completely on the remote and interact only with the local WindX session on the remote.

   
Format 10 [WDX] and *WindX.utl

CALL "[WDX]*WindX.utl;function",params

Use this format to call ProvideX utilities/functions in the WindX.utl utility program; e.g.,

call "[wdx]*windx.utl;Get_LWD",Station_dir$
call "*windx.utl;spawn",cmdline$,inifile$,appfid$

The following functions are built into WindX to simplify development tasks:

CALL"[WDX]*WindX.utl;Get_Addr",X$ Returns the command line argument number specified by X in X$.
CALL"[WDX]*WindX.utl;Get_LPG",X$ Returns the LPG (Lead Program Name) system value for the WindX session.
CALL"[WDX]*WindX.utl;Get_LWD",X$ Returns the local current disk directory (Last Working Directory) for WindX session.
CALL"*WindX.utl;Spawn",X$,I$,F$
(see note below)
Spawns a new session of ProvideX on the host and an associated WindX session on the client PC. By default, if the main session terminates, then the spawned session terminates. The parameters are:
X$ command line parameters to be used on the host.
I$ pathname of INI file to be used on the client PC.
F$ value of FID(0)for the session.
CALL"*WindX.utl;Spawn_Nohup",X$,I$,F$
(see note below)
Same as Spawn but detaches the session from the main user task. If the main task terminates, then the spawned task continues executing.
CALL"[WDX]*WindX.utl;Get_WindX",X$ Returns the absolute pathname of the WindX program.
CALL"[WDX]*WindX.utl;Get_NewPort",X Returns the port number of an unused TCP/IP port on the WindX station.
CALL"[WDX]*WindX.utl;Get_TCB",X Returns the value of the TCB function task specified by X in X; i.e., X=TCB(X).
CALL"[WDX]*WindX.utl;Get_Val",X$,Y$ Evaluates/returns value of string expression X$ in Y$; i.e., Y$=EVS(X$).
CALL"[WDX]*WindX.utl;Get_Num",X$,Y Evaluates/returns value of numeric expression X$ in Y (i.e., Y=EVN(X$).


*Note* Call to *Windx.utl;spawn and *Windx.utl;Spawn_Nohup should not have the [WDX] prefix in front as they are performed locally.