Showing posts with label jbase commands. Show all posts
Showing posts with label jbase commands. Show all posts

Sunday, April 17, 2011

jBase Infobasic Command DEBUG

The DEBUG statement causes the executing program to enter the jBASE BASIC debugger.

Command Syntax

DEBUG

Example

IF FatalError = TRUE THEN
DEBUG ;*//enter the debugger
END
Continue Reading...

Wednesday, April 13, 2011

jBase Infobasic Command DCOUNT

The DCOUNT( ) function counts the number of field elements in a string that are separated by a specified delimiter.

Command Syntax

DCOUNT(expression1, expression2)

Syntax Elements

expression1 evaluates to a string in which fields are to be counted.
expression2 evaluates to the delimiter string used to count the fields.

Notes

The delimiter string may consist of more than one character.
If expression1 is a NULL string, the function returns a value of zero.
The delimiter string may consist of any character, including system delimiters such as field marks or value marks.

See also COUNT

Example

A = "A:B:C:D"

CRT DCOUNT(A, ":")


Output will be: 4
Continue Reading...

Thursday, April 7, 2011

jBase Infobasic Command DATE

The DATE() function returns the date in internal system form. This date is expressed as the number of days since December 31, 1967.

Command Syntax

DATE()

Notes

The system and your own programs should manipulate date fields in internal form. They can then be converted to a readable format of your choice using the OCONV( ) function and the date conversion codes.
The year 2000 is a leap year.

Example

CRT OCONV (DATE(), "D2")
displays today's date in the form: 08 JUL 64
Continue Reading...

Wednesday, April 6, 2011

jBase Infobasic Command DATA

temenos t24 tutorial
The DATA statement stacks the series of expressions on a terminal input FIFO stack. Terminal input statements will then treat this data as if entered at the keyboard.

Command Syntax

DATA expression {, expression ...}

Syntax Elements

The expression may evaluate to any data type; views each comma-separated expression as one line of terminal input.

Notes

The data stacked for input will subsequently be treated as input by any jBASE BASIC program.Therefore use it before PERFORM/EXECUTE, CHAIN or any other method of transferring program execution. Use also to stack input for the currently executing program; do not use to stack input back to an executing program.
When a jBASE BASIC program detects stacked data, it is taken as keyboard input until the stack is exhausted. The program will then revert to the terminal device for subsequent terminal input. Stacked data delimited by field marks (xFE) will be treated as a series of separate terminal inputs.

See also CLEARDATA

Example

DATA "Y", "N", "CONTINUE" ;*// stack input for prog

EXECUTE "PROGRAM1" ;*// execute the program

Continue Reading...

Sunday, April 3, 2011

jBase Infobasic Command CRT

temenos t24 tutorial
The CRT statement sends data directly to the terminal, even if a PRINTER ON statement is currently active.

Command Syntax

CRT expression {, expression..} {:}

Syntax Elements

An expression can evaluate to any data type. The CRT statement will convert the result to a string type for printing. Expressions separated by commas will be sent to the screen separated by a tab character. The CRT statement will append a newline sequence to the final expression unless it is terminated with a colon ":" character.

Notes

As the expression can be any valid expression, it may have output formatting applied to it. A jBASE BASIC program is normally executed using buffered output mode. This means that data is not flushed to the terminal screen unless a newline sequence is printed or terminal input is requested. This makes it very efficient. However you can force output to be flushed to the terminal by printing a null character CHAR (0). This has the same effect as a newline sequence but without affecting screen output.
For compatibility, use DISPLAY in place of CRT.

Example

CRT A "L#5"
CRT @ (8,20):"Shazza was here":
FOR I = 1 TO 200
CRT @ (10,10):I:CHAR (0):
...
NEXT I
Continue Reading...

Friday, April 1, 2011

jBase Infobasic Command CREATE

