July 22, 1996 - Version 2
This document represents the second release of the PicLan / Visual Basic interface library.
The PicLan VB SDK consists of this documentation along with a number of files documented below. These files are targetted for Visual Basic version 4.0 and will run in either 16-bit or 32-bit mode.
The PicLan VB SDK is usable in several modes. For "object oriented" programming a "Plan" class is available (either in-place or through an OLE server) providing access to PicLan functions. For a more traditional approach, a standard function-call based interface is available as well.
The software that is described herein is bound by the PicLan end-user license agreement which was included with your copy of PicLan. In addition, the following disclosures are made:
THIS SOFTWARE IS NOT SOLD, BUT INSTEAD PROVIDED AT NO CHARGE FOR THE BENEFIT OF THIRD-PARTY DEVELOPERS. NO WARRANTY OF ANY KIND IS MADE REGARDING ITS OPERATION. ITS SELECTION AND USE IS ENTIRELY THE RESPONSIBILITY OF THE END-USER.
This software describes the operation of PicLan VB SDK when used in conjunction with PicLan version 2.0.0.0. PicLan versions prior to 2.0.0.0 may not support all functions within PLAN.BAS.
MODULAR SOFTWARE DOES NOT PROVIDE TECHNICAL SUPPORT FOR THIS PROGRAMMING LIBRARY. IF YOU ARE NOT A VISUAL BASIC PROGRAMMER WITH EXPERIENCE INTERFACING WITH THIRD-PARTY LIBRARIES, THEN THIS SDK IS NOT INTENDED FOR YOU.
a) email support@modsoft.com on the internet.
b) fax Modular Software and (949) 831-6860
be sure to include your return email or fax telephone number. Not all bug reports will be individually answered. Try to include as much detailed information about the bug that you are encountering as possible.
Function AllocHandle(ByVal plcbs As Integer) As IntegerAllocate a raw connection handle for subsequent use with Conn class Plan functions.
Property Let BusyFlg(ByVal val As Integer)Sets the value of "busy flag".
Property Get ClientsCnt(ByVal Idx As Integer) As IntegerQueries the number of PLCBs allocated to a particular PicLan client handle.
Property Get ClientsStart(ByVal Idx As Integer) As IntegerQueries the starting PLCB number allocate to a particular PicLan client handle.
Property Get ConfigDriverTp() As StringRetrieves the type of network driver that PicLan is using.
Property Get ConfigName() As StringRetrieves the user name from the PL-CFG.INI file.
Property Get ConfigNet() As StringRetrieves the IPX network number for this computer system.
Property Get ConfigNode() As StringRetrieves the IPX node address for this computer system.
Property Get ConfigPingTime() As IntegerRetrieves the "Ping Delay" timeout value in milliseconds.
Property Get ConfigSocket() As StringRetrieves the IPX socket number for this computer system.
Property Get ConfigTimeout() As IntegerRetrieves the packet retry timeout value in milliseconds.
Property Get ConfigVersion() As StringRetrieves the PicLan driver version.
Property Get ConfigXOFFTime() As IntegerRetrieves the "Auto XOFF" delay time value in milliseconds.
Sub ConnBreak(ByVal PNo As Integer)Sends a "break" signal over a network connection.
Function ConnClose(ByVal PNo As Integer) As IntegerCloses an open connection and deallocates it's PLCB (PicLan Control Block).
Function ConnOpen(ByVal handle As Integer, ByVal name As String, ByVal Tp As Integer, ByVal HostPort As Integer, ByVal LocalPort As Integer, ConnPort As Integer) As IntegerOpens a raw network connection.
Function ConnRead(ByVal PNo As Integer, s As String) As IntegerReads from a raw network connection.
Function ConnWrite(ByVal PNo As Integer, ByVal s As String) As IntegerWrites to a raw network connection.
Function ConnWriteBlock(ByVal PNo As Integer, ByVal s As String) As IntegerThis is a blocking version of ConnWrite(...) that will write the entire contents of "s" even if this requires waiting for network traffic.
Sub ConnXoff(ByVal PNo As Integer)This function will flow control a channel preventing terminal output from being generated at the Pick host. The use of ConnXoff() is optional. You can also just stop reading data and the Pick host system will not be adversly effected.
Sub ConnXon(ByVal PNo As Integer)This funcion will restart flow control thus allowing terminal output at the Pick host. It is used to reverse the effects of ConnXoff().
Function ConvAMtoCRLF(s As String) As StringReplaces AM characters with CRLF sequences.
Function ConvCRLFtoAM(s As String, Residual As String) As StringReplaces CRLF sequences with AM characters.
Function ConvBinToHex(s As String) As StringConverts binary data into a hex string
Function ConvHexToBin(s As String, Residual As String) As StringConverts a hex string into binary data
Function ConvBinToPick(s As String) As StringConverts binary data into Pick storable data
Function ConvPickToBin(s As String, Residual As String) As StringConverts Pick storable data into binary data.
The following character sequences are replaced with single characters.
Function ConvDateToPick(ByVal d As Variant) As StringConverts a VB format date variable into a Pick format date number
Function ConvPickToDate(ByVal s As String) As VariantConverts a Pick format date number into a VB format date variable.
Function ConvStrip(s As String) As StringConverts high order ascii characters into Chr$(127) characters for storage under Pick.
Function Count(s As String, ByVal c As String)Counts the number of occurances of "c" within "s".
Function DCount(s As String, ByVal c As String)Counts the number of fields delimited by "c" within "s"
Sub DeallocHandle(ByVal handle As Integer)Returns a handle allocated with AllocHandle() as frees it's resources. Handle resources are automatically freed when the class is destroyed.
Function DynDelete(s As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDynamic array DELETE function.
The 16-bit version of DynDelete uses Integer parameters instead of Long parameters.
Function DynExtract(s As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDynamic array EXTRACT function.
The 16-bit version of DynExtract uses Integer parameters instead of Long parameters.
Function DynReplace(s As String, ByVal a As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDynamic array REPLACE function.
The 16-bit version of DynReplace uses Integer parameters instead of Long parameters.
Function FileClose(ByVal FNo As Integer) As IntegerClose a Pick file or RPC connection previously opened with FileOpen().
Function FileOpen(ByVal svr As String, ByVal acct As String, ByVal File As String) As IntegerOpen a Pick file or RPC connection.
Sub GetClients()Refreshes the internal contents of the client array. You should call this function to get new data with the ClientsCnt() and ClientsStart() functions.
Function GetServers(name As String) As IntegerQueries the network for active PicLan servers.
Property Let HostCnt(ByVal val As Integer)Sets the maximum number of Pick host systems that FileOpen() can communicate with.
Function ItemDelete(ByVal FNo As Integer, ByVal ID As String) As IntegerDeletes an item from an open Pick file.
Function ItemRead(ByVal FNo As Integer, ByVal ID As String, d As String) As IntegerReads an item from an open Pick file.
Function ItemReadA(ByVal FNo As Integer, ByVal ID As String, d() As String) As IntegerReads an item from an open Pick file as an "array string"
Function ItemReadNext(ByVal SNo As Integer, ByVal cnt As Integer, d As String) As IntegerPerforms a Pick BASIC READNEXT series of statements for a select handle opened with SelectOpen().
Function ItemReadv(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, d As String) As IntegerReads an attribute from an open Pick file.
Function ItemReadu(ByVal FNo As Integer, ByVal ID As String, d As String) As IntegerReads an item from an open Pick file setting a Pick lock.
Function ItemReadvu(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, d As String) As IntegerReads an attribute from an open Pick file setting a Pick lock.
Function ItemRelease(ByVal FNo As Integer, ByVal ID As String) As IntegerReleases a Pick lock for a single item.
Function ItemReleaseAll(ByVal FNo As Integer) As IntegerReleases all Pick locks associated with the connection.
Function ItemWrite(ByVal FNo As Integer, ByVal ID As String, ByVal d As String) As IntegerWrite an item on an open Pick file.
Function ItemWriteA(ByVal FNo As Integer, ByVal ID As String, d() As String) As IntegerWrite an item on an open Pick file using a string array.
Function ItemWriteu(ByVal FNo As Integer, ByVal ID As String, ByVal d As String) As IntegerWrite an item on an open Pick file retaining any previously set lock.
Function ItemWritev(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, ByVal d As String) As IntegerWrite an attribute on an open Pick file.
Function ItemWritevu(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, ByVal d As String) As IntegerWrite an attribute on an open Pick file retaining any previously set lock.
Property Let LongTimeout(ByVal val As Double)Sets the long timeout value for PicLan transactions.
Function RPC(ByVal FNo As Integer, ByVal Cmd As String, p1 As String, d As String) As IntegerCalls a Pick BASIC subroutine cataloged on the Pick host system.
Function SelectClose(ByVal SNo As Integer) As IntegerCloses a previously opened select handle.
Function SelectOpen(ByVal FNo As Integer) As IntegerOpen a select handle for a previously opened Pick file.
Property Get ServersCap(ByVal Idx As Integer) As IntegerQueries the capabilities of a PicLan server.
Property Get ServersImm(ByVal Idx As Integer) As StringQueries the immediate address of a PicLan server.
Property Get ServersName(ByVal Idx As Integer) As StringQueries the name of a PicLan server.
Property Get ServersNet(ByVal Idx As Integer) As StringQueries the network number of a PicLan server.
Property Get ServersNode(ByVal Idx As Integer) As StringQueries the node address of a PicLan server.
Property Get ServersSn(ByVal Idx As Integer) As LongQueries the PicLan serial number of a PicLan server.
Property Get ServersSocket(ByVal Idx As Integer) As StringQueries the socket address of a PicLan server.
Property Get ServersVer(ByVal Idx As Integer) As StringQueries the PicLan version number of a PicLan server.
Property Let ShortTimeout(ByVal val As Double)Sets the short timeout value for PicLan transactions.
Sub StrArrayAMtoCRLF(d() As String)Converts AM characters to CRLF characters in-place in a string array.
Sub StrArrayCRLFtoAM(d() As String, Residual As String)Converts CRLF characters to AM characters in-place in a string array.
Sub StrArrayBinToHex(d() As String)Converts binary data to hex data in-place in a string array.
Sub StrArrayHexToBin(d() As String, Residual As String)Converts hex data to binary data in-place in a string array.
Sub StrArrayBinToPick(d() As String)Converts binary data into Pick compatible data. See ConvBinToPick() for more details.
Sub StrArrayPickToBin(d() As String, Residual As String)Converts Pick compatible data into binary data. See ConvPickToBin() for more details.
Sub StrArrayStrip(d() As String)Strips non Pick compatible data from a string array and replaces those characters with Chr$(127). See ConvStrip() for more details.
Function StrArrayLen(d() As String) As LongReturns the total length of a string array.
Sub StrArrayGet(s() As String, d() As String, ByVal l As Long)Moves a specified number of characters from one string array to another.
Property Let Timeout(ByVal val As Double)Sets the standard timeout value for PicLan transactions.
These functions are called directly from the Plan class functions. The documentation for the PlanLib functions is still being prepared, so you should refer to the Plan class documentation and the source code for more details.
Public Function PL_AllocPlcb(ByVal handle As Integer, ByVal ibufs As Integer, ByVal obufs As Integer) As IntegerAllocates a PLCB from a pre-allocate PicLan client handle allocated with PL_InitMem().
Public Function PL_AMtoCRLF(s As String) As StringString conversion function to replace AM characters with CRLF sequences.
Public Sub PL_AMtoCRLFA(d() As String)String array conversion function to replace AM characters with CRLF sequences.
Public Function PL_BinToHex(s As String) As StringString conversion function to convert a binary string into a hex string.
Public Sub PL_BinToHexA(d() As String)String array conversion function to convert binary strings into hex string.
Public Function PL_BinToPick(s As String) As StringString conversion function to convert a binary string into a Pick compatible string.
Public Sub PL_BinToPickA(d() As String)String array conversion function to convert binary strings into Pick compatible strings.
Public Sub PL_Break(ByVal PNo As Integer)Sends a break signal over an open connection.
Public Function PL_Close(ByVal PNo As Integer) As IntegerCloses an open connection. You must repeatedly call this function until it return non-zero.
Public Function PL_CloseFile(ByVal FNo As Integer) As IntegerCloses an open Pick file or RPC connection.
Public Function PL_CloseSelect(ByVal SNo As Integer) As IntegerCloses an open Pick select handle.
Public Sub PL_CopyA(Src() As String, Dst() As String)Copies an array of strings.
Public Function PL_Count(s As String, ByVal c As String) As IntegerCounts the number of occurances of "c" withing "s". Equivelent to the Pick BASIC COUNT function.
Public Function PL_CRLFtoAM(ByVal s As String) As StringString conversion function that converts CRLF sequences into AM characters.
Public Function PL_CRLFtoAM2(s As String, Residual As String) As StringString conversion function that converts CRLF sequences into AM characters. Residual allows multiple string to be converted even where CRLF sequences are split between strings.
Public Sub PL_CRLFtoAM2A(d() As String, Residual As String)String array conversion function that converts CRLF sequences into AM characters. Residual allows multiple string arrays to be converted even where CRLF sequences are split between string arrays.
Public Function PL_DateToPick(ByVal d)Conversion function between Visual Basic date variable and Pick format date number.
Public Function PL_DCount(s As String, ByVal c As String) As IntegerCounts the number of fields in string "s" delimited by string "c". Equivelent to the Pick BASIC DCOUNT function.
Public Sub PL_DeallocPlcb(ByVal PNo)De-allocates and allocate PicLan Control Block (PLCB) allocated with PL_AllocPlcb(). You should close any connection before deallocating a PLCB.
Public Function PL_Delete(s As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDynamic array DELETE function.
Public Function PL_DeleteItem(ByVal FNo As Integer, ByVal ID As String) As IntegerDeletes an item from an open Pick file.
Public Function PL_ErrorStr(ByVal x As Integer) As StringConverts a negative number PicLan error code into a descriptive string.
Public Sub PL_Exit()Performs exit cleanup processing. Visual Basic applications should call this function during cleanup.
Public Function PL_Extract(s As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDynamic array EXTRACT function. The 16-bit version of this functions uses Integer values for a1, a2, and a3.
Public Function PL_FindServers(ByVal PNo As Integer, ByVal ServerName As String) As IntegerRetrieves PicLan servers.
Public Sub PL_GetA(s() As String, d() As String, ByVal l As Long)Copies l bytes from string array s() to string array d().
Public Sub PL_GetClient(ByVal Idx As Integer, result As PL_CLIENT_STRUCT)Retrieves information about a single PicLan client on this workstation.
Public Sub PL_GetClientArray(result() As PL_CLIENT_STRUCT)Retrieves information about all PicLan clients on this workstation.
Public Sub PL_GetConfig(cfg As PL_CONFIG_STRUCT)Retrieves PicLan driver configuration information.
Public Sub PL_GetServer(ByVal PNo As Integer, ByVal Idx As Integer, res As PL_SERVER_STRUCT)Retrieves information about a specific Piclan server queried with PL_FindServers().
Public Function PL_GetServerArray(ByVal PNo As Integer, ByVal ServerName As String, PssArray() As PL_SERVER_STRUCT) As IntegerRetrieves information about PicLan servers.
Public Function PL_HexToBin(s As String, Residual As String) As StringString conversion function that converts hex strings into binary strings. Residual allows multiple string to be converted even where hex sequences are split between strings.
Public Sub PL_HexToBinA(d() As String, Residual As String)String array conversion function that converts hex string array to binary string arrays. Residual allows multiple string arrays to be converted even where hex sequences are split between string arrays.
Public Function PL_Init(ByVal plcbs As Integer, ByVal bufs As Integer) As IntegerPicLan library initialization function. Call this function before using other PicLan functions setup setup global variables and allocate connection control blocks.
Public Function PL_InitMem(ByVal plcbs, ByVal bufs) As IntegerAllocates a raw PicLan handle for use with PicLan PL_Read(), PL_Write, etc. functions.
Public Function PL_LenA(d() As String) As LongReturns the total length of a string array.
Public Function PL_Open(ByVal PNo As Integer, SrcPSS As PL_SERVER_STRUCT, ByVal Tp As Integer, ByVal HostPort As Integer, ByVal LocalPort As Integer, ResPCS As PL_CONNECT_STRUCT) As IntegerOpens a raw connection to a PicLan host.
Public Function PL_OpenFile(ByVal svr As String, ByVal acct As String, ByVal File As String) As IntegerOpens a Pick data file. If "acct" is specified as "RPC", then an RPC connection is opened to the Pick host.
Public Function PL_OpenSelect(ByVal FNo As Integer) As IntegerOpen a Pick select. This is the same as the Pick BASIC SELECT FILE.VAR TO SELECT.VAR statement.
Public Function PL_PickToBin(s As String, Residual As String) As StringString conversion function that replaces quoted Pick sequences with binary characters. Residual allows multiple strings to be converted even where quotes sequences are split between strings.
Public Sub PL_PickToBinA(d() As String, Residual As String)String array conversion function that replaces quoted Pick sequences with binary characters. Residual allows multiple string arrays to be converted even where quoted sequences are split between string arrays.
Public Function PL_PickToDate(ByVal s As Variant) As VariantConversion function between Pick date number and Visual Basic date variable.
Public Function PL_Read(ByVal PNo As Integer, s As String) As IntegerFunction to read characters from a raw connection.
Public Function PL_ReadItem(ByVal FNo As Integer, ByVal ID As String, d As String) As IntegerReads an item from an open Pick file.
Public Function PL_ReadItemA(ByVal FNo As Integer, ByVal ID As String, d() As String) As IntegerRead an item as a string array from an open Pick file.
Public Function PL_ReadNext(ByVal SNo As Integer, ByVal cnt As Integer, d As String) As IntegerPerforms one or more sequential READNEXT statement for an open Pick select.
Public Function PL_ReaduItem(ByVal FNo As Integer, ByVal ID As String, d As String) As IntegerRead an item from an open Pick file setting a lock.
Public Function PL_ReadvItem(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, d As String) As IntegerRead an attribute from an open Pick file.
Public Function PL_ReadvuItem(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, d As String) As IntegerRead an attribute from an open Pick file setting a lock.
Public Function PL_Release(ByVal FNo As Integer, ByVal ID As String) As IntegerRelease a Pick lock.
Public Function PL_ReleaseAll(ByVal FNo As Integer) As IntegerRelease all Pick locks.
Public Function PL_Replace(s As String, ByVal a As String, ByVal a1 As Long, ByVal a2 As Long, ByVal a3 As Long) As StringDyanmic array REPLACE function. The 16-bit version of this function uses Integer parameters for a1, a2, and a3.
Public Function PL_ReplStr(s As String, ByVal SearchStr As String, ByVal ReplStr As String) As StringString conversion function to replace all occurances of SearchStr with ReplStr.
Public Function PL_RPC(ByVal FNo As Integer, ByVal Cmd As String, p1 As String, d As String) As IntegerPick RPC (Remote Proceedure Call). The subroutine specified in "Cmd" will be called with parameters "p1" and "d".
Function PL_ScanDelim(s As String, ByVal Delim As String) As StringScan delimiters returning each field with each call. When the entire string has been scanned, this function will return the delimiter. You must call this function repetively until all delimiters are retrieved. This function is not re-entrant and you can only scan a single string at one time.
Public Function PL_Strip(s As String) As StringString conversion function to replace non Pick compatible characters with Chr$(127).
Public Sub PL_StripA(d() As String)String array conversion function to replace non Pick compatible characters with Chr$(127).
Public Sub PL_Term()Terminate subroutine to cleanup PicLan resources. Your application should use PL_Exit which in turn calls PL_Term().
Public Sub PL_TermMem(ByVal handle As Integer)Function to release a PicLan client handle.
Public Function PL_Write(ByVal PNo As Integer, ByVal s As String) As IntegerWrite to a raw PicLan connection. This function is non-blocking and you must repetively call it until your entire string is consumed.
Public Function PL_WriteBlock(ByVal PNo As Integer, s As String) As IntegerWrite blocking to a raw PicLan connection. This function will write your entire source string, even if this requires waiting for network traffic.
Public Function PL_WriteItem(ByVal FNo As Integer, ByVal ID As String, ByVal d As String) As IntegerWrite an item to an open Pick file.
Public Function PL_WriteItemA(ByVal FNo As Integer, ByVal ID As String, d() As String) As IntegerWrite an item with a string array to an open Pick file.
Public Function PL_WriteuItem(ByVal FNo As Integer, ByVal ID As String, ByVal d As String) As IntegerWrite an item to an open Pick file preserving the Pick lock.
Public Function PL_WritevItem(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, ByVal d As String) As IntegerWrite an attribute to an open Pick file.
Public Function PL_WritevuItem(ByVal FNo As Integer, ByVal ID As String, ByVal attr As Integer, ByVal d As String) As IntegerWrite an attribute to an open Pick file preserving the Pick lock.
Public Function PL_ValidateFileHandle(ByVal FNo As Integer) As IntegerValidate a file handle.
Public Function PL_ValidateSelectHandle(ByVal SNo As Integer) As IntegerValidate a select handle.
Public Sub PL_Xoff(ByVal PNo As Integer)Flow control a raw PicLan connection.
Public Sub PL_Xon(ByVal PNo As Integer)Un-flow control a raw PicLan connection.
Function PL_RPC% (ByVal FNo%, ByVal name$, p1$, d$)Perform a Remote Proceedure Call to the subroutine specified. The specified subroutine on the Pick host will be called with two parameters, the first being one attribute long, and the second being any number of attributes long. The called subroutine must be cataloged and callable within the context of the PicLan SERVER-PROCESS on the Pick host system.
Care should be taken in calling user-written subroutines. If your subroutine crashes, the SERVER-PROCESS will crash and subsequent network requests will be ignored. When you are developing Pick RPC subroutines, you should execute the SERVER-PROCESS on a terminal or network attached port instead of on a background process in order to facilitate debugging.
The remote subroutine executes within the context of the PicLan SERVER-PROCESS. The SERVER-PROCESS usually executes within the login of whatever account the PL-LOAD PicLan driver load program executed within. This is usually either the SYSPROG (or DM for AP systems) or the PIC-LAN account. You user written subroutine should be written and cataloged so that it can run from within either of these accounts.
There are practical limitations as to what type of processing the called subroutine can perform. Primarily, the limitations are based on limitations of the underlying Pick implementation and the fact that the there is only a single PicLan SERVER-PROCESS and while your subroutine is executing, the SERVER-PROCESS is unable to process other requests. For this reason, you should try to avoid performing operations that take more than one or two seconds to execute. This usually precludes using the BASIC EXECUTE statement to perform operations such as Access SSELECT statements. One option around this limitation is for the called subroutine to use a phantom port (on those Pick systems where this is supported). This way the phantom port can execute the lengthly task, and the calling program can periodically check the Pick host to see if the job is finished.
The other major limitation of the called proceedure is preserving variables from call to call. An array of COMMON elements is available to user written RPC subroutines, but you must share this single COMMON area amongst all applications that use RPC calls. The suggested method of using this COMMON area is to use the first element as a dynamic array of attributes that relate to the position within the rest of the common area. A subroutine can then "name" the elements that it uses and use the Pick BASIC LOCATE statement to quickly find an element by name.
Here is an example RPC that can be used to access files:
' This is a Visual Basic code fragment that is used to open and call a Pick ' subroutine. In actual Visual Basic code, you would probably include the ' PL_Init and PL_OpenFile calls in the main form Load routine and the PL_Term ' call in the main form UnLoad routine. Dim res as Integer Dim FileHandle as Integer Dim P1 as String Dim D as String Dim p as New Plan FileHandle = p.FileOpen("PICK", "RPC", "") If FileHandle < 0 Then MsgBox "Error opening RPC connection " & p.ErrorStr(FileHandle), vbCritical, "Error!" p = Nothing End EndIf P1 = "OPEN" & VM & "DATAFILE" 'Setup Pick file to open' D = "" res = p.RPC(FileHandle, "RPC$FILEIO", P1, D) If res < 0 Then MsgBox "Error calling RPC " & p.ErrorStr(res), vbCritical, "Error!" p = Nothing End EndIf Debug.Print "P1 = " & P1 If P1 = "Error" Then MsgBox "Error opening remote file", vbCritical, "Error!" p = Nothing End End If P1 = "READ" & VM & "34875" 'Setup a Pick Item ID to read D = "" res = p.RPC(FileHandle, "RPC$FILEIO", P1, D) if res < 0 Then MsgBox "Error calling RPC " & p.ErrorStr(res), vbCritical, "Error!" p = Nothing End End Debug.Print "P1 = " & P1 Debug.Print "D = " & D SUBROUTINE RPC$FILEIO(P1,P2) * * This is the Pick subroutine on the other end of the RPC call. In order to * call this subroutine, it must be cataloged in the account(s) that the * PicLan SERVER-PROCESS runs in (usually SYSPROG/DM and PIC-LAN). * EQUATE AM TO CHAR(254) * * The PicLan SERVER-PROCESS leaves the first 500 common variables open for * user subroutine use. You should use the first variable as a dynamic array * of attributes that you will store "names" of the variables in and then use * the next 499 variables to store actual data that must be preserved from * call to call (things like file variables for open files). This system * will allow you (and other programmers) to write many types of RPC * subroutines without them conflicting with each other. * * In this example, P1 is used as a command parameter with the first value * indicating the operation (OPEN and READ are supported here), and the * second value indicating the file name or item id for each function. * COMMON V.LIST COMMON VARS(499) * * This is an example proceedure of how to find an available slot in the * common array. Always tread the V.LIST variable as a dynamic array of * attributes and VARS as associated variable locations. Remember to only * access and manipulate variables in VARS that this routine allocated. * LOCATE("RPC$FILEIO",V.LIST;V.LOC) ELSE V.LOC = DCOUNT(V.LIST,AM) + 1 IF V.LOC > 499 THEN P1 = 'ERROR' ;* P1 is used as an error indicator. RETURN END V.LIST<V.LOC> = "RPC$FILEIO" END * BEGIN CASE CASE P1<1,1> = 'OPEN' OPEN P1<1,2> TO VARS(V.LOC) THEN P1 = '' END ELSE P1 = 'FILE NOT FOUND' END CASE P1<1,1> = 'READ' READ P2 FROM VARS(V.LOC) , P1<1,2> THEN P1 = '' END ELSE P1 = 'ITEM NOT FOUND' END END CASE * RETURNNote that this example does not perform any errror checking which would be necessary in any production application.