RPC



RPC The Application requires a custom RPC to extract information about the structrure of the FileMan files

Registration Check if the RPC is registered properly

Interface The next text describes the RPC Interface
RPC requires 2 parameters and returns the result array

Input parameters
  - OPTION (#1: literal, size=8, required)
  - ARRAY  (#2: array, size=32000, optional)

  OPTION literal defines action to execute
  ARRAY contains additional parameters required by OPTION

Output
The first line of the results array RESULT contains number of lines returned
the rest of the result array contains data if any:

    RESULT(0)=RC
    RESULT(1)=data_1
    RESULT(2)=data_2
    ...
    RESULT(RC)=data_RC 

Zero or positive RC identifies the last index of the RESULT array
For negative RC description of the error is in the second piece ("^" delimeter) of the RESULT(0)  

The next actions (OPTIONS) are supported by this version:
HELP     - this text
NUL      - returns "0^NULL"
VERSION  - returns version of the RPC 
ECHO     - returns array sent as the parameter
REXISTS  - verifies if the routine exists
RLIST    - lists routines matchiing target
RSOURCE  - returns source code of routine
RSAVE    - saves routine by name
RDELETE  - deletes routine by name
FMFNAME  - file global name and info by file number
FMFFLDS  - fields of the file. Field numbers only
FMFCHRS  - file chars
FMFINDXS - file index names
FMFIELD  - one field definitions
FMFIELDS - all file fields with field definition
LISTGLBL - List Global

Examples

Unknown option XXX
     D RPC(.ZZAND,"XXX",.ZZAA)
     - returns negative RC and description of error

     ZZAND(0)="-1^Option XXX is not supported by this RPC"

HELP 
     D RPC(.ZZAND,"HELP")
     - returns contents of the HELP. First line of the result array contains number of the lens returned (64)

     ZZAND(0)="64"
     ZZAND(1)="This RPC...
     ...
     ZZAND(64)=""

VERSION 
     D RPC(.ZZAND,"VERSION")
     - returns the RPC implementation version

     ZZAND(0)="1"
     ZZAND(0)="1.2"

ECHO
     S ZZAA(0)="ECHO TEST Line 1",ZZAA(1)="ECHO TEST Line 2" D RPC(.ZZAND,"ECHO",.ZZAA)
     - returns the array as it was received by the RPC

     ZZAND(0)="ECHO TEST Line 1"
     ZZAND(1)="ECHO TEST Line 2" 
     

RSOURCE
     S ZZAA(0)="ZZFMVIEW" D RPC(.ZZAND,"RSOURCE",.ZZAA)
     - returns source code of the "ZZFMVIEW" routine

     ZZAND(0)="361"
     ZZAND(1)="ZZFMVIEW...
     ...
     ZZAND(361)="...

RSAVE
     S ZZAA(0)="ZZRPCV1^3",ZZAA(1)="Line One",ZZAA(2)="Line TWO",ZZAA(3)="Line Three"
     D RPC(.ZZAND,"RSAVE",.ZZAA)
     - saves 3 lines in "ZZRPCV1"

     ZZAND(0)="0^ZZRPCV1 SAVED"

FMFNAME  
    S ZZAA(0)="1" D RPC(.ZZAND,"FMFNAME",.ZZAA)
    - returns file "1" description

    ZZAND(0)=2
    ZZAND(1)="^DIC("
    ZZAND(2)="FILE^1^9999999.64^2366" 

- file global name and info by file number

FMFFLDS
    S ZZAA(0)="1" D RPC(.ZZAND,"FMFFLDS",.ZZAA)
    - returns fields of the file "1". Field number only:

    ZZAND(0)=26
    ZZAND(1)=.01
    ZZAND(2)=1
    ...
    ZZAND(26)="SB"

FMFCHARS
    S ZZAA(0)="1" D RPC(.ZZAND,"FMFCHRS",.ZZAA)
    - file "1" characteristics

    ZZAND(0)=6
    ZZAND(1)="        VR : 22.0"
    ZZAND(2)="        GL : ^DIC("
    ZZAND(3)="        DD : ^"
    ZZAND(4)="     LAYGO : ^"
    ZZAND(5)="        RD : ^"
    ZZAND(6)="        WR : ^"

FMFINDXS
    S ZZAA(0)="1" D RPC(.ZZAND,"FMFINDXS",.ZZAA)
    - indexes defined for the file "1"

    ZZAND(0)=4
    ZZAND(1)="AC"
    ZZAND(2)="AD"
    ZZAND(3)="AE"
    ZZAND(4)="B"

FMFIELDS
    S ZZAA(0)="1" D RPC(.ZZAND,"FMFIELDS",.ZZAA)
    - field definitions for the file "1".
    NOTE that definition of one field may be presented in several lines:

    ZZAND(0)=30
    ZZAND(1)="1^.001^0^NUMBER^N^^ ^K:X$P($P(^(1),U),""-"",2)) K X"
    ZZAND(2)="1^.001^4^W !?5,""Enter an unused number"" 
....I $D(^VA(200,DUZ,1)),$P(^(1),U)]"""" W "" within the range, "",$P(^(1),U)"
    ZZAND(3)="1^.01^0^NAME^RF^^0;1^K:$L(X)>45!($L(X)<3) X"
    ZZAND(4)="1^.01^3^3-45 CHARACTERS"
    ZZAND(5)="1^1^0^GLOBAL NAME^CJ14^^ ; ^S X=$S($D(^DIC(D0,0,""GL"")):^(""GL""),1:"""")"
    ...
    ZZAND(29)="1^1819^9^^"
    ZZAND(30)="1^1819^9.01^"

FMFIELD
    S ZZAA(0)="1",ZZAA(1)=".01" D RPC(.ZZAND,"FMFIELD",.ZZAA)
    - returns definition of field ".01" file "1"

    ZZAND(0)=2
    ZZAND(1)="1^.01^0^NAME^RF^^0;1^K:$L(X)>45!($L(X)<3) X"
    ZZAND(2)="1^.01^3^3-45 CHARACTERS"


LISTGLBL
    S ZZAA(0)="^DIC(0)",ZZAA(1)=10 D RPC(.ZZAND,"LISTGLBL",.ZZAA)
    - returns list of 10 global nodes started from "^DIC(0)"
      the last node found is included in the ZZAND(0)

    ZZAND(0)=10|^DIC(.11,""%D"",3,0)
    ZZAND(1)="1|^DIC(.11,0)|INDEX^.11"
    ZZAND(2)="1|^DIC(.11,0,""DD"")|^"
    ZZAND(3)="1|^DIC(.11,0,""DEL"")|^"
    ZZAND(4)="1|^DIC(.11,0,""GL"")|^DD(""IX"","
    ZZAND(5)="1|^DIC(.11,0,""LAYGO"")|^"
    ZZAND(6)="1|^DIC(.11,0,""WR"")|^"
    ZZAND(7)="1|^DIC(.11,""%D"",0)|^^5^5^2980911^"
    ZZAND(8)="1|^DIC(.11,""%D"",1,0)|This file stores information about new-style cross-references defined on a"
    ZZAND(9)="1|^DIC(.11,""%D"",2,0)|file. Whereas traditional cross-references are stored under the 1 nodes of"
    ZZAND(10)="1|^DIC(.11,""%D"",3,0)|the ^DD for a particular field, new-style cross-references are stored in"

Sample RPC implementation ZZFMVIEW.m_1_4.zip (v.1.4 February 2017)
ZZFMView_1_2.KIDS

February 2017