jbase tutorial
Use the CREATE statement after an OPENSEQ statement to create a record in a jBASE directory file or to create a UNIX or DOS file. CREATE creates the record or file if the OPENSEQ statement fails. An OPENSEQ statement for the specified file.variable must be executed before the CREATE statement to associate the pathname or record ID of the file to be created with the file.variable. If file.variable is null, the CREATE statement fails and the program enters the debugger. Use the CREATE statement when OPENSEQ cannot find a record or file to open and the next operation is to be a READSEQ or READBLK.If the first file operation is a WRITESEQ,WRITESEQ creates the record or file if it does not exist. If the record or file is created, it executes the THEN statements; if no record or file is created, it executes the ELSE statements.

Command Syntax

CREATE file.variable {THEN statements [ELSE statements] | ELSE statements}

Example

In the following example, RECORD does not yet exist. When OPENSEQ fails to open RECORD to the file variable FILE, the CREATE statement creates RECORD in the type 1 file DIRFILE and opens it to the file variable FILE.

Command Syntax

OPENSEQ 'DIRFILE', 'RECORD' TO FILE
ELSE CREATE FILE ELSE ABORT
WEOFSEQ FILE
WRITESEQ 'SOME DATA' TO FILE ELSE STOP
Continue Reading...

Monday, March 21, 2011

jBase Infobasic Command COUNTS

Use the COUNTS function to count the number of times a substring is repeated in each element of a dynamic array. The result is a new dynamic array whose elements are the counts corresponding to the elements in the dynamic array.

Command Syntax

COUNTS (dynamic.array, substring)
dynamic.array specifies the dynamic array whose elements are to be searched.
substring is an expression that evaluates to the substring to be counted. substring can be a character string, a constant, or a variable. Each character in an element is matched to substring only once.Therefore, when substring is longer than one character and a match is found, the search continues with the character following the matched substring. No part of the matched element is recounted toward another match. If substring does not appear in an element, a 0 value is returned.If substring is an empty string, the number of characters in the element is returned. If substring is null, the COUNTS function fails and the program terminates with a run-time error message. If any element in dynamic.array is null,null is returned.

Example

ARRAY="A":@VM:"AA":@SM:"AAAAA"
PRINT COUNTS (ARRAY, "A")
PRINT COUNTS(ARRAY, "AA")

Output

The output of this program is:
1]2\5
0]1\2
Continue Reading...

Tuesday, March 8, 2011

jBase Infobasic Command COS

