Skip to content

MVsharp - Functions and Statements


Functions

AccountPath

AccountPath(Expression)

The AccountPath function returns the Windows/Linux path to the Account specified in the expression


ActiveDirectory

ACTIVEDIRECTORY(aduser,adpassword,domain,userId,string property)

The ActiveDirectory function will query your AD controller and return a property from the AD controller aduser and adpassword is an administrator on the ad controller domain is the name of the domain,userId specifies the user record being queried and property is the name of the property to retrieve STATUS() return 0 for success and 1 if the property of userId does not exist.


Add.Account

Add.Account(accountName,hostName,account,ipAddress,userId,password,type)

The Add.Account function creates a database link to other MV databases(Universe/Unidata/QM/jBBASE/D3) to enable you to OPEN, READ, WRITE etc to MV files on other platforms. See document Linking Multi Value databases to MVsharp#.//****


Adds

Adds(expression1,expression2)

The Adds function adds all multivalues in expression1 to the corresponding multivalues in expression2.


Alpha

Alpha(expression)

The Alpha function tests the expression and returns true if all characters are alphabetics and false if any character are not alphabetic.


Ascii

Ascii(expression)

The Ascii function converts an EBCIDIC string to ASCII.


Assigned

Assigned(variable)

The Assigned function checks to see if the variable has been assigned and returns true if it has been assigned a value or false if not.


Base64Encode

Base64Encode(expression)

The Base64Encode function converts the expression into a BASE64 string.


Base64Decode

Base64Decode(expression)

The Base64Decode function converts the BASE64 string in expression to an ASCII string.


BatchStart

BatchStart(fileVariable,batchSize)

The BatchStart function begins batch processing on MVsharp# files in order to improve io performance, a single write function is executed when the number of writes to fileVariable reaches that batchSize count.


BatchEnd

BatchEnd(fileVariable)

The BatchEnd function terminates batch processing on fileVariable and flushes any remaining writes to the file.


Catalogued

Catalogued(expression)

The Catalogued function checks to see if the program name in expression has been catalogued in the VOC.


Cats

Cats(expression1,expression2)

The Cats function concatenates all multivalues in expression1 to the corresponding multivalues in expression2.


ChangePort

ChangePort(expression)

The ChangePort function allows you to programmatically change your port no to a value defined in expression.


CheckSum

Checksum(expression)

The The CheckSum function returns a checksum based on Crc16 algorithm on the data supplied in expression.


ClearCommon

ClearCommon

The ClearCommon statement sets all the variables in unnamed common to 0.


Col1

Col1()

The Col1 Function return the column position after a Field statement of the character before the extraction.


Col2

Col2()

The Col2 Function return the column position after a Field statement of the character after the extraction.


Count

Count(fileVariable)

Count(expression1,expression2)

When Count is used with a fileVariable, it returns the no of records in the file associated with the fileVariable. When used with expression1 and 2, it returns the number of occurrences of expression2 in expression1.


Confirm

Confirm(message)

The Confirm function prompts the user 'Do you wish to ' and then the message supplied in the argument. It returns 0 for N and 1 for Y.


License

License()

The License function returns a dynamic array of your license configuration. SerialNo, No od Cores, No of users, Expiry Date, MvSync Clients, MvSync Updates, MvSync Expiry, High Availability.


Create

Create(fileVariable)

Used after an OpenSeq statement when the file does not exist.


CreateFolder

CreateFolder(path)

Creates a directory and all it's parent directories if they don't exist.


CreateRequest

Create(url,type,requesthandle)

Create a HTTP request handle for the url. type is GET/POST.


Dcount

DCOUNT(expr1,Expr2)

The DCOUNT function counts the number of delimited elements in an expression.


Date()

DATE()

The internal form of the date is expressed as the number of days before or since December 31, 1967. The internal format of December 31, 1967 is zero, any day before is returned as a negative number any day past is returned as a positive number.


Trim

TRIM(expression)

The TRIM function removes all leading and trailing white space from a string.


Trimf

TRIMF(expression)

The TRIMF function removes all leading white space from a string.


Trimb

TRIMB(expression)

The TRIMB function removes all trailing white space from a string.


Len

LEN(expression)

The LEN function return the length of an expression.


Abs

ABS(expression)

The ABS function returns the absolute value of an expression.


Index

INDEX(expression,substring)

