Copies files from the client side to the server side.
Syntax
$copytoserver(source file name, destination file name, file type)
where
| source file name | an expression that evaluates to a character string containing a valid file address |
| destination file name | an expression that evaluates to a character string containing a valid file address |
| file type | an expression that evaluates to a character string that starts either with “B” (from “Binary”) or “T” (from “Text”) |
Return Value
The value return by this function is the file address of the destination if it is executed correctly; otherwise, it will return a $Null value.
Comments
This function is designed to work under ZIMTC and copies file from the client side to the server side using the file type specified. Files of the binary type are sent as they are, without their contents being checked (like images, videos, etc). On the other hand, files of the text type are copied using text file conventions for Windows and Unix.
Both the source and the destination file names can be either relative or absolute file paths. The following remarks apply to these paths:
| source file is absolute | the file is taken from the absolute path. Care should be taken because this absolute path refers to a location in the client’s machine; if there are many different users running, all users must have the same valid address |
| destination file is absolute | the file is written onto the absolute path |
| source file is relative | the file is read from a place that is relative to the current directory in the client session which is always where the Zimtc session has been started |
| destination file is relative | normally, the current directory is the database directory; therefore, the file will be written on a place inside the current directory |
If the destination file name contains sub-directories that don’t exist, they are created.
The ZIM executable ignores this function as it makes no sense copying a file to itself.
Example
This example copies the text file from the database path to a fixed location in the server’s machine.
out $copytoserver("mytext.txt", "c:\mextext.txt", "T")Related Topics
$copytoclient
Returns the position of the current member of a result set.
Syntax
$currentmember(setname)
Parameters
| setname | a character string, or an expression that evaluates to a character string, being the name of a result set |
Return Value
Number, with no decimal places.
Comments
$currentmember returns the (numerical) position of the current member within the specified result set. To explicitly specify the current set, use “CurrentSet” (including the quotation marks), as CurrentSet is a reserved word and the function is expecting a character string.
To ensure against unexpected results, choose set names carefully. At run time, the software distinguishes sets only by their names, even if they are permanent set names created in different application directories.
If, for example, you produce a set called Set1 in directory PersonnelData, and later you produce another set called Set1 in directory TestData, the second version of Set1 replaces the first version. Function $currentmember works only on the most recent version of the set.
Example
let vMemberNum = $currentmember("Set1")If the current member of Set1 is the fifth member, then variable vMemberNum is set to 5.
while
... process current member ...
if $currentmember("TempSet") = $lastmember("TempSet")
break
endif
next TempSet
endwhileThe WHILE loop processes TempSet one member at a time, breaking out when the last member of the set has been processed.
See Also
$lastmember
Converts an ordinal number into a character.
Syntax
$tochr(number)
Parameters
| number | a number, or an expression that evaluates to a number |
Return Value
Each of the decimal numbers from 0 to 255 represents a character output by your workstation. $tochr converts a given number to the corresponding character.
Note: The ascii character 0 returns an ascii null value. Zim sees the null character as an End of Line character and stops outputting data. In addition, the ascii character 32 (a space) translates to a 0 since the $tochr function expects a number as the parameter. So, $tochr (” “) translates to $tochr(0) and results in the null value. No matter how encountered, a null value in a string truncates the string at the first null character encountered.
If number is negative or greater than 255, the result of the function is $Null.
The character produced by the $tochr function can be converted back to a decimal number by the $toord function.
Comments
Ordinal number refers to the decimal numbers 0 to 255 that you computer uses to represent the characters available on your system.
Example
$tochr(32)
Evaluates to a space (on ASCII machines).
$tochr($toord("Z"))Evaluates to “Z”.
See Also
$left
$substring
$toalpha
$todate
$tonumber
About Character Literals
About Functional Expressions
Conversion Between Data Types
Calculates a date value by adding years to (or subtracting years from) a specified date value.
Syntax
$addyears(date,number)
Parameters
| date | a date, or an expression that evaluates to a DATE data type |
| number | a number, or an expression that evaluates to a number |
Return Value
Number, representing a DATE value.
Comments
Use $addyears to perform arithmetic with date values. The $addyears function calculates a date value by adding a number representing years to a date value. If number is negative, the effect is to subtract the years from the date.
The + (add) and – (subtract) operators can be used to achieve the same results.
If date or the result of the $addyears expression is an invalid date (e.g., 19930231), it is adjusted to produce a valid date (e.g., 19930228).
Example
If $Date has the value 19981225, then
$addyears($date,5)
Evaluates to 20041225.
$addyears($date,-5)
Evaluates to 19931225.
$addyears(19980229,1)
Evaluates to 19990228.
See Also
$adddays
$addmonths
$addweeks
$todate
$weekday
$year
+ (Add/Positive)
– (Subtract/Negative)
About Functional Expressions
Arithmetic with Dates
Sets the minimum acceptable date.
Syntax
SET VALIDDATE min_date
Parameters
| min_date | The minimum acceptable date (e.g. 19000101) |
Comments
Example
By default, the minimum acceptable date in Zim is 0. The following assignments are accepted without warnings
>let nDate = 0.
>let pDate = 19991231.
>let qDate = 20010101.
However, when the minimum acceptable date is set to 20000101, the first two assignments generate warnings:
>let nDate = 0.
*** Warning *** DATE value is invalid but the operation was performed.
>let pDate = 19991231.
*** Warning *** DATE value is invalid but the operation was performed.
The following assignment executes without warnings:
>let qDate = 20010101.
Controls the availability of the “break” key to the application user.
Syntax
SET BREAKABLE ON|OFF
Comments
The BREAKABLE option is set ON by default.
When BREAKABLE is ON, the application user may press the “break” key to terminate any command being executed. SET BREAKABLE OFF instructs the software to ignore the signal generated by the terminal “break” key.
The SET BREAKABLE command is not affected by the SET RESET and SET RESTORE commands.
See Also
$BreakFlag
Specifies how the FieldMask is treated in a LIST command.
Syntax
SET OUTPUT MASKFIELD ON|OFF
Comments
The OUTPUT MASKFIELD option is set ON by default.
Normally, the FieldMask is used to format data output from the database using the LIST command. To suppress the FieldMask, set OUTPUT MASKFIELD to OFF.
The OUTPUT MASKFIELD setting is unaffected by the SET SAVE and SET RESTORE commands.
See Also
LIST
Output Masks
Traces the execution of explicit transaction commands.
Syntax
SET TRANSACTION FLOW ON|OFF
Comments
The execution of explicit transactions (implemented using TRANSACTION, ENDTRANSACTION, and QUITTRANSACTION commands) is traced through the display of special messages, even in single-user systems.
Implicit transactions are not traced.
See Also
$InTransaction
ENDTRANSACTION
QUITTRANSACTION
SET TRACEOUTPUT
TRANSACTION
Controls the use of a pointing device in Zim for Windows.
Syntax
SET MOUSE ON|OFF
Comments
The MOUSE option is set ON by default.
When MOUSE is ON, the use of a pointing device is enabled for the client area of Zim windows. The application can then respond to mouse-button accelerators that occur while the focus is in a window.
The SET MOUSE command has no effect on standard windows. In such windows, it is assumed that a pointing device is active at all times, when available.
See Also
Event
FORM INPUT
MENU INPUT
Controls the use of the escape character in quoted character strings.
Syntax
SET ESCAPECHAR ON|OFF
Comments
The ESCAPECHAR option is ON by default.
When ESCAPECHAR is ON, the backslash is treated as the escape character inside quoted character strings. Setting ESCAPECHAR to OFF causes the backslash to be treated as data. The OFF setting is particularly useful in operating environments where the backslash character is used as the path separator character.
See Also
\ (Escape)