The COS function calculates the cosine of any angle using floating point arithmetic, then rounds to the `precision implied by the jBASE BASIC program, which makes it very accurate.

Command Syntax

COS(expression)
;*// This function calculates the cosine of an expression.

Syntax Elements

The expression must evaluate to a numeric result or a runtime error will occur.

Notes

Assumes the value returned by expression is in degrees.

Example

FOR I = 1 TO 360
CRT COS(I) ;*// print cos i for 1 to 360 degrees
NEXT I
Continue Reading...

Sunday, March 6, 2011

jBase Infobasic Command CONVERT (STATEMENT)

The CONVERT statement converts one or more characters in a string to their corresponding replacement characters.

Command Syntax

CONVERT expression1 TO expression2 IN expression3

Syntax Elements

expression1 is the list of all characters to translate in expression3
expression2 is the list of characters that will be converted to.
expression3 is the string to which the conversion will apply.

Notes

There is a one to one correspondence between the characters in expression1 and expression2. That is, conversion of character 1 in expression1 to character 1 in expression2, etc.
See also: the CONVERT function.

Example

Value = 'ABCDEFGHIJ'
CRT 'Orignal: ':Value
CONVERT 'BJE' TO '^+!' IN Value
CRT 'Converted: ':Value
Orignal: ABCDEFGHIJ
Converted: A^CD!FGHI+
Continue Reading...

Monday, February 28, 2011

jBase Infobasic Command CONVERT

The CONVERT function is the function form of the CONVERT statement. It performs exactly the same function but may also operate on an expression rather than being restricted to variables.

Command Syntax

CONVERT (expression1, expression2, expression3)

Synatx Elements

expression1 is the string to which the conversion will apply.
expression2 is the list of all characters to translate in expression1.
expression3 is the list of characters that will be converted to.

NOTE: For Prime, Universe and Unidata emulations:

expression1 is the list of all characters to translate in expression1.
expression2 is the list of characters that will be converted to.
expression3 is the string to which the conversion will apply.

Example

Value = CONVERT (Value, "#.,", "$,.")

Value = CONVERT(PartCode, "abc", "ABC")

Value = CONVERT(Code, "1234567890", "0987654321")
Continue Reading...

Friday, February 25, 2011

jBase Infobasic Command CONTINUE

The CONTINUE statement is the complimentary statement to the BREAK statement without arguments.

Command Syntax

Use the statement within a loop to skip the remaining code in the current iteration and proceed directly on to the next iteration.

Notes

The compiler will issue a warning message and ignore the statement if it is found outside an iterative loop such as FOR...NEXT, LOOP...REPEAT.

Example

FOR I = 1 TO 30
IF Pattern(I) MATCHES "0N" THEN CONTINUE
GOSUB ProcessText
NEXT I
The above example will execute the loop 30 times but will only call the subroutine ProcessText when the current array element of Pattern is not a numeric value or null.
Continue Reading...

Tuesday, February 22, 2011

jBase Infobasic Command COMPARE

The COMPARE function compares two strings and returns a value indicating whether or not they are equal.

Command Syntax

COMPARE(expression1, expression2{, justification})

Syntax Elements

expression1 is the first string for comparison
expression2 is the second string for comparison
justification specifies how the strings are to be compared. "L" indicates a left justified comparison.
"R" indicates a right justified comparison. The default is left justification.
The function returns one of the following values:

-1 The first string is less than the second
0 The strings are equal
1 The first string is greater than the second

Example

A = "XY999"
B = "XY1000"
R1 = COMPARE(A,B,"L")
R2 = COMPARE(A,B,"R")
CRT R1,R2
The code above displays 1 -1, which indicates that XY999 is greater than XY1000 in a left justified comparison and XY999 is less than XY1000 in a right justified comparison.

International Mode

When using the COMPARE function in International Mode, the function will use the currently configured locale to determine the rules by which each string is considered less than or greater than the other will.
Continue Reading...

Saturday, February 19, 2011

jBase Infobasic Command COMMON

The COMMON statement declares a list of variables and matrices that can be shared among various programs. There can be many common areas including a default, unnamed common area.

Command Syntax

COMMON {/CommonName/} variable{, variable ... }

Syntax Elements

The list of variables should not have been declared or referenced previously in the program file. The compiler will detect any bad declarations and display suitable warning or error messages. If the common area declared with the statement is to be named then the first entry in the list should be a string, delimited by the / character.

Notes

The compiler will not, by default, check that variables declared in COMMON statements are initialized before they have been used as this may be beyond the scope of this single source code check. The -JCi option, when specified to the jBASE BASIC compiler, will force this check to be applied to common variables as well. The initialization of named common is controlled in the Config_EMULATE file.Variables declared without naming the common area may only be shared between the program and its subroutines (unless CHAIN is used). Variables declared in a named common area may be shared across program boundaries. When any common area is shared, all programs using it should have declared the same number of variables within it. Dimensioned arrays are declared and dimensioned within the COMMON statement.

Example

COMMON A, B(2, 6, 10), c
COMMON/Common1/ A, D, Array(10, 10)
Continue Reading...

Wednesday, February 16, 2011

jBase Infobasic Command COLLECTDATA

Use the COLLECTDATA statement to retrieve data passed from the PASSDATA clause of an EXECUTE statement.

Command Syntax

COLLECTDATA variable

Syntax Elements

variable is the name of the variable, which is to store the retrieved data.

Notes

Use the COLLECTDATA statement in any program, which is EXECUTEd (or PERFORMed) by another program where the calling program uses a PASSDATA clause. The EXECUTEd program uses a COLLECTDATA statement to retrieve the passed data. If a PASSDATA clause is not in effect, variable will be assigned a value of null.

Example

FIRST
001 EXECUTE "RUN JBASIC_PROGS SECOND" PASSDATA "Handover"

SECOND
001 COLLECTDATA PassedMessage
002 CRT PassedMessage
In the above example, program FIRST will EXECUTE program SECOND and will pass the string "Handover" in the PASSDATA clause. Program SECOND retrieves the string to a variable PassedMessage and prints the string on the Terminal screen.
Continue Reading...

Sunday, February 13, 2011

jBase Infobasic Command COL1 & COL2

Use these functions in conjunction with the FIELD function to determine the character positions 1 position before and 1 position after the location of the last field.

Command Syntax

COL1() / COL2()

Notes

When a field has been located in a string, it is sometimes useful to know its exact position within the string to manipulate either it, or the rest of the string. COL1() will return the position of the character immediately before the last field located. COL2() will return the position of the character immediately after the end of the last field located. Use them to manipulate the string.

Example

A = "A,B,C,D,E"
Fld = FIELD(A, ",", 2)
CRT COL1()
CRT COL2()
Displays the values 2 and 4
Continue Reading...

Thursday, February 10, 2011

jBase Infobasic Command CLOSE

Use the CLOSE statement to CLOSE an opened file, which is no longer required.

Command Syntax

CLOSE variable{, variable ...}

Syntax Elements

The variable list should contain a list of previously opened file variables that are no longer needed. The variables will be cleared and may be reused as ordinary variables.
NOTES: You can open an unlimited amount of files within jBASE BASIC; however leaving them open consumes valuable system resources.
Use good practice to hold open only those file descriptors to which you have constant access.

Example

OPEN "DATAFILE" TO FILEVAR ELSE ABORT 201, "DATAFILE"
.....
CLOSE FILEVAR
Continue Reading...

Wednesday, January 26, 2011

jBase Infobasic Command CLEARSELECT

Use the CLEARSELECT statement to clear active select lists.

Command Syntax

CLEARSELECT {ListName | ListNumber}

Syntax Elements

ListName must evaluate to a jBASE BASIC list variable. ListNumber is one of the numbered lists in the range 0 to 11. If neither ListName nor ListNumber are specified then it clears the default list (0).

Example

A = "good" : @AM : "bad" : @AM : "ugly"
B = "night" : @AM : "day"
SELECT A TO 3
SELECT B TO blist
adone = 0; bdone = 0
LOOP
READNEXT Ael FROM 3 ELSE adone = 1
READNEXT Bel FROM blist ELSE bdone = 1
UNTIL adone AND bdone DO
CRT Ael, Bel
CLEARSELECT 3
CLEARSELECT blist
REPEAT
This program displays: good night
Continue Reading...

Tuesday, January 18, 2011

jBase Infobasic Command CLEARFILE

Use the CLEARFILE statement to clear all the data from a file previously opened with the OPEN statement.

Command Syntax

CLEARFILE {variable} {SETTING setvar} {ON ERROR statements}

Syntax Elemenys

The variable should be the subject of an OPEN statement before the execution of CLEARFILE upon it.If the variable is omitted from the CLEARFILE statement, it assumes the default file variable as per the OPEN statement.

Notes

The CLEARFILE statement will remove every database record on the file against which it is executed, therefore, use with caution. If the variable argument does not describe a previously opened file, the program will enter the debugger with an appropriate message. If the SETTING clause is specified and the CLEARFILE fails, it sets setvar to one of the following values:

Incremental File Errors

128 => No such file or directory
4096 => Network error
24576 => Permission denied
32768 => Physical I/O error or unknown error

EXAMPLES

OPEN "DATAFILE" ELSE ABORT 201, "DATAFILE"
OPEN "PROGFILE" TO FILEVAR ELSE ABORT 201, "PROGFILE"
CLEARFILE
CLEARFILE FILEVAR
Continue Reading...

jBase Infobasic Command CLEARDATA

The CLEARDATA statement clears data stacked by the DATA statement.

Command Syntax

CLEARDATA
Continue Reading...

jBase Infobasic Command CLEARCOMMON

The CLEARCOMMON statement initializes all unnamed common variables to a value of zero.

Command Syntax

CLEARCOMMON
Continue Reading...
 

Blog Info

A Pakistani Website by Originative Systems

Total Pageviews

Tutorial Jinni Copyright © 2015 WoodMag is Modified by Originative Systems