home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
448a.lha
/
DECISION_PLUS_Demo
/
Syntax.Doc
< prev
next >
Wrap
Text File
|
1990-10-29
|
11KB
|
274 lines
DECISION PLUS (TM) SYNTAX
----------------------------------------------------------------------
Syntax Notation:
The '!' character must appear as shown. It indicates a declaration
statement follows as opposed to general logic statements.
The '[' and ']' (square braces) indicate optional items .
The '<' and '>' (triangular braces) indicate manditory items .
Normal Sequence of events:
The first step of a totaly new problem is to design and describe
any new files to be used. This is done with the 'describe' program.
No real trick here if you have already grasped how 'Decision Plus'
describes fields in a file or the temporary fields in a program.
If not the explanation follows:
there are 5 main field types of 3 different sizes, but only certain
cominations are allowed. The normal form of the declaration is :
"name,[heading],type &size,format"
declaration in program meaning
----------------------- ------------
!temp xx_name,Name,a20,u a 20 byte character(a=alpha) field
called xx-name with a heading of
'Name' forced to upercase(u)
!temp xx_date,Last Update,d4,dd/mm/yy a date field called xx-date with a
heading of 'Last Update' to be
displayed/printed as day/month/year.
(type&size for dates are always 'd4')
!temp xx_dtime,,m4,00.00 a time field called xx-time without a
heading & displayed/printed as 'hh.mm'
(type&size for times are always 'm4')
!temp xx_dollars,Credit,m4,####.## a money field (must be m4 or m8) with
heading Credit' and displayed with 2
decimals up to "9999.99"
!temp xx_onorder,On Order,i1,## a 1 byte integer showing 2 digits
and can hold a number from 0 to 255
!temp xx_stock,In Stock,i2,#### a 2 byte integer showing four digits
and can hold a number = +- 32767
!temp xx_sold,Total Sold,i4,&&&&&### a four byte integer called xx-sold
displaying up to 10 digits and a
number aprox +- 1.4 billion. NOTE
this format blank fills any leading
zeros except for last 4 digits.
!temp xx_margin,Margin,r8,&&##.#### a real number called xx_margin with
heading of 'Margin' and displaying
four decimals Can coantain a number
of approx +- 2.4 billion.
!temp xx_window,,i2[20],,100-2000 an array of 20, 2 byte integers with
no heading or format but if used in
sage program would limit input values
for this field to numbers between
100 and 2000.
The describe program follows the same idea by asking you to enter
values for each field in the file in teh same manner as the above
examples for a program, except you will leave out the '!temp' part.
The only trick to remember (cuz you dont have a proper manual) is the
1) all key fields must declared first and in the order that you
want the index to be properly sorted
2) You must hit reurn the 'filed-name' entry point after the last
key field to indicate to describe that you atre switching to
the data field section of the record and the same after the last
data field to indicate all fields are entered and you want to
get to the command menu for further operations on your data or
to save and then exit
The best way to see this hamlessly is to open a newcli or ashell,
whatever and (with the path of these commands added to your list)
type in "describe". You'll see the usage message. Then try "describe
sxx.d". when it comes up read the message and notice the "Key Fields"
line. Enter a return and then notice "Data Fields". Enter a return
and you should see the command line. Type for exit. Next type in
'describe +l /demo/diary' to see a list of the 'diary' file
organization. ('describe >PRT: +l /demo/diary.d' to output on your
printer) . Next try 'describe /demo/diary.d' to bring up the program.
When used on an existing descriptor it will go straight to the menu
edit mode. Try the 'list', then the 'abandon' options.
Once you have a descriptor file you and describe like, you need to
create the actual data and key (index) files by using the 'newkf'
utility. So type in "newkf <your-filename>" and it will come back with
"'your-filename' created". Now try some of the other utilites on
your file to see what they return such as the following:
kfcheck <your-filename> - checks the index for corruption
kfdet <your-filename> - tells you the keylenght amd record length
of your file.
kfri <your-filename> - rebuilds the index of your file
Other program syntax
---------------------
describe filename.d (descriptor file editor)
reformat old-filename new-filename (assumes new-filename is created
but empty
cf filename[.f] (produces a pcode file filename.g)
cr filename[.r] (produces a pcode file filename.q)
sg filename[.d] (produces a source file filename.f)
rg filename[.d] (produces a source file filename.r)
sage filename.g [arg1 arg2] ( run a sage program)
sagerep filename.q [<printer> arg1 arg2] .....
menu menuname.m (display a textfile called menuname.m
and execute commands from it.
NOTE preceed all comnmands with a '-'
as in the examples without
redirectiion (see BUGS))
Ok now we have a database file and teh simplest way to create a
program to maintain this file is to type in "sg <your-filename>".
The 'sg' program will create the source code file for an editor of
your-filename and then complie it using 'cf'. Now you typer in 'sage
your-filename" to run the editor program. Similarily the 'rg' program
will create a list program for 'your-filename' and you may run it by
typing in "sagerep your-filename". While 'sg' and especially 'rg'
do not create elegant programs they are a very speedy way of getting
all the field names (and their headings in the case of rg) into a text
file that you can edit and recomplie as much as your ol' head desires.
Note if your file contains so many fields that 'sg' can not figure out
how to fit them on the vaailbale screen you can use the '-a' option to
interactively design what you will display and enter for this program.
This option is also available for 'rg'.
Whether you build the program via 'sg/rg' or from scratch with an editor
'Decsion Plus' (TM) allows you to overwite the '.d' descriptor heading
and/or format within any particular program.
REVIEW the examples in '/DEMOS', they will help but if you find this
language as much fun and as useful as I, then a manual is a must for
building greater things. It is not practical to reproduce all of here.
------------------------ tear here ----------------------------------
Sage/Sagerep Syntax Synopsis: ( statements starting with '!' appear in the
same order as they should in a program -
not absolutely necessary but good style,
and all temps declared within a program
are global ie accessable even from a i
subroutine)
!file logical-filename/number [path/]name (driving file in sagerep)
!cfile logical-filename/number [path/]name (closed file after startup)
!xfile logical-filename/number [path/]name [key=field_name]
cross_reference file or "joined file"
!record file-name/number [path/]name (alternate record layout of file )
!temp name,[title],type&size,[format],[limits]
!init expression (occurs before first record read (sagerep only))
!title expression (occurs after first record read (sagerep only))
!scroll x,y starting scroll array area an number of lines (sage only)
!depth n : depth of page in lines (sagerep)
!width n : width of page in columns (sagerep)
!gap n :
!constant name,[heading],type&size[,format]='value'
!input 'string-prompt',field-name (sagerep only)
!startrec key=field-list
!startrec key=field-list
!select if (field-name <conditional expression>....)
!exclude if (if field-name <conditional expression> .....)
!on starting field-name (in driving file, sagerep only)<expression> ......
!on ending field-name (in driving file, sagerep only)<expression> ......
!footnote <statement [: statement] ...... >(sagerep only)
!final <statement [:statements] ......> (sagerep only)
. ... Any line starting with a period is considered a comment line
. Any regular statement ending with a backslash ('\') is considered
. to be continued on the next line.
!display (message-string ) sagerep only
Logic Flow
if ..then ... [else ....] (same line or continued line with a '\')
gosub [label],
goto [label]
Keyed File opearations
check logical-file [nrs=label] (nrs - no record currently selected )
close logical-file
delete logical-file [nrs=label nrs=label]
insert logical-file [re =label ( re - record already exists on insert)
next logical-file [nsr=label riu=label] (riu-record in use(locked))
open logical-file
prev logical-file
preserve logical-file (preserve current record data on clear)
rewind logical-file [nrs=label]
trynext logical-file [nrs=label]
readkey logical-file [nsr=label riu=label]
testkey logical-file [nsr=label] (nsr-no such key found in file)
write logical-file [nrs=label] (nrs-no current rec selected for update)
Common
exit - exits program cleanly.
abort - exits program immediately.
end - indicates the end of a major logic section or option
sleep - cause program to sleep or suspend for n seconds.
Screen only
check logical-file :do we currently have record in hand from file 'file'?
display field-list
highlite field-list
clear field-list
input field-list [eoi=label ni=label] (eoi= end of input char &
ni= no input)
message "string expression" -displays message at bottom of screen)
error "string expression" - displays error message at bottom of screen
scroll n - move to position 'n' in array
prompt "string expression" -displays prompt at bottom of screen and
waits for 'y' or 'n' input
Report Only
print field-list or quoted string
keep n lines - do 'top of form' an "depth-n" lines
Arithmetic
+(add), -(subtract), /(divide), *(mulitply), %(modulo)
Comparitive
<, >, =, <>, <=, >=
------------------------- the end -----------------------------------