<#>(PAGEMODE)
┌───────────────┐
│ PageMode Keys │
└───────────────┘
Alt_H:     Help
Alt_S:     Submenu for services on file,
           search etc
Alt_W:     Window edit/view mode
Alt_T:     Toggle view/edit mode. When toggled
           to viewonly mode, keys Alt_A,
           Alt_D and Alt_R will lose effect.
Alt_G:     Go a particular record
Alt_A:     Append a new record at the end
           of database (to insert at the
           current record position, see
           edit of submenu)
Alt_D:     Delete current record
Alt_R:     Recall deleted records
Alt_M:     Mark area as scratch text
Alt_E:     Escape: once to leave edit mode,
           twice to quit completely
Alt_X:     Brutal exit/abort

Alt_F:   First logical record
Alt_L:   Last logical record
Alt_P:    Previous logical record
Alt_N:    Next logical record
PgUp:     Previous page if available
PgDn:     Next page if available
^Home:    First entry in current page
^End:     Last entry in current page
Home:      Leftmost position
End:       Rightmost position
^PgUp:     First page
^PgDn:     Last page

F1:        Help
F2:     #  Check the relative cursor position
           inside input buffer
F3: Alt_W  Edit or view database in a
           line-per-record mode.
           Note that in the case of limit
           being exceeded in 50 line mode,
           for instance, a 25 line mode
           may still be within the limit.
           Momo edit has largest width in
           the mode than in the other ones
F4: Alt_M  Screen-Keyboard-Logfile swapping
           utility
F5:     ≈  Total number of filtered records,
           with current record number
F6:        Current date and time
F7:       Workarea toggle
F8:       Select a workarea
F9:    «»  Browsing current all records
           of current field, with search
           algorithm
F10:      Toggle specific filter provided by
           the related print design file
Alt_F10:!  Choose an external codeblock to
           execute
Alt_F1 - Alt_F9:
           Special external codeblocks
^F1:       Text dump of non-memo fields,
           reporting sum on each numerical
           field at the end
^F10:      Call up or create a map, map
           altered in non-edit mode will be
           ignored


┌───────────┐
│ Map  Keys │
└───────────┘
TAB:       Edit current map entry, or toggle
           editing region
CTRL_LEFT_ARROW:
CTRL_INS:  Insert in front
CTRL_RIGHT_ARROW:
INS:       Insert in behind
DEL:       Delete current entry

Browsing in map list supports entry search when in upper cases.


