home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / HELPFILS.ZIP / AM_CTR_T.HLP < prev    next >
Text File  |  1991-07-02  |  17KB  |  316 lines

  1. APPLICATIONS MAKER - HELP FOR CONTROL TYPES
  2.  
  3. The  CONTROL  ITEMS relate to the program flow, or control,  of  your
  4. application.   They may be of nine types:  LABEL, GOTO,  GOBACK,  IF,
  5. DO, DO PRINT, BREAK, END and LOCATE.
  6.  
  7. LABEL ITEMS:  With the LABEL ITEMS a position on the screen to  which
  8. you may go (or BRANCH) is established.  The labels can be duplicated.
  9.  
  10. GOTO ITEMS:  With the GOTO ITEMS the application will branch  FORWARD
  11. to a label.  BREAK items will also be found by forward gotos.
  12.  
  13. GOBACK  ITEMS:   With the GOBACK ITEMS the  application  will  branch
  14. BACKWARD  to a label.  These items, when used in conjunction with  or
  15. as an argument of an IF ITEM, will allow you to create loops.
  16.  
  17. In the jargon of programming a LOOP is a series of instructions  that
  18. are   repeated  while/until  a  test  evaluates   true/false.    Each
  19. individual repetition of a LOOP is called an ITERATION.
  20.  
  21. LOOPS can be very useful.  They can also create LOCKUP if their  test
  22. never  evaluates  as planned.  If this happens to you just  hit  your
  23. escape key to halt the application.
  24.  
  25. IF ITEMS:
  26.  
  27. The  IF  ITEMS  provide the ability to do a set of  operations  IF  a
  28. certain requirement is met.  The targeted data is TESTED to determine
  29. whether  or not the requirement is met.  If it is the IF is  said  to
  30. EVALUATE  as true and the operations are executed; if not the  IF  is
  31. said  to  EVALUATE  as false and the set of operations  will  not  be
  32. executed.  This is known as CONDITIONAL processing.
  33.  
  34. STRUCTURE:
  35.  
  36. The structure of the IF ITEMS is identical to the same structures  in
  37. any  other program.  In the jargon of the programmer,  ARGUMENTS  are
  38. parameters  supplied to a function.  The ARGUMENTS for the  IF  ITEMS
  39. consist of a CONDITIONAL argument which defines the test to be  done,
  40. and up to ten EXECUTION ARGUMENTS which are to be carried out if  the
  41. test evaluates as true.
  42.  
  43. DEFINING THE CONDITION TO BE MET:
  44.  
  45. The  IF  ITEMS  can  compare any of the three  basic  data  types  in
  46. DATAMAGE files.  You may compare numbers to numbers (dollar-formatted
  47. fields are numbers), dates to dates or numbers or strings to strings.
  48. All  three  data types may also be compared to CONSTANTS,  which  are
  49. values  that  you  include in the IF ITEM.   You  may  NOT,  however,
  50. compare dates or numbers to strings, or vice-versa.
  51.  
  52. SYNTAX OF THE CONDITIONALS:
  53.  
  54. Yes,  this is one of two places within the DATAMAGE system where  you
  55. will  be  required  to enter SYNTAX, or commands that  conform  to  a
  56. specified  format.   But the claim that a DATAMAGE  user  need  NEVER
  57. learn  SYNTAX  is not false; the SYNTAX is supplied to  you  on  your
  58. screen  during the entry of the IF ITEMS and FORMULAS.  Your  entries
  59. are  SYNTAX-CHECKED  during both entry and execution of the  IFs  and
  60. FORMULAS,  and  appropriate error messages are displayed  should  you
  61. make a mistake or, for example, attempt the division of zero.
  62.  
  63. COMPARING NUMERIC DATA:
  64.  
  65. Numeric  data may be stored in a field within a file, an  element  of
  66. the  USER-ARRAY, or included in the IF ITEM.  You may compare any  of
  67. the above to any of the above targeting on equal, less than,  greater
  68. than, or not equal.
  69.  
  70. COMPARING DATE DATA:
  71.  
  72. When  we begin comparing dates we have a slight problem.  You may  be
  73. prone  to  enter  dates  in  the  formats:  MM/DD/YYyy  (normal)   or
  74. DD/MM/YYyy (military).  When entering dates into DATAMAGE fields  the
  75. format  is  displayed for you, and detectable errors are met  with  a
  76. beep, and the return to the entry of the date.  When creating your IF
  77. ITEMS this is, of course, not available.
  78.  
  79. This situation will NOT DO!
  80.  
  81. When  dates  are  compared within the DATAMAGE  system  the  software
  82. converts  them  into  numbers.  You may have noticed  that  the  BASE
  83. program  can sort a datafile on a date field in a hurry; this is  how
  84. it's done.  This date format is commonly called a METRIC date.
  85.  
  86. Let's consider the date: 01/02/91.  If it was stored in a field whose
  87. format was MM/DD/YY, this date would represent Jan. 1, 1989.  On  the
  88. other  hand, if this date were recorded in a field whose  format  was
  89. DD/MM/YY, this date would represent Feb. 1, 1991.
  90.  
  91. Note  that omitting the first two digits of the year will  cause  the
  92. software to assume that you mean 1,900 and whatever is present.   For
  93. this reason the DATAMAGE system is no good for recording dates before
  94. the year 100 a.d.  (Sorry, history buffs.)
  95.  
  96. In  order to convert this date to an ABSOLUTE value we first  process
  97. the year.  The 91 is stripped from the end and, since it is less than
  98. 100,  1,900  is added to it.  the result of this is 1991.   Now,  the
  99. software  selects  the month, be it in position 1 and 2 or 4  and  5.
  100. Assuming the more common MM/DD/YY format, the O1 is added to the  end
  101. of the 1991, giving 199101.  Now, we do the same for the day,  giving
  102. 19910102.  Finally, this string is converted to a number.
  103.  
  104. When  you enter date CONSTANTS within your IF ITEMS you MUST use  the
  105. METRIC date format.  This may be a small inconvenience for the  short
  106. period that it takes to get used to it, but it will save many errors.
  107. It  should  be  noted that this is necessary only  when  CREATING  an
  108. application,  and  is  not  supported when  entering  data  into  the
  109. program.
  110.  
  111. You may also compare date fields to values in the USER-ARRAY.   These
  112. values  must  also be in the METRIC format.  You can  use  a  numeric
  113. field with the auto-fill option to get the date into the  USER-ARRAY,
  114. where  it  becomes available for use as a target of date  or  numeric
  115. comparisons.  This process may be the ARGUMENT of an IF ITEM,  giving
  116. you the ability to use different comparison dates as needed.
  117.  
  118. COMPARING STRINGS:
  119.  
  120. Strings  may be compared in all the normal manners:   equal,  greater
  121. than,  less than and not equal, plus one more that is unique  to  the
  122. string comparisons: contains.  If the contains operator ( is used  it
  123. always  looks  for the second string (on the right of  the  operator)
  124. within the first string.
  125.  
  126. If the greater than or less than options are used the result will  be
  127. according to alphabetic order.  No, you can't use APPLICATIONS  MAKER
  128. to  sort  your datafiles - the BASE program  performs  that  function
  129. rather  handily  upon up to eight targets of the same or  mixed  data
  130. types.   You may then create a MARKER FILE that makes the product  of
  131. the sort available to APPLICATIONS MAKER.
  132.  
  133. CONSTANTS may also be incorporated into your string IF ITEMS, but the
  134. space provided for them is significantly less than the maximum length
  135. of  a  DATAMAGE string field, which is 250 characters.  In  the  rare
  136. case  of  needing to use a string CONSTANT that is  longer  than  the
  137. space provided you're out of luck.
  138.  
  139. When  comparing  strings APPLICATIONS MAKER always  removes  all  the
  140. spaces  from both targets and converts all the upper case letters  to
  141. lower  case.   Thereby using the CONTENT of the string  and  ignoring
  142. it's case and spacing.
  143.  
  144. EXECUTED ARGUMENTS:
  145.  
  146. Legal  arguments  for IFs are EXECUTE FORMULA, DO,  DO  PRINT,  GOTO,
  147. GOBACK,  ABORT  and KILL RELATIONAL WRITES.  The GOTOs,  GOBACKs  and
  148. ABORTs must be the LAST argument of the IF item as they terminate the
  149. IF.  Any arguments following these items will NOT be executed.
  150.  
  151. Care should be taken in using the ABORT option of the IF items.  This
  152. will abort the application!  If you have used the REL WRITES item  to
  153. store  interfile  updates  they  will  NOT  be  executed.   If   your
  154. application  keeps running totals etc. they will not be listed.   The
  155. application will stop dead.
  156.  
  157. If  you  desire only to abort the current iteration of  a  repetitive
  158. application  (such  as  one that enters records)  you  should  simply
  159. branch to a label past your write record and REL WRITES.  This should
  160. offer  the user the option to perform another iteration (by  entering
  161. 1),  or  to quit (enter 2).  The result of this numeric  screen  item
  162. should  be  placed  in an element of the user  numeric  array  via  a
  163. formula, then tested with an IF item.
  164.  
  165. The KILL relational writes argument is provided for this eventuality.
  166. If  your  application  has made use of the REL WRITE  item  to  store
  167. interfile updates to be executed at a later time (when the record  is
  168. completed)  you will need to delete these relational writes when  you
  169. branch to the next iteration of your repetitive application in  order
  170. to  prevent  their  execution  the next time  a  REL  WRITE  item  is
  171. encountered.
  172.  
  173. The KILL argument will also obviate any/all DO statements in  effect.
  174. If  the  KILL is encountered within a DO statement the  program  will
  175. need to negate the effect of that DO so that the next BREAK item will
  176. not send control of your application back to the item proceeding  the
  177. DO.  This will work no matter how many levels of DO are currently  in
  178. effect, including recursive DOs.  (DO ITEMS are coming later.)
  179.  
  180. There may be times when you wish to get at the ABORT and KILL options
  181. without  a  test.   These items are almost always  the  result  of  a
  182. condition  in  your application, but, due to the  structure  of  your
  183. logic, they may occasionally be needed as stand-alone functions.   To
  184. do this you must initiate an IF, as these items are available only as
  185. arguments to IFs.  Just type as the test of the IF: U1=U1.  The first
  186. element  of  the  user numeric array will  (hopefully)  always  equal
  187. itself, so the arguments will always be executed.
  188.  
  189. If  there is any possibility of branching to the next iteration of  a
  190. repetitive application you should also take care concerning  whatever
  191. running totals you are keeping.  This can be accomplished by  placing
  192. the  data  for the running totals into another element  of  the  user
  193. numeric  array, then adding it into the running total after the  last
  194. possibility of aborting the iteration has been executed.
  195.  
  196. Compound IFs, block IFs and IFs with ELSE arguments all evaluate to a
  197. series  of simple IF/GOTO operations, as do SWITCH (C),  SELECT  CASE
  198. (BASIC)  and  CASE OF (PASCAL).  If you do not understand what  I  am
  199. talking about, here, don't worry about it.  If you do then you should
  200. already know how to do these constructs with IF/GOTO.
  201.  
  202. Simply put, there are many times when you want to execute  operations
  203. only if a multiple test evaluates true.  For example, you might  wish
  204. to  update  a  file if the record being entered is  a  sale  AND  the
  205. purchase is being charged.  To do this you might reverse your  tests.
  206. The first IF might test for the record NOT being a sale, then  branch
  207. around  the file update.  The second IF might test that the  purchase
  208. is NOT a charge, then branch around the file update.
  209.  
  210. There are also many times you want to execute an operation if one  of
  211. several tests evaluate true.  You might wish to abort a record if  it
  212. is  a charge and the customer has no credit OR is at/over his  credit
  213. limit.   This is easily done by testing for no credit,  branching  to
  214. the abort.  Use a second IF to test for over credit limit,  branching
  215. to the abort.  Or reverse your tests and branch around the operation.
  216.  
  217. I  am not writing a textbook on programming here, nor ever will I  do
  218. so.   APPLICATIONS  MAKER is written for those who  need  to  produce
  219. simple  applications in order to do their work and are  possessed  of
  220. little  or no programming ability.  By providing and  explaining  the
  221. more intricate features of real programming languages I would totally
  222. confuse such a person.
  223.  
  224. If  you are a programmer you should look in the \MAGE\DOCS  directory
  225. and  find  sample source code, in BASIC and C,  to  process  DATAMAGE
  226. files.   Due to it's six byte reals PASCAL is not equipped to  handle
  227. these files.
  228.  
  229. DO ITEMS:  With the DO ITEMS the application will start execution  at
  230. the  first  occurrence of the target label, and to continue  until  a
  231. BREAK ITEM is encountered.
  232.  
  233. The  DO  and DO PRINT items will start looking for the label  at  the
  234. beginning of their respective screens.  When you define a DO item  on
  235. the  input screen you are, in effect, defining a FUNCTION  that  your
  236. "program"  may call from anywhere within the input screen,  including
  237. from  within the function itself.
  238.  
  239. A  function  that calls itself, in the jargon of the  programmer,  is
  240. called a RECURSIVE function.  Many real programming languages do  not
  241. allow recursion.
  242.  
  243. If  you  are  going to use DO items to  create  and  call  functions,
  244. especially  recursive ones, a programming method called TOP  DOWN  is
  245. highly recommended.  To do this you define all functions before  they
  246. are  called.  Just place a GOTO item as your first screen  item,  and
  247. use  as  it's target label the place in your screen  where  you  wish
  248. execution of your application to start.  And place that label at  the
  249. start of your control routine.
  250.  
  251. Between  the initial GOTO item and it's target label place  all  your
  252. functions.  When you use a DO item to call a function you will go  to
  253. the FIRST occurrence of that label.  If it's atop the screen you  may
  254. re-use that label later without worrying about losing control.
  255.  
  256. Each  time a DO item is encountered the program uses a little  memory
  257. to  record  DO's location so you can return when the  BREAK  item  is
  258. executed.   If  your computer has less than the  full  compliment  of
  259. 640K, or your applications are extremely large you should watch using
  260. recursive DO functions, as they may cause you to run out of memory.
  261.  
  262. If this happens the program will recover by displaying the  (DREADED)
  263. out of memory error, and terminating your application.  This has  yet
  264. to  happen,  but it could easily occur on a computer with  448K,  and
  265. might happen up to 576K.
  266.  
  267. DO  PRINT ITEMS:  With the DO PRINT ITEMS the application will  start
  268. report  execution at the first occurrence of the target label on  the
  269. report  screen and continue until a BREAK ITEM is encountered in  the
  270. report, or until the report ends.
  271.  
  272. BREAK ITEMS:  With the BREAK ITEMS the application will return to the
  273. item  after  the DO which caused their execution.  If the DO  was  an
  274. argument  to an IF the remainder of the arguments to the if  will  be
  275. executed.   If  no DO is in effect when a BREAK item is  executed  it
  276. will  be ignored.  BREAK items are also the target of forward  gotos.
  277. BREAK items appear on both the input and report screens.
  278.  
  279. END ITEMS: With the END ITEMS the execution of the application halts.
  280.  
  281. LOCATE  ITEMS:  With the LOCATE ITEMS you may control  your  screens.
  282. APPLICATIONS  MAKER  screens may be up to 100  SUB-SCREENS  wide  and
  283. tall.  Each SUB-SCREEN is 78 columns wide and 19 lines tall.  You may
  284. choose to use implement an application that uses ten SUB-SCREENS.
  285.  
  286. Each  of  your  ten horizontal screens might be a  task  within  your
  287. application.   You will need to be able to control the  execution  of
  288. your application so that it goes to the start of the desired  screen,
  289. and  then  works it's way down while staying within  that  horizontal
  290. boundary.  This is the purpose of the LOCATE ITEMS.
  291.  
  292. The  first  option  of the LOCATE items is to BEGIN  or  RELEASE  the
  293. enforcement of the horizontal boundaries.
  294.  
  295. If  you use a DO to execute a function in your application  and  that
  296. function  is  located  outside  the  horizontal  boundary  you   have
  297. specified  you  will  need to release the LOCATE  ITEM  currently  in
  298. effect.   When you complete the task associated with  the  horizontal
  299. section  of  the  application you may wish to go back  to  the  first
  300. screen  and display a menu item so that the user may  select  another
  301. task,  or exit.  Again, you will need to release the current  LOCATE.
  302. If you do not the application will end with a LABEL NOT FOUND error.
  303.  
  304. When you initialize a locate item you are prompted for the SUB-SCREEN
  305. then  the vertical line within your application at which you wish  to
  306. locate the screen.
  307.  
  308. The  LOCATE  ITEM also causes the program to ignore  any  LABELS  not
  309. within the horizontal limits you specify.  If you use GOTO, GOBACK or
  310. DO  items they will not find LABELS whose horizontal position in  the
  311. application is not within the boundaries specified.
  312.  
  313. Your   screen  WILL  find  items  whose  vertical  position  in   the
  314. application is not on the same visible screen as your starting point.
  315. So,  you  may scroll the screen vertically to any position  you  wish
  316. within the horizontal limits you set.