INDEX(expression,substring,occurrence)

The INDEX function returns the position of a sub string in a string. The optional occurrence value set the occurrence of the sub string in a string.


Execute

EXECUTE statements {PASSLIST listnumber} {CAPTURING variable} {SETTING variable}

The EXECUTE statement executes the supplied arguments at a TCL level.

If the optional {CAPTURING variable} clause is supplied, all terminal io from the statement will be returned in the variable.

A active select list can be passed to the statement by specifying {PASSLIST listno}.

If the optional {SETTING variable} is specified, the no of items selected will be returned in the variable.


End Case

END CASE

The END CASE statement terminates a CASE block. There should be a corresponding END CASE for each BEGIN CASE.


Gosub

GOSUB label{:}

The GOSUB statements transfers execution to the internal subroutine named. Execution is continued with the first statement after the GOSUB when a RETURN is encountered.


Upcase

UPCASE(expression)

The UPCASE function converts an expression to all upper case characters.


Downcase

DOWNCASE(expression)

The DOWNCASE function converts an expression to all lower case characters.


Dquote

DQUOTE(Expression)

The DQUOTE function return a string enclosed in double quotes.


Squote

SQUOTE(Expression)

The SQUOTE function return a string enclosed in single quotes.


Oconv

OCONV(expression,conversioncode)

The OCONV() function converts the value of expression to its external representation according to the conversion codes specified in conversioncode.


Iconv

ICONV(expression,conversioncode)

The OCONV() function converts the value of expression to its internal representation according to the conversion codes in conversioncode.


Int

INT(expression)

The INT function returns the integer portion of a number with no decimal points.


Exit

EXIT

The EXIT statement exits a LOOP or FOR loop.


Change

CHANGE(Expression,oldstring,newstring)

The CHANGE function replaces one string with another in an expression.


Lower

Lower(Expression)

The LOWER function lowers each marker by 1. AM > VM, VM > SVM etc.


Raise

RAISE(Expression)

The RAISE function raises each marker by 1. SVM > VM, VM > AM etc.


Delete

DELETE(variable,am)

DELETE(variable,am,vm)

DELETE(variable,am,vm,svm)

The DELETE functions removes an attribute, value or sub-value from a dynamic array.


Unassigned

UNASSIGNED(variable)

The UNASSIGNED function return True (1) when a variables has previously been assigned a value and False (0) when it has not bee assigned a value.


Stop

STOP

The STOP statement terminates the current program and return to the calling program or TCL.


Equate

EQUATE definition TO value

EQU definition TO value

The EQU/EQUATE statement replaces all occurrences of the equated definition with it's equivalent Value in your program.


Field

FIELD(expression,separator,count)

FIELD(expression,separator,count,notoreturn)

The FIELD function extracts a portion of an expression by splitting the string using the separator provided and returning the element in the count position. If the optional notoretrun is specified, Field returns that number of fields including the separator.


Not

NOT(Expression)

Then NOT function return True (1) if the expression results in False or blank and False if the expression results in True or positive.


Char

CHAR(expression)

The CHAR function returns the ascii character defined by the expression.


Drop.Account

DROP.DATABASE(databaseName)

The DROP.ACCOUNT functions removed a connection to a remote database (Universe,Unidata,jBase,Qm,D3,MongoDB).


Statements

Chain

  • Documentation: Chain expression
  • Detail: The Chain statement terminates the current running program and starts the program in expression.

ClearFile

ClearFile fileVariable {ON ERROR} statements

The ClearFile statement clears all the data in the file referenced by fileVariable.


ClearInput

ClearInput

The ClearInput statement removes all unprocessed keystrokes in the users input buffer.


ClearSelect

ClearSelect

ClearSelect expression

ClearSelect All

The ClearSelect statement without arguments removes select list 0. If specified with expression, the select list related to expression is removed and the All parameter removed all select list.


Close

Close fileVariable {ON ERROR} statements

The Close statement closes the file handle referenced by fileVariable. The On Error clause is executed if a fatal error occurs.


CloseSeq

Close fileVariable {ON ERROR} statements

The Close statement closes the file handle referenced by fileVariable. The On Error clause is executed if a fatal error occurs.


Close.Socket

Close.Socket socketVariable

The Close.Socket statement closes a socket variable that was previously opened with Open.Socket, Open.ServerSocket or Accept.Socket.Connection.