┌───────┐
│ Mouse │
└───────┘
Left:    Pick item
Right:   Return key
Both:    Escape once
(#)(PAGEMODE)



<#>(EDITDBAREA)
┌─────────────────┐
│ WindowMode Keys │
└─────────────────┘
In this mode, each record is displayed in a horizontal line.

ENTER:     Edit/view current entry
TAB:       Toggle automatic search mode.
           If <seek off>, then an
           unrecognised key will start
           editing the entry immediately.
           If in <keyseek> mode, then
           instead the pressed key will
           be searched from the current
           field of all records.

           Upper case letters etc will
           enable string search (with
           SPACE BAR to restart search
           string), while in other cases,
           only letter searching is
           performed.
Alt_G:     Goto record by number
Alt_I:    Select controlling index
Alt_F:   ╬ Toggle filter mode
Alt_T:     Toggle view/edit mode
Alt_S:   * Search for a string
Alt_=:   	 Mark (tag) current record for
           duplication into others

F1:      ? Help
F2:        Current cursor position, when
           editing area is focused
F3:      « Reverse search
F4:        Area marking
F5:      ≈ Record number report
F6:        Current time and date
F7:       Toggle workareas
F8:       Select workarea
F9:      » Forward search
F10:      Toggle external filter

Alt_F10: ! Choose an external codeblock
           to execute
Alt_F1 - Alt_F9:
           Execute special external codeblock

Following keys are active in edit mode only.

DEL:     - Delete record toggle
INS:     + Insert empty record at the end
^ENTER:   Append tagged record at the end
Alt_-:    Copy tagged record into current
           record number, pushing all the
           existing records behind by 1
Alt_0:     Same as Alt_-, except empty
           record is inserted
(#)(EDITDBAREA)


<#>(WINDOWSEARCH)
┌────────────┐
│ Search Pad │
└────────────┘
EDIT STRING:
edit a string to be searched
MARK FIELDS:
choose fields that are to be searched
START SEARCH:
search from top record
CONTINUE SEARCH: (F9)
search from next record
REVERSE SEARCH: (F3)
reverse search from previous record
BOTTOM SEARCH:
reverse search from bottom
TOGGLE MODE:
toggle search matchmode
■ Field Match
    - match whole fields up leading
      and trailing spaces
■ Substring Match
    - match as a substring
(#)(WINDOWSEARCH)



<#>(SCR_KEY_LOG)
┌──────────────┐
│ Area Marking │
└──────────────┘
MARK AREA:
use keys or mouse to mark an area and translate it into a string (more help later on)
EDIT MARKED:
line-edit the marked area
ADD TO LOG:
add marked area to a log buffer
FLUSH AS KEYS:
flush marked area as a character string into keyboard buffer (proceed with caution)
REVIEW LOG:
edit the log buffer
SAVE LOG:
save log buffer to a file
NO LINEFEED:
all lines in the marked area are linked directly
WITH LINEFEED:
each line in the marked area is added a CR-LF at the front before it is joined with other marked lines
LOAD FILE:
load a file into the log buffer
DELETE LOG:
delete current log buffer
OUTPUT LOG:
flush log buffer into keyboard buffer (proceed with caution)

NOTE:  Avoid marking controlling characters, as they will be most likely to be interpreted as the unwanted keys or actions should they are flushed as keys.
(#)(SCR_KEY_LOG)



<#>(MARKAREA)
┌───────────┐
│ Mark Area │
└───────────┘
VIA KEYS:
Use array keys to move the initial position, then use CTRL_LEFT, CTRL_RIGHT, CTRL_PGUP and CTRL_PGDN to move to an end position. Any other key will mark the highlighted area unless ESC key is pressed.

VIA MOUSE:
Click left button and keep it down while draging out a highlighted area. The area will be marked when you release the button. If in the middle of draging the mouse you want to restart with a new initial point, just click the right button while the left button is still being pressed.

Mouse has priority over keys: if an area is being marked via keys, then a valid mouse click will restart the marking process through the mouse.
(#)(MARKAREA)



<#>(CREATFILTER)
┌───────────────┐
│ Create Filter │
└───────────────┘
INS:     add a new field above
TAB:     add a new field below
DEL:     delete current field
SPACE:   toggle in Mode column
CR:      enter new data
CTRL-CR: complete and return
ESC:     restore last field filter
         setting

Filter Mode:
STR:     search for a substring
FLD:     search for complete match
         of a whole field
BLANK:   current field is not active
         in filtering records
(#)(CREATFILTER)

<#>(CREATSTRUCT)
┌──────────────────┐
│ Create Structure │
└──────────────────┘
INS:     add a new field above
TAB:     add a new field below
DEL:     delete current field
CR:      enter new data
CTRL-CR: complete and return
ESC:     quit
(#)(CREATSTRUCT)

<#>(MARKFIELDS)
┌─────────────┐
│ Mark Fields │
└─────────────┘
INS:     mark all fields
DEL:     unmark all fields
SPACE:   mark/unmark current field
CR,ESC:  complete and return
(#)(MARKFIELDS)

<#>(QUERY)
┌───────┐
│ Query │
└───────┘
Please answer accordingly.
(#)(QUERY)

<#>(MESSAGE)
┌─────────┐
│ Message │
└─────────┘
A message is meant to be a message.
(#)(MESSAGE)

<#>(MEMOSHOW)
┌──────────┐
│ Memoedit │
└──────────┘
Ctrl-W:   save and return
ESC:      quit without save

^BKSP:
^Y:       delete current line
^T:       delete word right
Alt_Y:    delete the whole content
Alt_U:    delete up (all previous text)
Alt_D:    delete down (all following text)
^HOME:    beginning of current window
^END:     end of current window
^PGUP:    beginning of file
^PGDN:    end of file

HOME:     beginning of current line
END:      end of current line
ENTER:    beginning of next line
^A:       a word left  (^LEFT_ARROW)
^F:       a word right (^RIGHT_ARROW)
^N:       insert a line above

Alt_S:    edit search string and search forward
Alt_F:    forward search
Alt_R:    reverse search
Alt_P:    toggle showing line/column position
Alt_L:    length of current file buffer

Alt_I:    insert a file in edit mode
Alt_W:    save to a file in edit mode,
          otherwise is same as ^W in view mode
F4:       mark and paste (avoid marking
          controlling characters)
(#)(MEMOSHOW)

<#>(INPUTFILENAME)
┌────────────────┐
│ Input Filename │
└────────────────┘
Use ESCAPE to take the default name if you are in the browse state, press RETURN to confirm. If there are wild characters in the input name, a list of matched filenames will be given for selection.

PGUP:    page up
PGDN:    page down
HOME:
^PGUP:   first entry
END:
^PGDN:   last entry
^HOME:   first entry in current window
^END:    last entry in current window
(#)(INPUTFILENAME)

<#>(YESNO)
┌───────────┐
│ Yes or No │
└───────────┘
Make your choice, ESC= default.
(#)(YESNO)

<#>(GETVARIABLE)
┌───────────┐
│ Line Edit │
└───────────┘
CR:    updates with new value
ESC:   retains the old value
(#)(GETVARIABLE)

<#>(ADDUPENTRY)
┌─────────────┐
│ Edit Record │
└─────────────┘
CR in browsing mode updates the change.
(#)(ADDUPENTRY)

<#>(CHOOSEINDEX)
┌───────┐
│ Index │
└───────┘
Choose any field as the index key or edit the User Defined Index entry for  a combination of them.
(#)(CHOOSEINDEX)

<#>(TWOCHOICE)
┌────────┐
│ Browse │
└────────┘
Click the highlighted bar to make a choice.

When you are allowed to edit in a two-column mode:
CTRL_LEFT_ARROW:
CTRL_INS:          insert in front
CTRL_RIGHT_ARROW:
INS:               insert in behind
DEL:               delete map entry
TAB:               edit current entry
(#)(TWOCHOICE)


<#>(GENERAL)
┌─────────┐
│ General │
└─────────┘

DBM is designed to handle database in free format or user created format, and is particularly oriented to the management of database files with huge number of fields. DBM also carries a simple text editor.

DBM can be used to conduct daily business affairs or process questionnaires because it supports user-defined screen display via format file (*.DBM) and print and other tasks via print design file (*.DBP), along with translation maps (*.MAP) which can be dynamically constructed at the run time and display more meaningfully. However the contents of screen format files and print design files must be edited with care.

A format file (*.DBM) pin-points the places for (chosen) fields to be displayed. This way we may just display partially the database which is very useful to curb user's power to alter data unintentionally. Should format file contain certain fieldnames foreign to the related database, the format will not be used.

A map file (*.MAP) is a database with two character fields with the first field representing displayed "meaningful" string and the second field representing the actual storing string or translation.

A print design file (*.DBP) is another type of database file users can configurate themselves. It mainly contains the commands that will control the printing of the related database, i.e. print out what under what conditions. Print design file may also contain other external action commands which are related to the particular database file. These externally supplied action commands can be chosen arbitrarily for execution later on.

DBM can be run alone, or in combination with DBM.HLP and user created format (*.DBM, *.MAP, *.DBP) database files. Online help is available anywhere by pressing F1 key. If no particular help exists for that area, the nearest available help will be given.

Some nonimportant messages, particularly those in the brown color, will timeout themselves. If no keys are pressed, such messages will stay on screen for two seconds and then blink for another one and half seconds before they time out. To hold the message, press ^H before it times out. If any other keys are pressed before messages time out, the messages will disappear as if they are never there in the sense that the newly pressed keys will be processed by program as if the keys were pressed after the messages timed out.

DBM supports IBM 25x80, 43x80 and 50x80 screen modes. If you have a VGA monitor, you could even set it to 43x132 screen mode, though you would have to set it before using DBM. You may also disable unformatted editing by option "/!", so that the user is only allowed to view and edit pre-determined fields of the pre-given database files entered at the command line. Option /? will show you how to initiate them.

DBM also implicitly supports user added help. By editing DBM.HLP accordingly, user's own prompt help may be added. The online help will reformat the help message line by line to fit into the help window except for those whose lengths are no greater that the help window. If default help file DBM.HLP is not found in current directory, it will look for the file specified by the environmental parameter DBMHELPFILE, unless option /+helpfile is specified on the command line. If help is not available at one level, previous level of help will be displayed.

Should format or print design files adopt new database structures for newer version of DBM due to the extension, then the old files should be easily convertible to new forms (and vise versa) by just merging the old file into a new file created by the current version of DBM program via its submenu.

┌──────────────────────┐
│ Command line options │
└──────────────────────┘
DBM  [/?] [/25] [/43] [/50] [/c] [/cc] [/ccc]
     [/a] [/b] [/d] [/m] [/n] [/w]
     [/!] [/!!] [/la] [/lb]
     [/l#] [/+help] [/:initial] [//f:num]
     [dbfile,format,prndesign,index1,...] [...]

DBM  /ab|/ae textfiles [...] [/25] [/43] [/50]
     [/c] [/cc] [/ccc] [/m] [/d]

/?         help on command line options
/25        25 line screen
/43        43 line screen
/50        50 line screen
/c         color monitor (default)
/cc        color different from /c option only
           in pagemode, useful for removing the
           background-highlight effect
/ccc       color choice in slightly altered
           setting, useful for non-conventional
           color monitors
/a         date in American format mm/dd/yy
/b         date in British format dd/mm/yy
/d         disable mouse, useful if your local
           mouse driver is unable to support
           properly such as the 43x132 text
           screen
/m         monochrome monitor
/n         no initial link via index or filter.
           index/filter in pagemode will not be
           passed on to windowmode initially,
           unless it is been toggled explicitly
           in the windowmode
/w         display initially set to windowmode
/ab        browse ascii text
/ae        edit ascii text files
/la        memoedit line length adjusted to
           window size
/lb        text edit with borderlines, when
           combined with /ab or /ae option
/l#        (40≤ # ≤250) line length set to #
           characters (default #=250)
/v         global view only: none of the main
           databases are allowed to edit
/!         disable edit mode and submenu for
           nonformatted databases
/!!        disable edit,submenu and window view
/+help     "help" is the name of the help file
/:initial  "initial" is the number of order of
           the database files, which indicates
           which database is to be initially
           displayed
//f:num    max number of open files allowed
dbfile     first database file
format     format filename
prndesign  print design filename
index1     index file

Database file <dbfile> can contain wildcards if the coresponding <format>, <prndesign> and <index> are not given explicitly.

Format file defaults to the same name as database file with extension .DBM, and similarly the associated print design file, with extension .DBP.

You may even run DBM in 43x132 screen mode if you have a VGA, so long you set your monitor screen externally to that display mode first, via for example the use of command "SCREEN.COM 2". Moreover, if you have a VGA monitor and set it to simulate CGA, you may actually like the effects.

We note that sometimes a screen, particularly in the 132 column mode, may exhibit `weird' color combination. In such cases, the apparently redundant options "/25" etc often fix the color to the right setting.

┌──────────────┐
│ Iron options │
└──────────────┘
IRON  dbm.exe [!|B|M|N][!]

[!|M|N][!]  - forces options /!, /B, /M, /N, or /!! to dbm.exe

The purpose of ironing an option to an executable file is to keep the end users from editing or viewing unauthorised data.

Because the ironing process is currently not reversible, make sure you save a copy of the original dbm.exe before you add the option forcefully. Better still, you could copy dbm.exe to e.g. dbn.exe, and then use "IRON DBN.EXE !" to add /! option to dbn.exe.

┌─────────────────┐
│ VGA 132 columns │
└─────────────────┘
SCREEN  0|1|2       -  0=25x80    1=25x132     2=43x132

If you have a VGA monitor, you could use a wider text screen of 132 columns by the above use of SCREEN.COM.

┌───────────────┐
│ Scratch files │
└───────────────┘
Three scratch files named _IDX@#$.TMP, _PRN@#$.TMP and _DBM@@#$.TMP in the working subdirectory should not be used for other purposes. They may be overwritten without warnings.
(#)(GENERAL)



<#>(PROGRAM)
┌─────────┐
│ Program │
└─────────┘

SCREEN FORMAT DATABASE (*.DBM)
──────────────────────────────

FNAME:     field name
MODE:      edit strategy mode
           1=normal variable
           3=memo variable
           4=character field masked by
             interpretation
           5=memo display directly via
             input region, edit/view in
             larger area
           6=memo display directly, edit
             or view in input region
PAGENO:    which page to include the field
MAPFILE:   map filename for Mode=4
PROMPT:    prompt name for field name
PROW:      starting row of prompt
PCOL:      starting col of prompt
PWIDTH:    width of prompt
ROW:       row of input region
COL:       col of input region
WIDTH:     width of input region
HEIGHT:    height of input region for memo
VIEWMODE:  editmode when under viewonly mode
           0=default: view only
           1=allow to edit even under
             viewonly mode
PCOLOR:    new color string for the prompt
           e.g. "W/R" (""=take the default)


ALLOWED STRUCTURE:

          {"FNAME","C",10,0},
          {"MODE","N",3,0},
          {"PAGENO","N",3,0},
          {"MAPFILE","C",160,0},
          {"PROMPT","C",100,0},
          {"PROW","N",3,0},
          {"PCOL","N",3,0},
          {"PWIDTH","N",3,0},
          {"ROW","N",3,0},
          {"COL","N",3,0},
          {"WIDTH","N",3,0},
          {"HEIGHT","N",3,0}
          {"VIEWMODE","N",3,0},
          {"PCOLOR","C",10,0}

A database file of structure different from the above will not be considered as a valid format file.

We note that although PWIDTH=0 will imply that no prompt is to be displayed, the values of PROW and PCOL will still be used to calculate the 'clear all' rectangular area. Likewise for other similar fields.


PRINT DESIGN DATABASE (*.DBP)
─────────────────────────────

PRN_MODE:   0=continue
            1-13,100= ...
H_SKIP:     horizontal skip of columns before
            executing the codeblock, if
            prn_mode!=0
MAX_LINES:  execute current block will print
            out max_lines of text, whenever
            meaningful
CODE_BLOCK: external code block in a string
CODE_NAME:  string name for choosing an
            external codeblock to execute

Code block specified by CODE_BLOCK field may
take three arguments
   nLeftSkip  - fixed horizontal skip
   nLineCount - current line number in
                current page
   nPrintMode - 0=display any informative
                  messages
                1=program requests quiet,
                  whenever possible
However, in the PrePrintBlock (Prn_Mode=9), the first two parameters are automatically passed as 0.

If current print block is non-empty with PRN_MODE!=0, and that the previous block is also nonempty and returns a non-zero value 1, then an extra horizontal skip of LEFTSKIP, specified in the case of PRN_MODE=1, will be done before the execution of the new codeblock. We note that a nonzero value returned by code block also implies that the MAX_LINES has been fulfilled by the codeblock.

ALLOWED STRUCTURE:

           {"PRN_MODE","N",3,0},
           {"H_SKIP","N",3,0},
           {"MAX_LINES","N",3,0},
           {"CODE_BLOCK","C",300,0},
           {"CODE_NAME","C",20,0}

A database file will not be considered as a proper print design file if its structure is different from the above other than perhaps for the width of CODE_BLOCK so that long codeblock can be entered.


PRN_MODE:

 0=no horizontal skip before executing
   current codeblock -- current block
   regarded as a continuation of a previous
   block which has a non-zero mode
 1=in this mode, H_SKIP and MAX_LINES are
   the line width (not in use) and the
   horizontal column skip number respectively
 2=in this mode, H_SKIP and MAX_LINES are
   the page height and the vertical line skip
   number (not in use)
 3=code block for the title of printout
 4=code block to print each valid record
 5=block to handle end of a pagebreak
 6=block to handle start of a new page after
   a page break (due to long printout)
 7=code block for printing end remark of
   printout
 8=help string to be sought in DBM.HLP
 9=codeblock that decides if a printout is to
   be done at all (no-zero value to print)
10=codeblock to perform after printout, it
   will be executed even if printout is not
   performed due to zero return of block in
   mode 9.
11=filter in string or codeblock for filter
   toggle specific to related database.
   If the starting character is "{", then
   it is a codeblock, otherwise it will be
   considered that the string a already an
   expression for the filter
12=view/edit mode
   0=ignore this entry
   1=view only for this database
   2=edit allowed
13=external codeblocks for some jobs specific
   to the related database. The strings in
   specified in 8. will be used as the name
   of such codeblocks when choosing them.
   The first 9 executable blocks will be
   assigned to keys Alt_F1 to Alt_F9
14=same as mode 13, apart from that they
   are never assigned to keys Alt_F1 to
   Alt_F9. Instead, they must be called via
   Alt_F10.

100=initialisation codeblocks. It will be
   run immediately after the print design
   file is read in. Only the first block
   of consecutive records, which have
   PRN_MODE equal to either 100 or 0, will
   be regarded as the initialisation blocks.
   Error at running initialisation will not
   be reported: so it is the block's job
   to report any execution error.


EXTRA FUNCTIONS:
   RecTotal()
      - total number of filtered records
   PrintView(nWhichArea)
      - execute print/view external code
   Eject()
      - page eject
   Pack()
      - pack current database
   AppendTo(xFile,bCondition,lQuiet)
      - append all current records
        satisfying bCondition, to database
        file xFile or workarea number
        xFile. If lQuiet is true, no
        summary will be reported
   Z_0(nNum)
      - get codeblock of nNum-th position
        of public block stack
   Z_1(nNum)
      - get string representation of
        current last position of the
        external-block stack


TRANSLATION MAP DATABASE (*.MAP)
────────────────────────────────

The first two fields serves as the mapping

FIELDGET(1)=translated value
FIELDGET(2)=original index

Database of less than two fields are ignored. All map will be stringfield and maps are applicable to string type fields only.


USERS' SCRATCH PUBLIC VARIABLES
───────────────────────────────

The are 31 public scratch variables which can be used inside the configurable print design files. These variables are X_0, X_1 to X_30 and should be considered as temporary variables. For more permanent global variables, use the global storage array. If field CODE_BLOCK starts with character other than "{", then the translated codeblock will be appended to the storage array. For the position of the last stored block, Z_1(0) is the number in string format (so that it can easily be macro expanded via &). For th

Typically, we
   1. stashblock {|| block1}
   2. x_1:=Z_1(0)      -- gives the position
          This operation is again stashed to
          Block_list{}, although useless.
   3. stashblock {|| block2}
   4. stashblock {|| block3}
   5. x_2:=Z_1(-1)
   6. x_3:=Z_1(-1)
   7. {||&x_1,&x_2,&x_3}

We note that once 7. is read in, the code block will no longer need private/public variables x1,x2,x3. This way, reading external codeblocks will not exhausts the scratch public variables defined inside the program. All stashed codeblocks remain available all the time until a LOAD NEW DATABASE command (which will first close all workareas) is performed.


EXAMPLES
────────

1. The following record in a print design file will calculate the total number of records in related main database file which, under the current filter, have a nonzero 13-th field. In the case of STOCK.DBP, a nonzero 13-th field is a request for that item.

 PRN_MODE:    10
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:   {|x,y,z| ;
      x_1:=rectotal("fieldget(13)!=0"),;
      IF(x_1!=0 .and. z=0,;
      Message(alltrim(str(x_1))+;
      " records printed"),)}
 BLOCK_NAME:  PostPrintBlock

where x=leftskip, y=linenumber and z=messagemode (1=quiet).


2. The following 5 consecutive print design records will set the 13-th field of the related database to 0 value, under current filter.

 PRN_MODE:    13
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:   if(.f.,, {||fieldput(13,0)})
 BLOCK_NAME:   <step-1>

■ i.e. save codeblock {||fieldput(13,0)}) to a designated public stack for future use.


 PRN_MODE:    13
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:  if(.f.,,{||x_1:=fieldget(13)!=0,;
      if(x_1,x_3:=x_3+1,),x_1})
 BLOCK_NAME:   <step-2>

■ i.e. save codeblock {||x_1:= ...} again to the public stack.


 PRN_MODE:    13
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:   if(.f.,, x_1:=z_1(-1))
 BLOCK_NAME:   <step-3>

■ i.e. get the stack pointer in string that points to the block in <step-1>


 PRN_MODE:    13
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:   if(.f.,, x_2:=z_1(-1))
 BLOCK_NAME:   <step-4>

■ i.e. get the stack pointer x_2 that points to the block in <step-2>


 PRN_MODE:    13
 H_SKIP:       0
 MAX_LINES:    0
 CODE_BLOCK:   {||x_3:=0,;
      dbeval(z_0(&x_1),z_0(&x_2)),;
      if(x_3>0, message("Sales on "+;
      alltrim(str(x_3))+" items removed"),)}
 BLOCK_NAME:   Cancel Sale

■ the macro expansion of x_1 and x_2 is done at the time of loading the above records. Thus x_1 and x_2 are available for other uses once these print design records are read in. Variable x_3 however will be active only when the final (visible) block is being executed.
(#)(PROGRAM)




<#>(REGISTER)
┌──────────┐
│ Freeware │
└──────────┘
DBM is a freeware or cardware - it is free to all users.

If you find DBM useful to you, please send me a postcard as an incentive for future upgrades. Please send the card to Z JIANG, c/o DATA MIRACLES, Post Box 787, Armidale NSW 2351, Australia.
(#)(REGISTER)


<#>(TOPDOWN)
┌──────────────┐
│ Topdown Menu │
└──────────────┘
MOUSE:
Drag mouse with left button pressed. While left button is still being pressed, click right button on an entry to goto a deeper level of submenu if present, and click right button on the upper borderline of the square box to escape to a previous level.

Click right button on bottom borderline to exit menu completely and unconditionally, i.e. equivalent to pressing NUM-DEL key.

SEARCH ORDER:
Search first matched capital letter starting from the next item. If the match is unique, it will be immediately chosen. Otherwise highlight the next matched item.

If no capital letters can match the user key_in_ed letter, highlight the item whose first letter matches.

ALT-key is the quickest way of getting a new topline menu item.
(#)(TOPDOWN)


<#>(TOPDOWN)_1
┌──────┐
│ File │
└──────┘
LOAD:
load in new database or format file
WRITE DBFILE:
save current database: only the non-deleted and filtered records are saved
SAVE MAPS:
save the maps to database files; the editmode copy of maps are saved if they are different from the viewmode copy.
CONVERT FILE:
database/text format conversion
DB COMMIT:
flush memory into database
REMOVE:
Close current workarea/database
PACK:
physically remove all deleted records of current workarea
PRINT:
send output described by the print design file to printer PRN
EDIT PRINT:
edit first the output described by the print design file before sending it to either a file or the printer PRN
SHELL:
temporarily exit to DOS, type EXIT to return
QUIT:
leave DBM completely
(#)(TOPDOWN)_1

<#>(TOPDOWN)_1+10
┌───────┐
│ Shell │
└───────┘
Exit to DOS temporarily; type EXIT to return.
(#)(TOPDOWN)_1+10


<#>(TOPDOWN)_1_1
DATABASE ADDED:
add a database to a new workarea
FORMAT FILE:
get a format filename for loading next database
PRINT DESIGN:
get a print design filename for loading next database
NEW DATABASE:
close all workareas then load a new database
(#)(TOPDOWN)_1_1


<#>(TOPDOWN)_1_1+1
┌───────────────┐
│ Load Database │
└───────────────┘
You are about to load in a new database file in a new workarea.
(#)(TOPDOWN)_1_1+1

<#>(TOPDOWN)_1_1+2
┌─────────────┐
│ Load Format │
└─────────────┘
You are about to load in a new format file which will be used when you load the next database file.
(#)(TOPDOWN)_1_1+2


<#>(TOPDOWN)_1_1+4
┌──────────────┐
│ New Database │
└──────────────┘
Close all database files before opening a new workarea.
(#)(TOPDOWN)_1_1+4





<#>(TOPDOWN)_1_4
┌────────────┐
│ Conversion │
└────────────┘
COPY TO:
copy current workarea to a text file
APPEND FROM:
append records to current workarea from a text file
STYLE:
toggle conversion convention for the above two tasks
DB2ASC:
convert database into an ASCII file
ASC2DB:
convert ASCII file into database file
MODE:
change conversion mode for the above two tasks

Special markings in TRUTHFUL mode
%+      start of a record
%+*     start of a deleted record
%-      memo field ends

A leading %+ in any field will thus be replaced by %+%+ in the converted ASCII file, a leading %- in each line of a memo field will be replaced by %-%- similarly.
(#)(TOPDOWN)_1_4

<#>(TOPDOWN)_1_4_6
┌─────────────────┐
│ Conversion Mode │
└─────────────────┘
TRUTHFUL:
Conversion between DBfile and ASCII file is reversible
DUMP:
DBfile is dumped into text by separating each record by an empty line; only nonempty fields or nonempty lines in  memo fields are dumped.
(#)(TOPDOWN)_1_4_6



<#>(TOPDOWN)_1_4_3
┌──────────────────┐
│ Conversion Style │
└──────────────────┘
SDF:
system data format
DELIMITED:
as delimited strings
(#)(TOPDOWN)_1_4_3



<#>(TOPDOWN)_2
┌──────┐
│ Edit │
└──────┘
FORMAT FREE:
current record can be edited with fieldname given at the bottom line.
INSERT RECORD:
insert a record at the current record number, pushing backwards all the remaining records.
DUPLICATE RECORD:
insert current record to any record of any workarea
MERGE FILE:
append new database file into the current workarea.
PREVIOUS RECORD:
goto previous entry
NEXT RECORD:
goto next entry
TOP RECORD:
goto first record
BOTTOM RECORD:
goto last record
GOTO RECORD:
goto any record specified by a record number
SELECT WORKAREA:
Select one of the previously opened workarea/database

Note that hot key F5 displays current record number and the total number of records that are filtered through.
(#)(TOPDOWN)_2

<#>(TOPDOWN)_3
┌────────┐
│ Locate │
└────────┘
EDIT STRING:
input search string
MARK FIELDS:
mark those fields for the string search
START SEARCH:
search from the first record
CONTINUE SEARCH:
search from the next record (Alt_= in pagemode, valid if last submenu operation is also a search operation)
REVERSE SEARCH:
search from the previous record
FROM BOTTOM:
search from the last record
MATCH MODE:
toggle search mode for substring match or whole string match
(#)(TOPDOWN)_3


<#>(TOPDOWN)_3_7
┌────────────┐
│ Match Mode │
└────────────┘
SUBSTRING:
match if search string is a substring of a marked field
WHOLE:
match if search string is same as a marked field up to leading and trailing spaces
(#)(TOPDOWN)_3_7

<#>(TOPDOWN)_4
┌───────────┐
│ Structure │
└───────────┘
NEW STRUCT:
create a new structure file
ED STRUCT:
edit from current structure
DUPLICATE STRUCT:
copy structure from one database to another
WRITE FORMAT STRUCT:
make a standard format structure
PRN DESIGN STRUCT:
make a typical print design structure
(#)(TOPDOWN)_4


<#>(TOPDOWN)_4+4
┌──────────────────┐
│ Format Structure │
└──────────────────┘
A format database (*.DBM) has fields:
FNAME:     field name
MODE:      edit strategy mode
           1=normal variable
           3=memo variable
           4=character field masked by
             interpretation
           5=memo display directly via
             input region, edit/view in
             larger area
           6=memo display directly, edit
             or view in input region
PAGENO:    which page to include the field
MAPFILE:   map filename for Mode=4
PROMPT:    prompt name for field name
PROW:      starting row of prompt
PCOL:      starting col of prompt
PWIDTH:    width of prompt
ROW:       row of input region
COL:       col of input region
WIDTH:     width of input region
HEIGHT:    height of input region for memo
VIEWMODE:  editmode when under viewonly mode
           0=default: view only
           1=allow to edit even under
             viewonly mode
PCOLOR:    New color string for the prompt
           e.g. "W/R" (""=take the default)

A map file is a database file (*.MAP) having two character fields with the first one as the translation of the second field.
(#)(TOPDOWN)_4+4


<#>(TOPDOWN)_4+5
┌────────────────────────┐
│ Print Design Structure │
└────────────────────────┘
A print design database (*.DBP) has fields:
PRN_MODE:   0=continue
            1-13,100= ...
H_SKIP:     horizontal skip of columns before
            executing the codeblock, if
            prn_mode!=0
MAX_LINES:  execute current block will print
            out max_lines of text, whenever
            meaningful
CODE_BLOCK: external code block in a string
CODE_NAME:  string name for choosing an
            external codeblock to execute

For more details, see PROGRAM entry of INFO.
(#)(TOPDOWN)_4+5


<#>(TOPDOWN)_5
┌────────┐
│ Review │
└────────┘
LOAD MAIN LOG:
load external file into main log buffer
EDIT MAIN:
edit main log buffer
WRITE MAIN:
save main log buffer to a file
LOAD SUBLOG:
load minor external file into sublog buffer
REVIEW SUBLOG:
edit sub log buffer
SUB TO MAINLOG:
append sublog buffer to main log buffer

NOTE: delete huge log buffers as soon as possible, so as to release the memory back to the pool
(#)(TOPDOWN)_5


<#>(TOPDOWN)_6
┌─────────┐
│ Utility │
└─────────┘
FILTER:
set and remove filters
INDEX:
make, load and add indexes
RELATION:
relate different database workareas
DUMP AND SUM
dump all fields (apart from memo fields) to screen/printer/file, with report on summations over numerical fields
(#)(TOPDOWN)_6


<#>(TOPDOWN)_6_1
┌─────────┐
│ Filters │
└─────────┘
USER DEFINED:
input a filter via a logic expression after disabling existing filters
FIELD STRING:
set up filter strategy upon the existing fields of the current area
NO FILTER:
disable the existing filters that are still in memory
VIEW FILTERS:
display which filter is currently in use in current workarea
(#)(TOPDOWN)_6_1



<#>(TOPDOWN)_6_2
┌─────────┐
│ Indexes │
└─────────┘
TMP INDEX:
make a temporary index file after closing existing ones
INDEX OFF:
remove any existing indexes
MAKE INDEX:
make a named index file and close existing ones
EXTRA INDEX:
load an extra index file, the old controlling index (if any) will remain in control
LOAD NEW:
load a new index file after closing all existing ones for the current workarea
PICK CONTROL:
select a controlling index from the already opened indices for the current workarea
REBUILD INDEX:
update all the index files in current workarea
(#)(TOPDOWN)_6_2


<#>(TOPDOWN)_6_3
┌───────────┐
│ Relations │
└───────────┘
ADD:
add a relation to the current workarea, so that the related child workarea will be sought simultaneously
DELETE:
delete all relations that take current database as parent workarea
VIEW:
list all the relations set with current workarea
PARENTS:
list all relational parental workareas
(#)(TOPDOWN)_6_3




<#>(TOPDOWN)_7
┌──────┐
│ Info │
└──────┘
GENERAL:
general description of DBM
PROGRAM:
some technicalities of DBM
FREEWARE:
distribution status of DBM
(#)(TOPDOWN)_7


<#>(SELECTWORKAREA)
┌─────────────────┐
│ Select Workarea │
└─────────────────┘
Choose a new database workarea.
(#)(SELECTWORKAREA)


<#>(SELECTINDEX)
┌──────────────────────────┐
│ Select Controlling Index │
└──────────────────────────┘
Choose one of the opened indices for the current workarea as the controlling index
(#)(SELECTINDEX)


<#>(SEARCHRECORD)
┌───────────────┐
│ Choose Record │
└───────────────┘
Choose a new record. Low case letter matches leading character if any, and upper case letters search for a substring.
(#)(SEARCHRECORD)



<#>(RUNEXTBLOCK)
┌─────────────────────┐
│ Run external blocks │
└─────────────────────┘
Choose an item to run for the current workarea. These action blocks are read in from the related print design file which have typically extension .DBP
(#)(RUNEXTBLOCK)



<#>(VIEWPARENTS)
┌──────────────┐
│ View Parents │
└──────────────┘
All relational parental workareas and their corresponding database filenames are listed.
(#)(VIEWPARENTS)


<#>(VIEWRELATIONS)
┌────────────────┐
│ View Relations │
└────────────────┘
All relational child workareas and the corresponding relations are listed.
(#)(VIEWRELATIONS)


<#>(LOWMEMORY)
┌────────────────────────┐
│ Memory Dangerously Low │
└────────────────────────┘
The memory sizes displayed are given in the order of
  (TextSize | LargestBlock/TotalFree/Runnable)

Conventional memory is detected to be dangerously low for the intended operation, which, if proceeded, may or may not cause the program to abort completely.

If YES is answered, no further similar questions will be asked in the current edit/view session.
(#)(LOWMEMORY)