Begin Case

BEGIN CASE
...
END CASE

or

BEGIN TRANSACTION
...
END TRANSACTION

The BEGIN CASE statement is used to start a CASE block of a TRANSACTION block.


If

If ...... {Then\Else}

The If statement begins a test block for a specific value. The block is terminated with a End statement.


For

FOR var = start TO end {STEP incr}
{UNTIL/WHILE condition}
NEXT var

The FOR statement begins a FOR/NEXT Loop.


Open

OPEN {'DICT'},filename TO filevariable {ON ERROR} THEN/ELSE

The OPEN statement opens a file for data processing. If the OPEN statement fails, it executes any statements associated with an ELSE clause. If the OPEN is successful it will execute any statements associated with a THEN clause. Note that either one or both of the THEN and ELSE clauses are required.


Select

SELECT filevariable TO listnum

SELECT filevariable TO variable

The SELECT statement creates a select list of elements in a specified variable or list number. If no list number or variable is present, the default select list '0' is used.


ReadNext

READNEXT var FROM listnumber THEN/ELSE

READNEXT var from variable THEN/ELSE

The READNEXT statement reads the next entry from a list number or variable. If no list number or variable is specified, the default list '0' is used. If an entry is available the THEN clause is execute otherwise the ELSE clause is executed.


Read

READ record FROM filevariable, key {ON ERROR} THEN/ELSE

The READ statement reads a record from a file with supplied key. If the key exists the THEN statements are executed otherwise the ELSE statements are executed. the ON ERROR clause is executed if am error occurs during the READ process.


Readv

READV record FROM filevariable, key, attribute {ON ERROR} THEN/ELSE

The READV statement reads an attribute from a record from a file with supplied key. If the key exists the THEN statements are executed otherwise the ELSE statements are executed. the ON ERROR clause is executed if am error occurs during the READ process.


Repeat

REPEAT

The REPEAT statement marks the end of a LOOP statement.


Crt

CRT expression

CRT expression:

The CRT statement displays text to terminal window. If the optional ':' is appended no carriage return is appended to the text.


Dim

DIM variable(depth)

DIM variable(depth,width)

The DIM statement creates a dimensioned array with supplied number of elements. A dimensioned array can be single or multi-dimension.


Debug

DEBUG

The DEBUG statement forces a program to enter the debugger at a specific point. This only applies if the program has been compiled in debug mode. BASIC filename programname (D


Call

CALL subroutine{(arg1,arg2,...)}

CALL @variable{(arg1,arg2,...)}

The CALL statement passes program execution to another subroutine. The subroutine must be compiled and cataloged.


Mat

The MAT statement allows you to initialise all the elements of an array to a specific value.


Match

expression MATCH/MATCHES pattern

The pattern matching operator, MATCH, and its synonym, MATCHES, compare a string expression to a pattern.


Write

WRITE record ON filevariable , key {ON ERROR}

The WRITE statement writes a record to file using the specified key. The file must be opened before the WRITE statement can be used. If an error occurs the ON ERROR clause is executed.


Writev

WRITEV record ON filevariable , key , attribute {ON ERROR}

The WRITEV statement writes an attribute to file using the specified key and attribute number. The file must be opened before the WRITE statement can be used. If an error occurs the ON ERROR clause is executed.


Begin

BEGIN CASE
...
END CASE

or

BEGIN TRANSACTION
...
END TRANSACTION

The BEGIN statement is used to start a CASE block of a TRANSACTION block.


Case

CASE expr operator value

The CASE statement performs a test and if it resolves to true, all statement below the CASE are executed until the next CASE statement or END CASE statement.


Loop

LOOP
{UNTIL/WHILE condition}
REPEAT

The LOOP statement begins a code block for looping. The loop is exited when either the WHILE/UNTIL is satisfied or the EXIT clause is executed.


End

END

The END statement terminates a THEN/ELSE block.


Print

PRINT expression{:}

PRINT ON channel expression{:}

The PRINT statement sends out to a print channel. If no printer is on, the output goes to the terminal. The optional : at the end will suppress a carriage return being appended to the expression.


Printer On

PRINTER ON

The PRINTER ON statement turns on the printing on to the printer.


Printer Off

PRINTER OFF

The PRINTER OFF statement turns off printing to the printer. All subsequent PRINT statements will print to the terminal.


Printer Close

PRINTER CLOSE

The PRINTER CLOSE statement closes the print channel. All data spooled will begin printing.

$Include

$INCLUDE programname

$INCLUDE filename programname

The $INCLUDE directive inserts the program specified into the current source code. If the optional filename is specified the code is read from the file.


Next

NEXT variable

The NEXT statement terminates a FOR loop. Control is passed back to the FOR statement and the variable is incremented or decremented.


Continue

CONTINUE

The Continue statement returns program execution to the top of the FOR/LOOP loop.


Return

RETURN

RETURN(expression)

The RETURN statement returns program execution to the following statement after a GOSUB. It also returns from a BASIC subroutine if no GOSUB is active. The second form of the RETURN statement is used in a FUNCTION call, expression is returned as the value for the function.


Delete

DELETE filevariable, recordid

The DELETE Statement delete a record from a file.


Convert

CONVERT characters TO newcharacters IN variable

The CONVERT statement converts a series of characters to alternate characters in a dynamic array. If characters contains more that 1 character, each character is converted to the corresponding character in newcharacters.


Begin Transaction

BEGIN TRANSACTION

The BEGIN TRANSACTION statement indicates the start of a transaction. All writes are batched together and are only committed when the COMMIT statement is execute.


End Transaction

END TRANSACTION

The END TRANSACTION statement indicates the end of a transaction. After a COMMIT or ROLLBACK, execution continues at the statements following the END TRANSACTION.


Commit

COMMIT

The COMMIT statement commits all writes in the transaction to the disk and continues executing at the statement following the END TRANSACTION.


Rollback

ROLLBACK

The ROLLBACK statement discards all writes in the transaction and continues executing at the statement following the END TRANSACTION.


Readu

READU record FROM filevariable, key {LOCKED} {ON ERROR} THEN/ELSE

The READU statement reads a record from a file with supplied key and attempts to lock the record. If the record is already locked the statements following the LOCKED clause are executed. If no LOCKED clause is present, execution stops and the record is released. If the key exists the THEN statements are executed otherwise the ELSE statements are executed. the ON ERROR clause is executed if am error occurs during the READ process.

Writeu

WRITEU record ON filevariable , key

The WRITEU statements writes the record to a file using the key. If the record was previously locked, the lock is not removed and must be explicitly released using the RELEASE statement.


Program

PROGRAM

The PROGRAM statement defines this code as a program with no arguments. If must be the first statement in your code.


Subroutine

SUBROUTINE subroutinename

SUBROUTINE suboutinename(arg1,...)

The SUBROUTINE statement defines this code as a subroutine with optional arguments. Subroutines are called with the BASIC CALL statement. If must be the first statement in your code.


End Else

END ELSE

The END ELSE terminates the THEN portion and begin the ELSE portion of a code block.


Readlist

READLIST variable FROM {listnumber|listvariable} THEN/ELSE

The READLIST statement reads all the remaining keys from the list number or list variable into a dynamic array. If keys are present in the list the THEN clause is executed else the ELSE clause is executed.


Until

UNTIL expr {DO}

The UNTIL statement terminates a FOR or LOOP loop when the specified expression is true. The optional DO is required in a LOOP.


While

WHILE expr {DO}

The WHILE statement terminates a FOR or LOOP loop when the specified expression is true. The optional DO is required in a LOOP.


Goto

GOTO label

GO label

GO TO label

The GOTO statements transfer program execution to the label specified after the GOTO statement.


Release

RELEASE

RELEASE filevariable

RELEASE filevariable, key

The RELEASE statement release a record lock that was previously set with a READU. If only the filevariable argument is specified, all locks for that file are release. If no arguments are specified, all locks set by the user are released.


Common

COM {/name/}variable,variable,...

COMMON {/name/}variable,variable,...

The COMMON statement allows you to define global variables across all programs that include the same common statement. If optional /name/ is supplied, this is a Named Common which allows you to create specific global variables associated with that common.


FormList

FORMLIST variable TO Listnumber

The FORMLIST statement converts a variable selectlist to a numbered selectlist.


Constants

@Am

Return the attribute marker CHAR(254).


@Vm

Return the value marker CHAR(253).


@Svm

Return the sub-value marker CHAR(252).


@Tm

Return the text marker CHAR(251).