home *** CD-ROM | disk | FTP | other *** search
/ Big Blue Disk 16 / bbd16.zip / MANUAL < prev    next >
Text File  |  1984-09-14  |  96KB  |  3,763 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                          STRUCTURED PROGRAMMING LANGUAGE                               
  30.                          STRUCTURED PROGRAMMING LANGUAGE
  31.                          STRUCTURED PROGRAMMING LANGUAGE
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.                           Copyright by Dennis Baer 1983 
  53.                       25 Miller Road Farmingdale,N.Y. 11735
  54.                                   516-694-5872
  55.  
  56.  
  57.                This language is dedicated to you, the PROGRAMMER.
  58.  
  59.  
  60.  
  61.                                         1
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                          Structured programming language
  71.  
  72.            A  Structured  Programming Language processor for  the  MS-DOS    
  73.            family   of   computers.   The  instructions  for   running   the    
  74.            processor are on page 51.
  75.  
  76.            The  following are the statements that make up the  Structured 
  77.            Programming language:        [ See important note on page 7. ] 
  78.  
  79.              Statement                Page
  80.  
  81.          1.  BEGIN                     14
  82.  
  83.          2.  REAL                      16
  84.  
  85.          3.  INTEGER                   18
  86.  
  87.          4.  STRING                    19
  88.  
  89.          5.  REAL ARRAY                20
  90.  
  91.          6.  INTEGER ARRAY             21
  92.  
  93.          7.  STRING ARRAY              22
  94.  
  95.          8.  PROCEDURE                 23
  96.  
  97.          9.  COMMENT                   25
  98.  
  99.         10.  GO                        26
  100.  
  101.         11.  GO TO                     26
  102.  
  103.         12.  GOTO                      26
  104.  
  105.         13.  ONERRGOTO                 27
  106.  
  107.         14.  RETURN                    28
  108.  
  109.         15.  INPUT                     29
  110.  
  111.         16.  LINEIN                    30
  112.  
  113.         17.  GET [I/O]                 31
  114.  
  115.         18.  PUT [I/O]                 31
  116.  
  117.         19.  OUTPUT                    32
  118.  
  119.         20.  CALL                      33
  120.  
  121.         21.  FOR                       34
  122.  
  123.         22.  IF                        35
  124.  
  125.  
  126.  
  127.                                         2
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.              Statement               Page
  137.  
  138.         23.  END                       36
  139.  
  140.         24.  WHILE                     37
  141.  
  142.         25.  REPEAT                    38
  143.  
  144.         26.  ;                         39
  145.  
  146.         27.  WRITE               *Z 10.179-10.180    *I 4-298 4-299
  147.  
  148.         28.  CHAIN               **Z 10.13-10.14     **I 4-36
  149.  
  150.         29.  BEEP                *Z 10.5             *I 4-28
  151.  
  152.         30.  BLOAD               **Z 10.6-10.7       **I 4-29
  153.  
  154.         31.  BSAVE               **Z 10.8-10.9       **I 4-32
  155.  
  156.         32.  CALL [EXTERNAL]     *Z 10.10-10.11      *I 4-34
  157.  
  158.         33.  CLEAR               *Z 10.18            *I 4-44
  159.  
  160.         34.  CLOSE               **Z 10.19           **I 4-46
  161.  
  162.         35.  FILES               **Z 10.51           **I 4-97
  163.  
  164.         36.  FIELD               *Z 10.50            *I 4-94
  165.  
  166.         37.  KILL                **Z 10.84           **I 4-136
  167.  
  168.         38.  NAME                **Z 10.108          **I 4-173
  169.  
  170.         39.  OPEN                **Z 10.115-10.121   **I 4-189,4-194
  171.  
  172.         40.  OUT                 **Z 10.123          **I 4-201
  173.  
  174.         41.  DOS                       40
  175.  
  176.         42.  POKE                *Z 10.127           *I 4-214
  177.  
  178.         43.  RESET               *Z 10.146           *I 4-243
  179.  
  180.         44.  RESUME              *Z 10.148           *I 4-245
  181.  
  182.         45.  RUN                 **Z 10.152          **I 4-251
  183.  
  184.         46.  STOP                *Z 10.161           *I 4-270
  185.  
  186.         47.  WAIT                *Z 10.176           *I 4-290
  187.  
  188.         48.  HOME                      41
  189.  
  190.         49.  DEFSEG                    42
  191.  
  192.  
  193.                                         3
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.              Statement                Page
  203.  
  204.         50.  ERROR               *Z 10.47-10.48      *I 4-91
  205.  
  206.         51.  KEY                 *Z 10.81-10.83      *I 4-131
  207.  
  208.         52.  LSET                *Z 10.103           *I 4-163
  209.  
  210.         53.  RSET                *Z 10.103           *I 4-163
  211.  
  212.         54.  RANDOMIZE           *Z 10.141           *I 4-236
  213.  
  214.         55.  SWAP                *Z 10.164           *I 4-277
  215.  
  216.         56.  COLOR               *Z 10.21-10.22      *I 4-49,4-54
  217.  
  218.         57.  DRAW                *Z 10.40-10.41      *I 4-79
  219.  
  220.         58.  CIRCLE              *Z 10.17            *I 4-41
  221.  
  222.         59.  GET [GRAPHICS]      *Z 10.59-10.61      *I 4-108
  223.  
  224.         60.  PUT [GRAPHICS]      *Z 10.59-10.61      *I 4-232
  225.  
  226.         61.  LINE                *Z 10.88-10.89      *I 4-141
  227.  
  228.         62.  LOCATE              *Z 10.97-10.98      *I 4-155
  229.  
  230.         63.  PRESET              *Z 10.129           *I 4-228
  231.  
  232.         64.  PSET                *Z 10.138-10.139    *I 4-228
  233.  
  234.         65.  PAINT               *Z 10.124           *I 4-203
  235.  
  236.         66.  SCREEN              *Z 10.155           *I 4-257
  237.  
  238.         67.  DATE$               *Z 10.32            *I 4-66
  239.  
  240.         68.  TIME$               *Z 10.168-10.169    *I 4-281
  241.  
  242.         69.  MID$                *Z 10.106           *I 4-167
  243.  
  244.         70.  WIDTH               *Z 10.178           *I 4-294
  245.  
  246.         71.  COM(N)              *Z F.8-F.10         *I 4-56
  247.  
  248.         72.  KEY(N)              *Z F.8-F.10         *I 4-134
  249.  
  250.         73.  ON COM(N)           *Z F.8-F.10         *I 4-176
  251.  
  252.         74.  ON KEY(N)           *Z F.8-F.10         *I 4-182
  253.  
  254.         75.  NULL                *Z 10.110
  255.  
  256.         76.  EOT                       43
  257.  
  258.  
  259.                                         4
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.              Statement                Page
  269.  
  270.         77.  Arithmetic assignment     44
  271.  
  272.         78.  String assignment         45
  273.  
  274.         79.  Labeled statement         46
  275.  
  276.  
  277.              The  following  functions  are supported in  the  Structured 
  278.  
  279.              Programming Language for MS DOS systems.
  280.  
  281.  
  282.              Arithmetic Function      Page           Page
  283.                                       (Z)            (I)
  284.          1.  ABS                      10.1           4-21
  285.  
  286.          2.  ATN                      10.3           4-25
  287.  
  288.          3.  CDBL                     10.12          4-35
  289.  
  290.          4.  CINT                     10.16          4-40
  291.  
  292.          5.  COS                      10.26          4-60
  293.  
  294.          6.  CSNG                     10.28          4-61
  295.  
  296.          7.  EXP                      10.49          4-93
  297.  
  298.          8.  FIX                      10.52          4-99
  299.          
  300.          9.  INT                      10.80          4-130
  301.  
  302.         10.  LOG                      10.100         4-159
  303.  
  304.         11.  RND                      10.151         4-249
  305.  
  306.         12.  SGN                      10.156         4-260
  307.  
  308.         13.  SIN                      10.157         4-261
  309.  
  310.         14.  SQR                      10.160         4-267
  311.  
  312.         15.  TAN                      10.167         4-280
  313.  
  314.              String function          Page           Page
  315.                                       (Z)            (I)
  316.          1.  ASC                      10.2           4-24
  317.  
  318.          2.  CHR$                     10.15          4-38
  319.  
  320.          3.  CVI                      10.30          4-63
  321.  
  322.          4.  CVS                      10.30          4-63
  323.  
  324.  
  325.                                         5
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.              String Function          Page           Page
  335.                                       (Z)            (I)
  336.          5.  CVD                      10.30          4-63
  337.  
  338.          6.  EOF                      10.44          4-86
  339.  
  340.          7.  FRE                      10.57          4-104
  341.  
  342.          8.  HEX$                     10.64          4-115
  343.  
  344.          9.  INPUT$                   10.78          4-127
  345.  
  346.         10.  INSTR                    10.79          4-129
  347.  
  348.         11.  LEFT$                    10.85          4-137
  349.  
  350.         12.  LEN                      10.86          4-138
  351.  
  352.         13.  LOC                      10.96          4-153
  353.  
  354.         14.  LOF                      10.99          4-158
  355.  
  356.         15.  MID$                     10.105         4-167
  357.  
  358.         16.  MKI$                     10.107         4-170
  359.  
  360.         17.  MKS$                     10.107         4-170
  361.  
  362.         18.  MKD$                     10.107         4-170
  363.  
  364.         19.  OCT$                     10.111         4-175
  365.  
  366.         20.  RIGHT$                   10.150         4-248
  367.  
  368.         21.  SPACE$                   10.158         4-265
  369.  
  370.         22.  STR$                     10.162         4-272
  371.  
  372.         23.  STRING$                  10.163         4-276
  373.  
  374.         24.  VAL                      10.172         4-285
  375.  
  376.              Special Functions        Page           Page
  377.                                       (Z)            (I)
  378.          1.  CSRLIN                   10.29          4-62
  379.  
  380.          2.  FRE                      10.57          4-104
  381.  
  382.          3.  INP                      10.71          4-121
  383.  
  384.          4.  LPOS                     10.101         4-160
  385.  
  386.          5.  PEEK                     10.125         4-205
  387.  
  388.          6.  POINT                    10.126         4-213
  389.  
  390.  
  391.                                         6
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.              Special Functions        Page           Page
  401.                                       (Z)            (I)
  402.          7.  POS                      10.128         4-215
  403.  
  404.          8.  SCREEN                   10.154         4-255
  405.  
  406.          9.  SPC                      10.159         4-266
  407.  
  408.         10.  TAB                      10.166         4-279
  409.  
  410.         11.  VARPTR                   10.173         4-286,4-288
  411.  
  412.         12.  WIDTH                    10.178         4-294
  413.  
  414.              Special Variables
  415.  
  416.          1.  ERR                      10.46          4-89
  417.  
  418.          2.  ERL                      10.46          4-89
  419.  
  420.          3.  INKEY$                   10.70          4-119
  421.  
  422.              Additional categories              Page
  423.              
  424.  
  425.              STATEMENT FORMATS                    9
  426.  
  427.              ARITHMETIC OPERATORS                47
  428.  
  429.              STRING OPERATORS                    47
  430.  
  431.              LOGICAL OPERATORS                   47
  432.  
  433.              COMPARISON OPERATORS                47
  434.  
  435.              IMPLEMENTATION RESTRICTIONS         48
  436.  
  437.              REAL,INTEGER,STRING CONSTANTS       49
  438.  
  439.              APPLICATION NOTES                   50
  440.  
  441.              RUNNING THE PROCESSOR               51
  442.  
  443.              ERROR MESSAGES                      52
  444.  
  445.              INDEX                               56
  446.  
  447.              Note:  *Z  *I means refer to page in computer  manufacturers     
  448.         BASIC   manual.   **Z  **I  means  refer  to  page  in   computer    
  449.         manufacturers   BASIC manual but command is  slightly  different. 
  450.         parentheses  must  be  placed after the key word and  before  the 
  451.         semicolon.  (Z=Zenith,I=IBM) See each statement format from pages 
  452.         8 through 13. The statement must have variable names that conform 
  453.         to  Structured Programming Language standards.  If you don't  see 
  454.         page references for your computer then consult your BASIC manual.
  455.  
  456.  
  457.                                         7
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.              Programs written in the Structured Programming Language  are 
  467.         kept  in an ASCII text file.  Any text editor that can create  an 
  468.         ASCII  text  file  for  MS DOS can be used  to  write  Structured 
  469.         Programming  Language  programs.  It is a free format  block  and 
  470.         procedure oriented language that runs in the MS DOS  environment. 
  471.         Each computer's implementation of a computer language has its own 
  472.         unique characteristics.  In this implementation of the Structured 
  473.         Programming  Language,  the  processor  uses  the  text  file  of 
  474.         Structured   Programming   Language  statements  as   input   and 
  475.         translates  this  program to BASIC in an ASCII text file for  the 
  476.         particular MS DOS system.  The text file can be run by the  BASIC 
  477.         interpreter  or  be  compiled by the BASIC compiler after  it  is 
  478.         loaded  into  the interpreter workspace and then saved  in  ASCII 
  479.         format on the users disk drive.  This manual is intended to be  a 
  480.         reference  manual  for  the  MS DOS  version  of  the  Structured 
  481.         Programming Language and is not meant to be a tutorial. To get an 
  482.         idea  of procedure oriented and block structured  languages,  you 
  483.         can read books on the ALGOL and PASCAL languages.
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                                         8
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.              The  following are the statement formats for the  Structured 
  533.              Programming Language.
  534.  
  535.          1.  BEGIN
  536.  
  537.          2.  REAL <variable> {,<variable>,..........,<variable>};
  538.  
  539.          3.  INTEGER <variable> {,<variable>,..........,<variable>};
  540.  
  541.          4.  STRING <variable> {,<variable>,..........,<variable>};
  542.  
  543.          5.  REAL ARRAY <array variable>(<bounds>) {,<array variable>  
  544.  
  545.              (<bounds>),..........};    
  546.  
  547.          6.  INTEGER ARRAY <array variable>(<bounds>) {,<array variable>
  548.  
  549.              (<bounds>),..........};
  550.  
  551.          7.  STRING ARRAY <array variable>(<bounds>) {,<array variable>
  552.  
  553.              (<bounds>),..........};
  554.  
  555.          8.  PROCEDURE <procedure name> { (<parameter list>) };
  556.  
  557.              BEGIN
  558.  
  559.               <statements>
  560.  
  561.              END
  562.  
  563.          9.  COMMENT <text>; [Note: <text> should not contain ' char.]
  564.  
  565.         10.  GO <label>;
  566.  
  567.         11.  GO TO <label>;
  568.  
  569.         12.  GOTO <label>;
  570.  
  571.         13.  ONERRGOTO <label>;
  572.  
  573.         14.  RETURN {<label>};
  574.  
  575.         15.  INPUT( {@} {<prompt string>{@|,}} <variable list> );
  576.  
  577.         15a. INPUT( #<file number>,<variable list> );
  578.  
  579.         15b. LINEIN( {@} {<prompt string>{@|,}} <string variable>);
  580.  
  581.         15c. LINEIN( #<file number>,<string variable>);
  582.  
  583.         16.  GET #<file number> {,<record number>};
  584.  
  585.         17.  PUT #<file number> {,<record number>};
  586.  
  587.  
  588.  
  589.                                         9
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.         18.  OUTPUT( {#<file number>,} {USING <string expression>@}
  599.  
  600.              {<output expression list>} );
  601.  
  602.         19.  {CALL} <procedure name> {( <argument list> )};
  603.  
  604.         20.  FOR <scalar arithmetic variable> := <start arith. expr.>
  605.  
  606.                   STEP <increment arithmetic expression>
  607.  
  608.                        UNTIL <limit arithmetic expression>
  609.  
  610.                             DO BEGIN
  611.  
  612.                                  <statements>
  613.  
  614.                             END
  615.  
  616.         21.  IF <logical expression> THEN  <statement>
  617.  
  618.              { ELSE <statement> }
  619.  
  620.              Note: In each of the clauses THEN,ELSE the <statement>
  621.  
  622.              can be replaced with BEGIN <statements> END
  623.  
  624.              The  single  statement may not be an IF,FOR,REPEAT,REAL,
  625.  
  626.              INTEGER,STRING,PROCEDURE,ON, or WHILE statement. You
  627.  
  628.              must place it between BEGIN and END statements.
  629.  
  630.         22.  END
  631.  
  632.         23.  WHILE <logical expression> DO
  633.  
  634.              BEGIN
  635.  
  636.               <statements>
  637.  
  638.              END
  639.  
  640.         24.  REPEAT <statements>
  641.  
  642.              UNTIL <logical expression>;
  643.  
  644.         25.  ;
  645.  
  646.         26.  WRITE {#<file number>,} {<expression list>};
  647.  
  648.         27.  CHAIN( <file name> );
  649.  
  650.         28.  BEEP;
  651.  
  652.         29.  BLOAD( <file name> {,<offset>} );
  653.  
  654.  
  655.                                        10
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         30.  BSAVE( <file name>,<offset>,<length> );
  665.  
  666.              Note:The  offset  is  added to the current  segment  address
  667.  
  668.              which gives the address.
  669.  
  670.         31.  CALL <variable> {( <argument list> )};
  671.  
  672.              Note:<variable>  is  an INTEGER variable that has  the  same
  673.  
  674.              name as a global program name as in PASCAL,ASSEMBLER, or
  675.  
  676.              FORTRAN (by MICROSOFT)
  677.  
  678.         32.  CLEAR {{,<highest location>} {,<stack space>}};
  679.  
  680.         33.  CLOSE( {#} <file number> {,{#} <file number>,..........} );
  681.  
  682.         34.  FILES( { <files> } );
  683.  
  684.         35.  FIELD # <file number>,<field width> AS <string variable>,
  685.  
  686.              { <field width> AS <string variable>,.......... };
  687.  
  688.         36.  KILL( <files> );
  689.  
  690.         37.  NAME( <file name> AS <new file name> );
  691.  
  692.         38.  OPEN( <mode>,{#} <file number>,<file name> {,<record len.>} );
  693.  
  694.              Note:The <mode> in 38. is 'O','I',or 'R'
  695.  
  696.         38a. OPEN( <file name> { FOR <mode> } AS {#} <file number> 
  697.  
  698.              { LEN = <record length> } );
  699.  
  700.              Note:The <mode> in 38a. is INPUT,OUTPUT,or APPEND. RANDOM
  701.  
  702.              is assumed if mode is left out.
  703.  
  704.         38b. OPEN( 'COM1:<speed>,<parity>,<data>,<stop>' AS <file no.> );
  705.  
  706.         39.  OUT( <port number>,<data> );
  707.  
  708.         40.  DOS;
  709.  
  710.              Note:This statement brings the user back to MS DOS.
  711.  
  712.         41.  POKE <machine location offset>,<data>;
  713.  
  714.         42.  RESET;
  715.  
  716.         43.  RESUME { <label> };
  717.  
  718.         44.  RUN( <file name> );
  719.  
  720.  
  721.                                        11
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         45.  STOP;
  731.  
  732.         46.  WAIT <port address>,<integer expr.>,<integer expr.>;
  733.  
  734.         47.  HOME;   Note:This statement clears the screen.
  735.  
  736.         48.  DEFSEG := <expression>;
  737.  
  738.         49.  ERROR <integer expression>;
  739.  
  740.         50.  KEY <key number>,<string expression>;
  741.  
  742.         50a. KEY LIST;
  743.  
  744.         50b. KEY ON;
  745.  
  746.         50c. KEY OFF;
  747.  
  748.         51.  LSET <string variable> := <string expression>;
  749.  
  750.         52.  RSET <string variable> := <string expression>;
  751.  
  752.         53.  RANDOMIZE <arithmetic expression>;
  753.  
  754.         54.  SWAP <variable>,<variable>;
  755.  
  756.         55.  COLOR { <foreground> } {,<background> };
  757.  
  758.         56.  DRAW <string expression>;
  759.  
  760.         57.  CIRCLE (<x center>,<y center>),<radius> {,<color {,<start>
  761.  
  762.              ,<end> {,<aspect ratio>}}};
  763.  
  764.         58.  GET (<x1>,<y1>)-(<x2>,<y2>),<array name>;
  765.  
  766.         59.  PUT (<x1>,<y1>),<array name> {,<action verb> };
  767.  
  768.              Note: <action verb> is AND,OR,XOR,PSET,or PRESET
  769.  
  770.         60.  LINE (<x1>,<y1>)-(<x2>,<y2>) {,{<color>} {,B {F}};
  771.  
  772.              Note:Lower case letters b,f can be used instead of B,F
  773.  
  774.         61.  LOCATE {<row>},{<column>} {,{<cursor>}};
  775.  
  776.         62.  PRESET (<x>,<y>) {,<color>};
  777.  
  778.         62a. PRESET STEP (<x offset>,<y offset>) {,<color>};
  779.  
  780.         63.  PSET (<x>,<y>) {,<color>};
  781.  
  782.         63a. PSET STEP (<x offset>,<y offset>) {,<color>};
  783.  
  784.         64.  PAINT (<x start>,<y start>) {,<paint color> {,<border color>}};
  785.  
  786.  
  787.                                        12
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         65.  SCREEN {<graphics mode>,} {<reverse video>};
  797.  
  798.         66.  DATE$ := <date string expression>;
  799.  
  800.         67.  TIME$ := <time string expression>;
  801.  
  802.         68.  MID$(<string expr. 1>,<integer expr. 1>{,<integer expr. 2>})
  803.  
  804.                   := <string expression 2>;
  805.  
  806.         69.  WIDTH <integer expression>;
  807.  
  808.         70.  COM( <arithmetic expression> )  ON
  809.                                              OFF   ;
  810.                                              STOP
  811.  
  812.         71.  KEY( <arithmetic expression> )  ON
  813.                                              OFF   ;
  814.                                              STOP
  815.  
  816.         72.  ON COM( <arithmetic expression> ) THEN CALL <procedure name> ;
  817.  
  818.         73.  ON KEY( <arithmetic expression> ) THEN CALL <procedure name> ;
  819.  
  820.         Note:  For statements 72. and 73. the <procedure name> represents 
  821.  
  822.         a procedure without arguments.
  823.  
  824.         74.  NULL <integer expression>;
  825.  
  826.         75. <space> EOT <space>
  827.  
  828.              Note:This must be on the last line of the file.
  829.  
  830.         76.  <arithmetic variable> := <arithmetic expression>;
  831.  
  832.         77.  <string variable> := <string expression>;
  833.  
  834.         78.  <label>:.....:<label>:<executable statement>;
  835.  
  836.         Anything in between { } is optional.
  837.  
  838.         Anything  between  < > means a description of the value and  that 
  839.  
  840.         the < > are not part of the statement.
  841.  
  842.         Repetition symbol ......... means that an item can be repeated.
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.                                        13
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         BEGIN
  863.  
  864.            Format: BEGIN
  865.  
  866.              The  BEGIN  statement  is  used to define  the  start  of  a 
  867.         Structured Programming Language program or a start of a new block 
  868.         in  a  program.  It  tells the  Structured  Programming  Language 
  869.         processor  that a new logical unit of declarations  of  variables 
  870.         and  executable instructions starts.  It also creates a new level 
  871.         of variable storage. The first BEGIN statement does both, defines 
  872.         the start of a program and the start of a new block.  An  example 
  873.         of BEGIN usage.
  874.  
  875.              BEGIN
  876.                 REAL x,y,fnc;
  877.                 INPUT(x,y);
  878.                 fnc:=x*y; OUTPUT(fnc);
  879.              END
  880.  
  881.            In  the above example,   the reserved word BEGIN  defines  the 
  882.         start  of  the  program  and  tells  the  Structured  Programming 
  883.         Language  processor that a new block has started.  Reserved words 
  884.         should   not   be   used  as   variable   names,   label   names, 
  885.         procedures,etc.  If  you  do  then they will  conflict  with  the 
  886.         meaning  of  these  words and will not  be  taken  as  variables. 
  887.         Reserved  words  are  Structured Programming  Language  statement 
  888.         names,  and the various mathematical,  string, file functions and 
  889.         operators.  The user shall find reference to these reserved words 
  890.         in the table of contents.  Another example of the usage of BEGIN.
  891.  
  892.              BEGIN
  893.                 REAL X,Y,FNC;
  894.                 ask:INPUT(X,Y); FNC:=X*Y;
  895.                 IF FNC<0 THEN
  896.                 BEGIN
  897.                    OUTPUT('The value of FNC is less than zero');
  898.                    GO ask;
  899.                 END
  900.              END
  901.  
  902.  
  903.              In the above example,  the first BEGIN statement defines the 
  904.         start  of  the  program  and  the  first  level  of  storage  and 
  905.         executable  statements.  The second BEGIN statement defines a new 
  906.         block,  but  in this case the block will only be entered  if  the 
  907.         condition  of the clause of the IF statement is true.  That is IF 
  908.         FNC  <  0.  This  second  BEGIN  block  can  contain  declaration 
  909.         statements  if the user chooses to put them in there.  Any  BEGIN 
  910.         block can contain both declaration and executable statements. The 
  911.         rule  however is that the declaration statements must precede the 
  912.         executable  statements.  The  END statement defines an end  to  a 
  913.         logical block of statements and declarations of variables.  These 
  914.         variables  when declared in a block will be known in  that  block 
  915.         and any block declared inside that block.  If the condition FNC < 
  916.         0   is  false,   then  execution  will  skip  the  second   BEGIN 
  917.  
  918.  
  919.                                        14
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         statement,  the  OUTPUT  statement,the GO statement and  the  END 
  929.         statement. Execution then continues with the statement after that 
  930.         END  statement,  which is the final END statement in  this  case. 
  931.         When execution reaches the final END statement,  the program ends 
  932.         and control goes back to the system. A third example of BEGIN.
  933.  
  934.              BEGIN
  935.                 REAL a,h,c;
  936.                 INTEGER i,j,k;
  937.                 a:=5; h:=25;
  938.                 Insideblock:
  939.                 BEGIN
  940.                    REAL a1,b1,function;
  941.                    function:=(a+h)^2.; OUTPUT(function); c:=function;
  942.                 END
  943.                 IF c>500 THEN
  944.                 BEGIN
  945.                    OUTPUT('(a+h)^2. is greater than 500');
  946.                 END
  947.                 ELSE
  948.                 BEGIN
  949.                    OUTPUT('(a+h)^2. is less than or equal to 500');
  950.                 END
  951.                 IF c>800 THEN GO TO Insideblock;
  952.              END
  953.  
  954.              In this above example there is the main BEGIN END block that 
  955.         contains  the  entire program.  In the main block  the  variables 
  956.         a,h,c,i,j,k  are  declared.  The  block  labeled  Insideblock  is 
  957.         an  inner block that computes the value function and c.  A  third 
  958.         block  is a THEN clause of the IF statement and is only  executed 
  959.         if the logical expression of the IF statement is true. That is if 
  960.         c>500.   The  fourth  block  is  executed  only  if  the  logical 
  961.         expression of the IF statement is false. Now notice the second IF 
  962.         statement,  if  c>800  then execution will go to the BEGIN  block 
  963.         labeled  Insideblock.  In  this program there  are  three  blocks 
  964.         inside the first block, which is the main program.
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.                                        15
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         REAL
  995.  
  996.            Format: REAL <variable> {,<variable>,..........,<variable>};
  997.  
  998.              The  REAL statement is a nonexecutable declaration statement 
  999.         which informs the Structured Programming Language processor  that 
  1000.         the  variables declared are REAL scalar variables.  They  contain 
  1001.         single  precision floating point numbers.  The identifier is  the 
  1002.         actual  name of the variable that is declared and referenced in a 
  1003.         Structured Programming Language program.  An identifier is a name 
  1004.         of  up  to  40  characters which  begins  with  an  uppercase  or 
  1005.         lowercase  alphabetic character.     Subsequent characters can be 
  1006.         upper  or  lower  case  letters,  numbers,  dollar  sign,  or  an 
  1007.         underscore. An example of the REAL statement.
  1008.  
  1009.              BEGIN
  1010.                 REAL X,Y,Z,FUNCTION;
  1011.                 INTEGER percentile;
  1012.                 REAL a1,a2,a3;
  1013.                 X:=Y+Z; FUNCTION:=SQR(X^2.+Y^2.);
  1014.                 BEGIN
  1015.                    a1:=5; a2:=10; a3:=a1^a2; OUTPUT('a3 is:'@ a3);
  1016.                 END
  1017.              END
  1018.  
  1019.              The  above  example  is  a small  program.  The  first  REAL 
  1020.         statement declares that X,Y,Z,FUNCTION are REAL scalar  variables 
  1021.         in  that  block and are known in any block nested in  that  block 
  1022.         unless  the  name  is reused in a declaration  statement  in  the 
  1023.         nested  block.  Names  declared  in a BEGIN block are  not  known 
  1024.         outside  the  block.  The  second REAL  statement  declares  that 
  1025.         a1,a2,a3  are  real  variables  in  that  block.  Note  that  the 
  1026.         variables  a1,a2,a3  referenced  in the inside  BEGIN  block  are 
  1027.         actually declared in the outer block,which incidently is the main 
  1028.         program block. Another example of the REAL statement.
  1029.  
  1030.              BEGIN
  1031.                 REAL a,h;
  1032.                 a:=1; h:=2;
  1033.                 BEGIN
  1034.                    REAL a,c;
  1035.                    a:=3; c:=4; OUTPUT('The product of a and h is:'@ a*h);
  1036.                    IF a+h<4 THEN
  1037.                    BEGIN
  1038.                       REAL c,d;
  1039.                       c:=5; d:=6; OUTPUT('The sum of c and d is:'@ c+d);
  1040.                    END
  1041.                 END
  1042.              END
  1043.  
  1044.              In  the  above example a and h are declared as  REAL  scalar 
  1045.         variables  in  the  outermost  program  block.  The  second  REAL 
  1046.         statement  declares  a and c to be REAL scalar variables.  It  is 
  1047.         important  to  note that at the first OUTPUT statement  that  the 
  1048.         reference  to  the  REAL variable a is the variable  a  that  was 
  1049.  
  1050.  
  1051.                                        16
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.         declared  in  the second BEGIN block that is nested in  the  main 
  1061.         program BEGIN block.  a was set to 3 in this inner block and this 
  1062.         variable  a  is much different from the variable a in  the  outer 
  1063.         BEGIN block.  Each variable  a  has a location allocated to it to 
  1064.         store  one single precision floating point  number.  However  the 
  1065.         REAL  variable  h  referenced  in the inner  block  is  the  same 
  1066.         variable  h that is declared in the outer block because the  rule 
  1067.         is  that a nested BEGIN block knows all variables outside of  it, 
  1068.         except  if  the  same  variable name is  used  in  a  declaration 
  1069.         statement.  But h is not redeclared,  so it is known.  c is known 
  1070.         because  it is declared in the inner second block.  Now note  the 
  1071.         third  BEGIN block.  It is only executed if the logical statement 
  1072.         a+h<4  is  true.  This  third block has  a  REAL  statement  that 
  1073.         declares  c  and  d to be REAL scalar variables.  At  the  OUTPUT 
  1074.         statement  in  this third block c is the variable c  declared  in 
  1075.         this block and d is also the one that is declared in this  block. 
  1076.         In addition,  variable a if it were to be referenced would be the 
  1077.         variable   a   declared  in the second block and h would  be  the 
  1078.         variable  declared in the first outermost program block.  So  you 
  1079.         see that depending on what variables are declared and where  they 
  1080.         are  referenced,  the actual storage can vary.  In summation  the 
  1081.         REAL  statement  sets up storage that is known for the block  and 
  1082.         for  any  block nested inside of it,  except  those  blocks  that 
  1083.         redeclare  that name.  The storage for the variable is static and 
  1084.         is  not  lost  if you exit the block in  which  it  is  declared. 
  1085.         Variable  names  cannot be any of the various key words that  are 
  1086.         defined in the Structured Programming Language.  See the table of 
  1087.         contents for the reserved words. They include the statement names 
  1088.         and mathematical,string,and file functions.  A REAL variable  may 
  1089.         contain  a number ranging from 10^-38 to 10^38 or -10^38 to -10^-
  1090.         38. with 9 digits of precision.
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                        17
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.         INTEGER
  1127.  
  1128.            Format: INTEGER <variable>{,<variable>,..........,<variable>};
  1129.  
  1130.  
  1131.              The   INTEGER  statement  is  a  nonexecutable   declaration 
  1132.         statement   that  informs  the  Structured  Programming  Language 
  1133.         processor that the variables named are scalar INTEGER  variables. 
  1134.         For  an  explanation  of  what an identifier  is,  see  the  REAL 
  1135.         statement section. An example.
  1136.  
  1137.              BEGIN
  1138.                 INTEGER i,j,k;
  1139.                 i:=1; j:=2; k:=3;
  1140.                 BEGIN
  1141.                    INTEGER i,j,m;
  1142.                    m:=i+j+k; OUTPUT(m,i,j,k);
  1143.                 END
  1144.              END
  1145.  
  1146.              The first INTEGER statement declares i,j,k as scalar INTEGER 
  1147.         variables  in  the  outermost program block.  The  i,j  that  are 
  1148.         declared  here  will  not be known by the second block  which  is 
  1149.         nested in the first block.  The variable k is known in the second 
  1150.         block as an INTEGER scalar variable. The second INTEGER statement 
  1151.         declares  that i,j,m are scalar INTEGER variables.  Variable m is 
  1152.         not known in the outer block,  and the variables i and j declared 
  1153.         in  the  inner  block are different from the variables  i  and  j 
  1154.         declared in the outer block.  INTEGER variables can hold a number 
  1155.         between  -32767 and 32767.  The rule,  that has been mentioned in 
  1156.         the REAL section, about what variables are known in what block is 
  1157.         the rule of SCOPE of VARIABLES.
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                                        18
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.         STRING
  1193.  
  1194.            Format: STRING <variable> {,<variable>,..........,<variable>};
  1195.  
  1196.  
  1197.              The   STRING  statement  is  a   nonexecutable   declaration 
  1198.         statement  that  informs  the  Structured  Programming   Language 
  1199.         processor  that  the  named  variables are to  be  scalar  STRING 
  1200.         variables.  For  an  explanation of identifiers and the  rule  of 
  1201.         SCOPE  of  VARIABLES  see  the  sections  of  REAL  and   INTEGER 
  1202.         variables. An example.
  1203.  
  1204.              BEGIN
  1205.                 REAL x,y;
  1206.                 STRING Name,Address,Phone;
  1207.                 INPUT(Name,Address,Phone);
  1208.                 OUTPUT(MID$(Name,1,INSTR(Name,' ')),Phone);
  1209.              END
  1210.  
  1211.              Name,Address,Phone   are  declared  to  be   STRING   scalar 
  1212.         variables.  A  STRING  scalar  variable  can  hold  up  to  32767 
  1213.         characters,  if you will be using the translated BASIC program to 
  1214.         be compiled with a compiler.  If the translated program will  run 
  1215.         as  an interpreted program then the maximum amount of  characters 
  1216.         that a STRING can hold is 255.  The least amount of characters is 
  1217.         0 which represents the NULL string. The amount of characters that 
  1218.         a  STRING  holds  varies depending on the length  of  the  string 
  1219.         expression at the time of assignment of the variable.
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.                                        19
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.         REAL ARRAY
  1259.  
  1260.            Format: REAL ARRAY <array variable>(<bounds>)
  1261.  
  1262.                               {,<array variable> (<bounds>),..........};    
  1263.  
  1264.              The  REAL  ARRAY  statement is a  nonexecutable  declaration 
  1265.         statement   that  informs  the  Structured  Programming  Language 
  1266.         processor  that  the named variables are  REAL  ARRAY  variables. 
  1267.         Static storage is set aside for these arrays.  See the section on 
  1268.         REAL  variables  for an explanation of identifiers and  SCOPE  of 
  1269.         VARIABLES. An example.
  1270.  
  1271.              BEGIN
  1272.                 INTEGER intg1,intg2,intg3,count;
  1273.                 REAL zz,aa,bb;
  1274.                 REAL ARRAY y(100,100),x(5,5);
  1275.                 REAL ARRAY Z(4,4,4);
  1276.                 FOR intg1:=1 STEP 1 UNTIL 100 DO
  1277.                 BEGIN
  1278.                    FOR intg2:=1 STEP 1 UNTIL 100 DO
  1279.                    BEGIN
  1280.                       y(intg1,intg2):=0;
  1281.                    END
  1282.                 END
  1283.              END
  1284.  
  1285.              In this program three arrays are declared in the block. They 
  1286.         are:   y(100,100)   x(5,5)  and  Z(4,4,4).   ARRAY  bounds  in  a 
  1287.         ARRAY declaration statement must be unsigned integer constants.
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.                                        20
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.         INTEGER ARRAY
  1325.  
  1326.            Format: INTEGER ARRAY <array variable>(<bounds>)
  1327.  
  1328.                                 {,<array variable>(<bounds>),..........};
  1329.  
  1330.              The  INTEGER ARRAY statement is a nonexecutable  declaration 
  1331.         statement   that  informs  the  Structured  Programming  Language 
  1332.         processor  that the named variables are INTEGER ARRAY  variables. 
  1333.         Static storage is set up for each INTEGER ARRAY variable. See the 
  1334.         section on REAL variables for details on identifiers and SCOPE OF 
  1335.         VARIABLES. An example.
  1336.  
  1337.              BEGIN
  1338.                 INTEGER ARRAY N(15,5),PIX(20,3);
  1339.                 INTEGER i,j,min;
  1340.                 min:=-32760;
  1341.                 FOR i:=1 STEP 1 UNTIL 15 DO
  1342.                 BEGIN
  1343.                    FOR j:=1 STEP 1 UNTIL 5 DO
  1344.                    BEGIN
  1345.                       INPUT(N(i,j)); IF N(i,j)<min THEN min:=N(i,j);
  1346.                    END
  1347.                 END
  1348.                 OUTPUT('minimum value is:' @ min);
  1349.              END
  1350.  
  1351.              In  the  above example INTEGER ARRAY variables  N(15,5)  and 
  1352.         PIX(20,3)  are  declared.  ARRAY bounds in an  ARRAY  declaration  
  1353.         statement must be unsigned integer constants.
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                                        21
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.         STRING ARRAY
  1391.  
  1392.            Format: STRING ARRAY <array variable>(<bounds>)
  1393.          
  1394.                                 {,<array variable>(<bounds>),..........};
  1395.  
  1396.              The  STRING  ARRAY statement is a nonexecutable  declaration 
  1397.         statement  that  informs  the  Structured  Programming   Language 
  1398.         processor  that  the named variables are STRING ARRAY  variables. 
  1399.         Static storage is set up for the STRING ARRAY variable.  See  the 
  1400.         section on REAL variables for details of identifiers and SCOPE of 
  1401.         VARIABLES. An example.
  1402.  
  1403.              BEGIN
  1404.                 STRING ARRAY NAMES_of_STATES(50);
  1405.                 INTEGER i;
  1406.                 FOR i:=1 STEP 1 UNTIL 50 DO
  1407.                 BEGIN
  1408.                    INPUT('Name of state:' @ NAMES_of_STATES(i));
  1409.                    IF NAMES_of_STATES(i)='New York' THEN
  1410.                    BEGIN
  1411.                       OUTPUT('Thats the one:' @ NAMES_of_STATES(i));
  1412.                       OUTPUT('after ' @ i @ ' tries');
  1413.                       STOP;
  1414.                    END
  1415.                 END
  1416.              END
  1417.  
  1418.              In   the   above   example   the   STRING   ARRAY   variable 
  1419.         NAMES_of_STATES(50)  is  declared.   ARRAY  bounds  in  an  ARRAY 
  1420.         declaration statement must be unsigned integer constants.
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                        22
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.         PROCEDURE
  1457.  
  1458.            Format: PROCEDURE <procedure name> { (<parameter list>) };
  1459.                    BEGIN
  1460.                       <statements>
  1461.                    END
  1462.  
  1463.              The  PROCEDURE  statement sets up a group of statements  and 
  1464.         associates  them  with a single name.  It informs the  Structured 
  1465.         Programming  Language  processor  of  this  declaration.   It  is 
  1466.         technically a nonexecutable declaration and must be placed before 
  1467.         executable statements.  The statements between its BEGIN and  END 
  1468.         block   are  nonexecutable  and  executable.   The  nonexecutable 
  1469.         statements  are processed by the Structured Programming  Language 
  1470.         processor.  The  executable statements are also processed but are 
  1471.         not  executed  until  the PROCEDURE is called either  by  a  CALL 
  1472.         statement or by referencing it by its name. An example.
  1473.  
  1474.         BEGIN
  1475.            REAL Aa,Bb,Cc; { Declare parameters. }
  1476.            REAL Root_1,Root_2; { Declare Outputs of PROCEDURE. }
  1477.            PROCEDURE Quadratic_roots(Aa,Bb,Cc); { Parameter references. }
  1478.            BEGIN
  1479.               REAL Factor;
  1480.               Factor:=Bb*Bb-4.*Aa*Cc;
  1481.               IF Factor<0 THEN
  1482.               BEGIN
  1483.                  Root_1:=10^(-10); Root_2:=10^(-10);
  1484.                  RETURN;
  1485.               END
  1486.               Root_1:=(-Bb+SQR(Factor))/(2.*Aa);
  1487.               Root_2:=(-Bb-SQR(Factor))/(2.*Aa);
  1488.            END { Note: this END statement will execute a RETURN. }
  1489.            REAL Constant_A,Constant_B,Constant_C;
  1490.            Ask_for_quadratic_constants:
  1491.            INPUT('Enter A,B,C:' @ Constant_A,Constant_B,Constant_C);
  1492.            Quadratic_roots(Constant_A,Constant_B,Constant_C); {Arguments}
  1493.            OUTPUT(); OUTPUT(Root_1,Root_2); OUTPUT();
  1494.            GO Ask_for_quadratic_constants;
  1495.         END
  1496.  
  1497.              The  above example defines a PROCEDURE Quadratic_roots which 
  1498.         has three arguments.  This PROCEDURE is used to compute the roots 
  1499.         of a quadratic equation.
  1500.  
  1501.              Note:Parameters   in   the  PROCEDURE  declaration  can   be 
  1502.         REAL,INTEGER, or STRING scalar variables. These parameters should 
  1503.         be first declared in a block containing the PROCEDURE or  outside 
  1504.         it.  For  documentation purposes they can be declared immediately 
  1505.         before  the PROCEDURE.  The variable should then be named in  the 
  1506.         parameter  list  for  the PROCEDURE.   If  the  variable  is  not 
  1507.         declared,  then  the  parameter  will be assumed to be  a  STRING 
  1508.         scalar. Corresponding arguments in PROCEDURE calls must match the 
  1509.         type  of  the  parameter.   Arguments  are  passed  by  value  to 
  1510.         corresponding  parameters.  Signed INTEGER constants or  positive 
  1511.  
  1512.  
  1513.                                        23
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.         fractional  numbers  less  than  1 may be passed  to  a  REAL  or 
  1523.         INTEGER.   STRING   constants   can  be  passed  to   a   STRING. 
  1524.         REAL,INTEGER,  and STRING scalar variables can be arguments to  a 
  1525.         PROCEDURE  but they must match by type exactly.  Expressions  for 
  1526.         arguments are not allowed.
  1527.  
  1528.              Note:Since   the   PROCEDURE  statement  is  a   declaration 
  1529.         statement, control of the program passes around the PROCEDURE and 
  1530.         in  the  above example the labelled INPUT statement  is  executed 
  1531.         first.
  1532.  
  1533.         Another example.
  1534.  
  1535.              BEGIN
  1536.                 STRING Name,Address,Phone,RESULT;
  1537.                 STRING A,H,C; { Declare parameters for the PROCEDURE. }
  1538.                 PROCEDURE FORMAT(A,H,C);
  1539.                 BEGIN
  1540.                    INTEGER I;
  1541.                    RESULT:='';
  1542.                    FOR I:=1 STEP 1 UNTIL 20 DO
  1543.                    BEGIN
  1544.                       IF I>LEN(A) THEN RESULT:=RESULT+' ';
  1545.                       ELSE RESULT:=RESULT+MID$(A,I,1);
  1546.                    END
  1547.                    FOR I:=21 STEP 1 UNTIL 40 DO
  1548.                    BEGIN
  1549.                       IF (I-20)>LEN(H) THEN RESULT:=RESULT+' ';
  1550.                       ELSE RESULT:=RESULT+MID$(H,I-20,1);
  1551.                    END
  1552.                    FOR I:=41 STEP 1 UNTIL 60 DO
  1553.                    BEGIN
  1554.                       IF (I-40)>LEN(C) THEN RESULT:=RESULT+' ';
  1555.                       ELSE RESULT:=RESULT+MID$(C,I-40,1);
  1556.                    END
  1557.                 END
  1558.                 Name := 'John Smith' ; Address := '85 Broadway' ;
  1559.                 Phone := '203-555-2035' ;
  1560.                 FORMAT(Name,Address,Phone); { Call to FORMAT PROCEDURE }
  1561.                 OUTPUT(RESULT);
  1562.              END
  1563.  
  1564.              The  above  example  shows a program which has  a  PROCEDURE 
  1565.         FORMAT  which  combines the first 20 characters of  each  of  the 
  1566.         three arguments Name,Address,Phone leaving the value in RESULT.
  1567.  
  1568.              Note:A PROCEDURE may access globally declared variables. For 
  1569.         documentation  purposes  these  variables can  be  declared  just 
  1570.         before the PROCEDURE that uses them.
  1571.  
  1572.              Note:PROCEDURE's  can  be called recursively and the  RETURN 
  1573.         addresses  are saved on the STACK of the runtime system  but  the 
  1574.         user  must save any arguments and variables used in the PROCEDURE 
  1575.         for each level of invoking a PROCEDURE.
  1576.  
  1577.  
  1578.  
  1579.                                        24
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.         COMMENT , { }
  1589.  
  1590.            Format: COMMENT <text>; [Note: <text> should not contain ' ]
  1591.                    or      { <text> }
  1592.  
  1593.              The  COMMENT  statement is a statement used in a  Structured 
  1594.         Programming  Language  program to insert comments in the  program 
  1595.         for documentation purposes.  This statement is nonexecutable, but 
  1596.         can be placed almost anywhere in a program. An example.
  1597.  
  1598.              BEGIN
  1599.                 REAL x,y,z,sumsquare;
  1600.                 OUTPUT('Input x,y,z'); INPUT(x, {anywhere} y,z);
  1601.                 sumsquare := x^2. + y^2. + z^2. ;
  1602.                 COMMENT
  1603.                 sumsquare is equal to the sum of the squares of x,y and z; 
  1604.                 OUTPUT('The sum of the squares of');
  1605.                 { This is another example of a comment and you can embed
  1606.                  a quote ' in the text ,and this comment can appear any
  1607.                  where in the program. The end of the comment is this }
  1608.                 OUTPUT(x @' PLUS ' @ y @' PLUS ' @ z @' IS ' @ sumsquare);
  1609.              END
  1610.  
  1611.              The  above example shows the COMMENT statement and the  text 
  1612.         between COMMENT and the semicolon.  It is important to note  that 
  1613.         the  single  quote ' should not be used in the text of a  COMMENT 
  1614.         statement.  The second method of making a comment is by enclosing 
  1615.         any text between { and } characters.  This second type of comment 
  1616.         may have a single quote embedded,and can appear anywhere.
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.                                        25
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.         GO , GO TO , GOTO
  1655.  
  1656.            Format: GO <label>; or GO TO <label>; or GOTO <label>;
  1657.  
  1658.              These  statements in  the  Structured  Programming  Language  
  1659.         are  used  to  transfer  control of the  computer  to  a  labeled 
  1660.         Structured Programming Language statement. An example.
  1661.  
  1662.              BEGIN
  1663.                 INTEGER a,h,c;
  1664.                 a:=-1;
  1665.                 compute: a:=a+1;
  1666.                 INPUT(h);
  1667.                 IF h<0 THEN GO compute;
  1668.                 ELSE OUTPUT(a,' numbers < 0');
  1669.              END
  1670.  
  1671.              The  above  example shows the use of the  GO  TO  statement. 
  1672.         Control  passes  back  to the statement labeled  compute  if  the 
  1673.         variable  h < 0.  This example counts the number of values input 
  1674.         that  are less than zero.  Once h >= 0 as entered for input  then 
  1675.         control  passes to the OUTPUT statement and the program continues 
  1676.         on.
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                                        26
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.         ONERRGOTO
  1721.  
  1722.            Format: ONERRGOTO <label>;
  1723.  
  1724.              The  ONERRGOTO statement allows the user to trap errors  and 
  1725.         transfer control of the computer to a labeled statement. See your 
  1726.         BASIC  manual for the ERROR codes for your system.  You can  also 
  1727.         refer to your Disk Operating System manual. An example.
  1728.  
  1729.              BEGIN
  1730.                 REAL A,H,C;
  1731.                 STRING D,E,F;
  1732.                 OPEN('I',#1,'DATA.FIL');
  1733.                 ONERRGOTO end_of_file;
  1734.                 OUTPUT();
  1735.                 read:LINEIN(#1,D); COMMENT read in a line of data ;
  1736.                 OUTPUT(D); COMMENT output the line to the screen ;
  1737.                 GO read;
  1738.                 end_of_file:RESUME end_of_file1;
  1739.                 end_of_file1:CLOSE(); STOP;
  1740.              END
  1741.  
  1742.              The  above example shows a use of the ONERRGOTO statement to 
  1743.         trap  execution of a program when an end of file  is  encountered 
  1744.         for  a  sequential  disk file.  When the end of file  is  reached 
  1745.         control is transferred to the labeled statement end_of_file.  The 
  1746.         RESUME statement is executed,  as required and the program closes 
  1747.         all files and stops.
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.                                        27
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.         RETURN
  1787.  
  1788.            Format: RETURN;
  1789.  
  1790.              The RETURN statement is a statement that ends execution of a 
  1791.         PROCEDURE and returns control to the statement following the call 
  1792.         to  the  PROCEDURE.  There is also a form of this statement  that 
  1793.         allows transfer to a labeled statement. An example.
  1794.  
  1795.              BEGIN
  1796.                 REAL a,h,c;
  1797.                 REAL d,e;
  1798.                 PROCEDURE add(d,e);
  1799.                 BEGIN
  1800.                    c:=d+e;
  1801.                    IF c=0 THEN RETURN zero;
  1802.                    RETURN;
  1803.                 END
  1804.  
  1805.                 zero:INPUT('enter a,h'@ a,h);
  1806.                 add(a,h);
  1807.              END
  1808.  
  1809.              The  above example shows the two forms of RETURN  statement. 
  1810.         If  c=0  then the program control goes to the  statement  labeled 
  1811.         zero.  Otherwise control goes normally to the statement following 
  1812.         the  call to PROCEDURE add,  which is the final END statement  of 
  1813.         the program. Execution ends at this point.
  1814.  
  1815.              Note:The  END  statement  of the  PROCEDURE  declaration  is 
  1816.         equivalent to a RETURN statement. RETURN is made to the statement 
  1817.         after the CALL to the PROCEDURE.
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.                                        28
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.         INPUT
  1853.  
  1854.            Format: INPUT( {@} {<prompt string>{@|,}} <variable list> );
  1855.                   
  1856.                    INPUT( #<file number>,<variable list> );
  1857.  
  1858.  
  1859.              The  INPUT statement in the Structured Programming  Language 
  1860.         is  very similar to the INPUT statement in the BASIC language for 
  1861.         your computer. There are some differences. The INPUT statement is 
  1862.         used to get information into storage from an external device into 
  1863.         your  Structured  Programming Language  program.  The  Structured 
  1864.         Programming  Language  INPUT  statement differs  from  the  BASIC 
  1865.         statement  in  that  the @ (at sign) is used  instead  of  the  ; 
  1866.         (semicolon)  as  a  separator.  Variable names  must  conform  to 
  1867.         Structured  Programming Language standards.  The INPUT  statement 
  1868.         must  have parentheses around the INPUT list.  See the format for 
  1869.         the  INPUT statement in the statement format section on  page  9. 
  1870.         Additional information can be found in your BASIC users manual.
  1871.  
  1872.                             Pages
  1873.  
  1874.         Zenith BASIC        6.1-6.30 and 10.72-10.77
  1875.  
  1876.         IBM BASICA          3-33,3-38,3-44,4-122,4-125
  1877.  
  1878.  
  1879.  
  1880.              An example.
  1881.  
  1882.              BEGIN
  1883.                 INTEGER A,I;
  1884.                 REAL H;
  1885.                 STRING C;
  1886.                 INTEGER ARRAY SPOTS(10);
  1887.                 INPUT('Enter values for A,H,C' @ A,H,C);
  1888.                 FOR I:=1 STEP 1 UNTIL 10 DO
  1889.                 BEGIN
  1890.                    OUTPUT('Enter value of SPOTS(' @ STR$(I) @ ') :' @);
  1891.                    INPUT(SPOTS(I));
  1892.                 END
  1893.                 OPEN('I',#1,'INFILE.DAT');
  1894.                 READIT:IF EOF(1) THEN
  1895.                 BEGIN
  1896.                    CLOSE(#1); STOP;
  1897.                 END
  1898.                 INPUT(#1,C); OUTPUT(C);
  1899.                 GO READIT;
  1900.              END
  1901.  
  1902.              The above example shows the use of the INPUT statement.  The 
  1903.         first  two  INPUT  statements  are used to  get  input  from  the 
  1904.         keyboard  and  the third is to get input from a disk  file  named 
  1905.         INFILE.DAT .
  1906.  
  1907.  
  1908.  
  1909.                                        29
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.         LINEIN
  1919.  
  1920.            Format: LINEIN( {@} {<prompt string>{@|,}} <string variable>);
  1921.  
  1922.                    LINEIN( #<file number>,<string variable>);
  1923.  
  1924.              The LINEIN statement in the Structured Programming  Language 
  1925.         is very similar to the LINE INPUT statement in the BASIC language 
  1926.         for  your  computer.  There  are  some  differences.  The  LINEIN 
  1927.         statement  is  used  to  get information  into  storage  from  an 
  1928.         external   device  into  your  Structured  Programming   Language 
  1929.         program.  The  Structured  Programming Language LINEIN  statement 
  1930.         differs from the BASIC statement in that the @ (at sign) is  used 
  1931.         instead of the ;  (semicolon) as a separator. Variable names must 
  1932.         conform to Structured Programming Language standards.  The LINEIN 
  1933.         statement  must  have parentheses around the LINEIN  input  list. 
  1934.         See  the format for the LINEIN statement in the statement  format 
  1935.         section  on page 9.  Additional information can be found in  your 
  1936.         BASIC users manual.
  1937.  
  1938.                             Pages
  1939.  
  1940.         Zenith BASIC        6.1-6.30 and 10.90-10.91
  1941.  
  1942.         IBM BASICA          3-33,3-38,3-44,4-144,4-145
  1943.  
  1944.  
  1945.  
  1946.              An example.
  1947.  
  1948.              BEGIN
  1949.                 INTEGER A,I;
  1950.                 REAL H;
  1951.                 STRING C;
  1952.                 OPEN('I',#1,'INFILE.DAT');
  1953.                 READIT:IF EOF(1) THEN
  1954.                 BEGIN
  1955.                    CLOSE(#1); STOP;
  1956.                 END
  1957.                 LINEIN(#1,C); OUTPUT(C);
  1958.                 GO READIT;
  1959.              END
  1960.  
  1961.              The above example shows the use of the LINEIN statement. The 
  1962.         LINEIN statement is used to get a line of input from a disk  file 
  1963.         named INFILE.DAT.
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                                        30
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.         GET , PUT
  1985.  
  1986.            Format: GET #<file number> {,<record number>};
  1987.  
  1988.                    PUT #<file number> {,<record number>};
  1989.  
  1990.              The  GET  and PUT statements in the  Structured  Programming 
  1991.         Language  are used to read and write records from a disk file  in 
  1992.         the  random  access mode.  See the statement  formats  for  these 
  1993.         statements  on page 9 of this manual.  Since these statements are 
  1994.         the  same as the BASIC statements for your machine,  except  that 
  1995.         variables   must  conform  to  Structured  Programming   Language 
  1996.         variable standards,  additional information can be found in  your 
  1997.         BASIC users manual.
  1998.  
  1999.                             Page
  2000.  
  2001.         Zenith BASIC        6.16-6.29 and 10.58 and 10.140
  2002.  
  2003.         IBM BASICA          3-33,3-38,3-44,4-106,4-230
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.                                        31
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.         OUTPUT
  2051.  
  2052.            Format: OUTPUT( {#<file number>,} {USING <string expression>@}
  2053.  
  2054.                            {<output expression list>} );
  2055.  
  2056.  
  2057.              The  OUTPUT statement in the Structured Programming Language 
  2058.         is very similar to the PRINT statement in the BASIC language  for 
  2059.         your computer.  There are some differences.  The OUTPUT statement 
  2060.         is  used  to send information from storage to an external  device 
  2061.         from your Structured Programming Language program. The Structured 
  2062.         Programming  Language  OUTPUT statement differs  from  the  BASIC 
  2063.         statement  in  that  the  @ (at sign) is used instead  of  the  ; 
  2064.         (semicolon)  as  a  separator.  Variable names  must  conform  to 
  2065.         Structured Programming Language standards.  The OUTPUT  statement 
  2066.         must have parentheses around the OUTPUT list.  See the format for 
  2067.         the  OUTPUT statement in the statement format section on page 10. 
  2068.         Additional  information can be found in your BASIC users  manual. 
  2069.         For each reference of the word PRINT the word OUTPUT shall  apply 
  2070.         in the Structured Programming Language.
  2071.  
  2072.                             Pages
  2073.  
  2074.         Zenith BASIC        6.1-6.30 and 10.130-10.137
  2075.  
  2076.         IBM BASICA          3-33,3-38,3-44,4-216,4-219,4-225
  2077.  
  2078.  
  2079.  
  2080.              An example.
  2081.  
  2082.              BEGIN
  2083.                 INTEGER i; STRING format;
  2084.                 format:='&##&##.#####';
  2085.                 OPEN('OUTFIL.DAT' FOR OUTPUT AS #1);
  2086.                 FOR i:=1 STEP 1 UNTIL 10 DO
  2087.                 BEGIN
  2088.                    OUTPUT( USING format 
  2089.                         @ 'The square root of ' @ i @ ' is ' @ SQR(i) );
  2090.                    OUTPUT(#1,USING format
  2091.                         @ 'The square root of ' @ i @ ' is ' @ SQR(i) );
  2092.                 END
  2093.              END
  2094.  
  2095.              In  the above example a disk file is opened and square roots 
  2096.         are  computed  and  output  to  the  screen  and  the  disk  file 
  2097.         OUTFIL.DAT. The USING feature is used to set a format for output.
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.                                        32
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.         CALL
  2117.  
  2118.            Format: {CALL} <procedure name> {( <argument list> )};
  2119.  
  2120.              The  CALL statement is used to call a Structured Programming 
  2121.         Language PROCEDURE. The user can call a PROCEDURE by name as well 
  2122.         without CALL.  In order for a CALL to be legal the PROCEDURE must 
  2123.         be known. That is, it must be declared in the same BEGIN block as 
  2124.         the call or declared in a BEGIN block outside of the BEGIN  block 
  2125.         where  the  PROCEDURE is referenced.  It cannot be declared in  a 
  2126.         BEGIN  block nested in the current block where the call is  made. 
  2127.         An example.
  2128.  
  2129.              BEGIN
  2130.                 INTEGER A,H,C;
  2131.                 INTEGER IA,IB;
  2132.                 PROCEDURE SUM(IA,IB);
  2133.                 BEGIN
  2134.                    C:=IA+IB;
  2135.                 END
  2136.                 A:=5; H:=6; SUM(A,H); OUTPUT(C);
  2137.                 CALL SUM(10,30); OUTPUT(C);
  2138.              END
  2139.  
  2140.              In  this  example,  are  the two ways the user  can  call  a 
  2141.         procedure,  by either just mentioning its name and arguments,  or 
  2142.         by CALL and then its name and arguments.
  2143.  
  2144.              Note:A  PROCEDURE  may  be called with  arguments  that  are 
  2145.         globally  declared variables.  For documentation  purposes  these 
  2146.         variables  can  be declared just before the PROCEDURE  that  uses 
  2147.         them.
  2148.  
  2149.              Note:PROCEDURE's  can  be called recursively and the  RETURN 
  2150.         addresses  are saved on the STACK of the runtime system  but  the 
  2151.         user  must save any arguments and veriables used in the PROCEDURE 
  2152.         for each level of invoking a PROCEDURE. An example:
  2153.  
  2154.              BEGIN
  2155.                 INTEGER N, {Argument.} {Global variable.}
  2156.                         Factorial_result; {Result.} {Global variable.}
  2157.                 PROCEDURE Factorial; 
  2158.                 BEGIN
  2159.                    IF N=1 THEN
  2160.                    BEGIN
  2161.                       Factorial_result := 1; RETURN;
  2162.                    END
  2163.                    ELSE
  2164.                    BEGIN
  2165.                       N := N-1; Factorial; N := N+1;
  2166.                       Factorial_result := N * Factorial_result; RETURN;
  2167.                    END
  2168.                 END
  2169.                 N := 5; Factorial; OUTPUT(Factorial_result);
  2170.              END
  2171.  
  2172.  
  2173.                                        33
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.         FOR
  2183.  
  2184.            Format: FOR <scalar arithmetic variable> := <start arith. expr.>
  2185.                        STEP <increment arithmetic expression>
  2186.                             UNTIL <limit arithmetic expression>
  2187.                                   DO BEGIN
  2188.                                      <statements>
  2189.                                   END
  2190.  
  2191.              The  FOR statement allows the user to do repetitve processes 
  2192.         and use a variable that has a varying value for each  repetition. 
  2193.         An example.
  2194.  
  2195.              BEGIN
  2196.                 REAL ARRAY x(100),y(100);
  2197.                 REAL xvalue,yvalue;
  2198.                 INTEGER i;
  2199.                 i:=1;
  2200.                 FOR xvalue:=.01 STEP .01 UNTIL 1. DO
  2201.                 BEGIN
  2202.                    IF i<=100 THEN
  2203.                    BEGIN
  2204.                       x(i):=xvalue; yvalue:=SIN(xvalue)*EXP(xvalue);
  2205.                       y(i):=yvalue; OUTPUT(x(i),y(i));
  2206.                    END
  2207.                    i:=i+1;
  2208.                 END
  2209.              END
  2210.  
  2211.              The  above  example shows a FOR loop that computes  100  x,y 
  2212.         pairs  where the x's vary from .01 to 1 and the  corresponding  y 
  2213.         value is SIN(x)*EXP(x). This loop will be executed 100 times when 
  2214.         xvalue  becomes greater than 1.  The arithmetic expression  after 
  2215.         the := is the initial value. The arithmetic expression after STEP 
  2216.         is   the  increment  or  decrement  and  finally  the  arithmetic 
  2217.         expression after UNTIL is the limit. The loop is executed only if 
  2218.         the  initial value has not reached the limit,  depending  on  the 
  2219.         magnitude of the STEP value.
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.                                        34
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.         IF
  2249.  
  2250.            Format: IF <logical expression> THEN  <statement>
  2251.                    { ELSE <statement> }
  2252.  
  2253.                 Note: In each of the clauses THEN,ELSE the <statement>
  2254.                 can be replaced with the BEGIN <statements> END
  2255.                 The  single  statement may not be an IF,FOR,REPEAT,REAL,
  2256.                 INTEGER,STRING,PROCEDURE,ON, or WHILE statement. You 
  2257.                 must place it between BEGIN and END statements.
  2258.  
  2259.  
  2260.  
  2261.              The  IF  statement  is used to test logical  conditions  and 
  2262.         depending on that logical condition the program can take  certain 
  2263.         action.  If  the logical condition is true,  actions are taken on 
  2264.         the  THEN  path  or if it is false,  actions  are  taken  on  the 
  2265.         optional  ELSE path or action passes to the next statement  after 
  2266.         the extent of the THEN clause. An example.
  2267.  
  2268.              BEGIN
  2269.                 INTEGER i,j,k;
  2270.                 FOR i:=10 STEP -1 UNTIL 1 DO
  2271.                 BEGIN
  2272.                    INPUT('Enter number:' @ j);
  2273.                    IF j<0 THEN
  2274.                    BEGIN
  2275.                       OUTPUT('The number is less than zero');
  2276.                       k:=k+1;
  2277.                    END
  2278.                    ELSE OUTPUT('The number is greater than equal to zero');
  2279.                 END
  2280.                 OUTPUT('There were ' @ k @ ' negative numbers input');
  2281.              END
  2282.  
  2283.              The  above  example has the user enter 10 numbers and  tells 
  2284.         the  user  if the number was greater than zero or  not.  It  also 
  2285.         computes  the total of numbers that were less than zero.  The  IF 
  2286.         statement  tests if j<0.  If j<0 the THEN clause is executed  and 
  2287.         the  message is output that the number is negative or  zero,  and 
  2288.         the number of negative numbers is incremented by 1. Otherwise the 
  2289.         ELSE  clause  is  executed  and the message that  the  number  is 
  2290.         greater than or equal to zero is output.
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                                        35
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.         END
  2315.  
  2316.            Format: END
  2317.  
  2318.              The  END  statement defines the end of a BEGIN block  for  a 
  2319.         normal BEGIN block,  for a PROCEDURE BEGIN block,  for a FOR loop 
  2320.         BEGIN  block,  for a THEN clause BEGIN block,  for an ELSE clause 
  2321.         BEGIN block or the program BEGIN block. An example.
  2322.  
  2323.              BEGIN
  2324.                 REAL SQUARE,ROUND;
  2325.                 INTEGER A,H,C;
  2326.                 SQUARE:=2; ROUND:=1;
  2327.                 FOR A:=30 STEP 2 UNTIL 50 DO
  2328.                 BEGIN
  2329.                    SQUARE:=ROUND+A*SQUARE;
  2330.                 END
  2331.                 OUTPUT(SQUARE);
  2332.              END
  2333.  
  2334.              In  the above example the first END statement ends  the  FOR 
  2335.         loop BEGIN block. The second END ends the program BEGIN block.
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.                                        36
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.         WHILE
  2381.  
  2382.            Format: WHILE <logical expression> DO
  2383.                    BEGIN
  2384.                       <statements>
  2385.                    END
  2386.  
  2387.              The  WHILE statement is used to repeat execution of a set of 
  2388.         statements while a certain logical condition is true. An example.
  2389.  
  2390.              BEGIN
  2391.                 REAL x;
  2392.                 x:=5;
  2393.                 WHILE x<>0 DO
  2394.                 BEGIN
  2395.                    x:=x-1;
  2396.                    OUTPUT(x^2.);
  2397.                 END
  2398.              END
  2399.  
  2400.              In  the above example the two statements in the inner  BEGIN 
  2401.         block are executed as long as x is not equal to zero.  The  inner 
  2402.         block will be executed five times and then the program will end.
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.                                        37
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.         REPEAT
  2447.  
  2448.            Format: REPEAT <statements>
  2449.                    UNTIL <logical expression>;
  2450.  
  2451.  
  2452.              The REPEAT statement is used to repeat execution of a set of 
  2453.         statements  until  a  certain  logical  condition  is  true.  The 
  2454.         difference  between the REPEAT statement and the WHILE  statement 
  2455.         is that the test is done after execution of the set of statements 
  2456.         with  the REPEAT statement and before the set of statements  with 
  2457.         the WHILE statement. An example.
  2458.  
  2459.              BEGIN
  2460.                 REAL x;
  2461.                 x:=5;
  2462.                 REPEAT
  2463.                    x:=x-1;
  2464.                    OUTPUT(x^2.);
  2465.                 UNTIL x=0;
  2466.              END
  2467.  
  2468.              Note  that there is no BEGIN block involved with the  REPEAT 
  2469.         statement.  The  user may wish to take advantage of that  aspect. 
  2470.         The  statements  between REPEAT and UNTIL will be  executed  five 
  2471.         times.
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                        38
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.         ;
  2513.  
  2514.            Format: ;
  2515.  
  2516.              The empty statement is used as a place for a label. A GOTO 
  2517.         statement  can then refer to this statement by its label if it is 
  2518.         labeled. An example.
  2519.  
  2520.              BEGIN
  2521.                 STRING COMMAND;
  2522.                 INTEGER INP,OUTP;
  2523.                 COMMENT INP,OUTP ARE DECLARED AS INTEGERS AND ARE EXTERNAL
  2524.                         PROCEDURES;
  2525.                 LOOP:INPUT('ENTER A COMMAND:' @ COMMAND);
  2526.                 IF COMMAND = 'STOP' THEN GO FINISH;
  2527.                 IF COMMAND = 'INPUT' THEN CALL INP;
  2528.                 IF COMMAND = 'OUTPUT' THEN CALL OUTP;
  2529.                 GO LOOP;
  2530.                 FINISH:;
  2531.              END
  2532.  
  2533.              The  above  example has the empty statement with  the  label 
  2534.         FINISH.  It  is  a  point where the program  will  end  when  the 
  2535.         statement  GO FINISH is executed.  This is because the  statement 
  2536.         after the empty statement is the final END statement.
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.                                        39
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.         DOS
  2579.  
  2580.            Format: DOS;
  2581.  
  2582.              The  DOS statement causes program execution to return to the 
  2583.         MS DOS system. An example.
  2584.  
  2585.              BEGIN
  2586.                 REAL I,J;
  2587.                 ask:OUTPUT('Enter upper limit:' @ J);
  2588.                 IF J<=0 THEN DOS;
  2589.                 FOR I:=1 STEP 1 UNTIL J DO
  2590.                 BEGIN
  2591.                    OUTPUT('The square root of ' @ I @ ' is ' @ SQR(I));
  2592.                    OUTPUT('The square of ' @ I ' is ' @ I*I );
  2593.                 END
  2594.                 GO ask;
  2595.              END
  2596.  
  2597.              The  above  example shows the DOS statement and it  will  be 
  2598.         executed,in  this case,if the user enters a number less  than  or 
  2599.         equal to zero.
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.                                        40
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.         HOME
  2645.  
  2646.            Format: HOME;
  2647.  
  2648.              The  HOME statement is used to clear the console screen  and 
  2649.         place  the  cursor  at  the first column in  the  first  row.  An 
  2650.         example.
  2651.  
  2652.              BEGIN
  2653.                 REAL x,y;
  2654.                 HOME;
  2655.                 FOR x:=.0 STEP .1 UNTIL 2*3.14159 DO
  2656.                 BEGIN
  2657.                    y:=SIN(x); PSET(101.*x,220.-101.*(y+1)),0;
  2658.                 END
  2659.                 busy:GO TO busy;
  2660.              END
  2661.  
  2662.              The  above example uses HOME to clear the screen and then  a 
  2663.         sine graph is plotted on the console screen.
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.                                        41
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.         DEFSEG
  2711.  
  2712.            Format: DEFSEG := <expression>;
  2713.  
  2714.              The  DEFSEG statement is the same as the DEF  SEG  statement 
  2715.         but for the implementation of the Structured Programming Language 
  2716.         the name is one word. An example.
  2717.  
  2718.              BEGIN
  2719.                 INTEGER A,H,C,D;
  2720.                 DEFSEG := 15.*4096.;
  2721.                 FOR A:=1 STEP 1 UNTIL 16*1024 DO
  2722.                 BEGIN
  2723.                    OUTPUT('Location:'@ A ,' Value:' @ PEEK(A));
  2724.                 END
  2725.              END
  2726.  
  2727.              The above example uses the DEFSEG statement to set the  base 
  2728.         address for peeks and pokes to the sixteenth 64k segment.
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.                                        42
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.         EOT
  2777.  
  2778.            Format: EOT 
  2779.  
  2780.              The  EOT  statement  will have  the  Structured  Programming 
  2781.         Language  processor  ask the user for a filename  for  additional 
  2782.         input.  This  allows  the user to have multifile input of  source 
  2783.         files to the processor.  This allows for user source libraries of 
  2784.         Structured  Programming Language procedures and  declarations  or 
  2785.         other  Structured Programming Language source.  The user can link 
  2786.         many  source  files  together  as  long  as  the  BEGIN  and  END 
  2787.         statements  match and that the last END statement will cause  the 
  2788.         second pass of the processor to run.  It is recommended that  the 
  2789.         EOT  statement  be placed on the last line of the source file  by 
  2790.         itself and surrounded with a space on each side. An example.
  2791.  
  2792.              BEGIN
  2793.                 REAL X,Y,Z;
  2794.                 INTEGER A,H,C;
  2795.              EOT 
  2796.  
  2797.              This  will cause the processor to ask for a new file name by 
  2798.         asking.
  2799.  
  2800.              ENTER FILE NAME:
  2801.  
  2802.              Then  the  user  will enter the  filename  to  be  used.  No 
  2803.         filename   extension  should  be  entered.   Once  the  name   is 
  2804.         entered, the processor will continue if the file is found. If the 
  2805.         file is not found,the processor will ask for another filename.
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.                                        43
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.         ARITHMETIC ASSIGNMENT STATEMENT
  2843.  
  2844.              The Arithmetic assignment statement is used to assign values 
  2845.         by formula to INTEGER and REAL scalar and ARRAY variables defined 
  2846.         in a Structured Programming Language program. An example.
  2847.  
  2848.              BEGIN
  2849.                 REAL PI,RADIUS,DIAMETER,HEIGHT;
  2850.                 REAL J,AREA,PERIMETER;
  2851.                 REAL ARRAY storage(26);
  2852.                 INTEGER i,k;
  2853.                 PI:=3.14159;
  2854.                 FOR i:=1 STEP 1 UNTIL 26 DO
  2855.                 BEGIN
  2856.                    storage(i):=0;
  2857.                 END
  2858.                 FOR J:=1. STEP .1 UNTIL 100. DO
  2859.                 BEGIN
  2860.                    DIAMETER:=J;
  2861.                    RADIUS:=DIAMETER/2.;
  2862.                    AREA:=PI*(RADIUS)^2.;
  2863.                    PERIMETER:=PI*DIAMETER;
  2864.                    OUTPUT(RADIUS,DIAMETER,AREA,PERIMETER);
  2865.                 END
  2866.              END
  2867.  
  2868.              The   above  example  shows  various  arithmetic  assignment 
  2869.         statements in the Structured Programming Language.  Note the  use 
  2870.         of  the  := as the assignment operator.  The user must  use  this 
  2871.         form. The symbol = is used in logical expressions.
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                                        44
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.         STRING ASSIGNMENT STATEMENT
  2909.  
  2910.              The  String assignment statement  is used to  assign  string 
  2911.         values by formula to STRING scalar and ARRAY variables defined in 
  2912.         a Structured Programming Language program. An example.
  2913.  
  2914.              BEGIN
  2915.                 STRING ARRAY names(50),phones(50);
  2916.                 STRING record,record1,record2;
  2917.                 INTEGER i;
  2918.                 INPUT(record1,record2);
  2919.                 record:=record1+MID$(record2,1,5); OUTPUT(record);
  2920.                 FOR i:=1 STEP 1 UNTIL 50 DO
  2921.                 BEGIN
  2922.                    INPUT(names(i),phones(i));
  2923.                    record:=names(i)+phones(i);
  2924.                    OUTPUT(record);
  2925.                 END
  2926.              END
  2927.  
  2928.              The   above   example  shows   various   string   assignment 
  2929.         statements. The := is the assignment operator. The = sign is used 
  2930.         in logical expressions.
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.                                        45
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.         LABELED STATEMENT
  2975.  
  2976.              The  labeled statement is any statement that has one or more 
  2977.         labels   preceeding  it.   Some  examples  of  isolated   labeled 
  2978.         statements.
  2979.  
  2980.              compute:X:=X+3.;
  2981.  
  2982.              GONE:INPUT(x,y,z);
  2983.  
  2984.              OUT1:putout:output: OUTPUT('Name','Address','Phone');
  2985.  
  2986.              Finish:STOP;
  2987.  
  2988.              A  GO TO statement,RETURN <label>,RESUME  <label>  statement 
  2989.         can be used to transfer to a labeled statement.  You may note the 
  2990.         use of the label, output. This name is not a keyword. OUTPUT is a 
  2991.         keyword, however.
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.                                        46
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.         ARITHMETIC OPERATORS
  3041.  
  3042.              +    Addition
  3043.              -    Subtraction
  3044.              /    Normal division
  3045.              \    Integer division
  3046.              MOD  Modulo function
  3047.              *    Multiplication
  3048.              ^    Exponentiation
  3049.  
  3050.         Refer to pages 5.19-5.26 in the ZBASIC users manual.
  3051.                        3-21 in the IBM BASICA users manual.
  3052.  
  3053.  
  3054.  
  3055.         STRING OPERATORS
  3056.  
  3057.              +    String concatenation
  3058.  
  3059.         Concatenation of two or more strings means to join them together.
  3060.  
  3061.         LOGICAL OPERATORS
  3062.  
  3063.              AND  Logical AND of two logical quantities.
  3064.              OR   Logical OR of two logical quantities.
  3065.              NOT  Logical NOT of a logical quantity.
  3066.              XOR  Logical exclusive OR of two logical quantities.
  3067.              IMP  Logical Implication of two logical quantities.
  3068.              EQV  Logical Equivalence of two logical quantities.
  3069.  
  3070.         Refer to pages 5.32-5.45 in the ZBASIC manual.
  3071.                        3-25 in the IBM BASICA manual.
  3072.  
  3073.  
  3074.         COMPARISON OPERATORS
  3075.  
  3076.              =    Equal to
  3077.              <    Less than
  3078.              >    Greater than
  3079.              <=   Less than or equal to
  3080.              >=   Greater than or equal to
  3081.              <>   Not equal to
  3082.  
  3083.         Refer to pages 5.27-5.31 in the ZBASIC manual.
  3084.                        3-23 in the IBM BASICA manual.
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.                                        47
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.         IMPORTANT IMPLEMENTATION RESTRICTIONS AND CONVENTIONS
  3107.  
  3108.         1.  No  more than 10 nested blocks may be set up in a  Structured 
  3109.         Programming  Language   program.   IF  THEN  ELSE  statements,FOR 
  3110.         loops,WHILE  statements,PROCEDUREs  all create BEGIN  blocks  and 
  3111.         must be counted.
  3112.  
  3113.         2.  In  Structured Programming Language programs,  REAL  floating 
  3114.         point  constants with E or D are not supported.  E.G.  .245E5  or 
  3115.          .24556613D5  are illegal,  however use .245 * 10^5 ,  .245566  * 
  3116.         10^5 instead.
  3117.            
  3118.         3. However for INPUT the user must use the exponential format for 
  3119.         large  numbers where the E format and D format  are  legal. 
  3120.         E.G. .245E5 and .245566D5 are legal input.
  3121.  
  3122.         4. Arguments to PROCEDURE calls must either be a STRING ,INTEGER, 
  3123.         or REAL scalar variable, STRING constant, signed INTEGER constant 
  3124.         or fractional unsigned number less than one. The type of argument 
  3125.         must  match  the  type of parameter.  One exception is  that  the 
  3126.         numeric  constant may be passed to a REAL or  INTEGER  parameter.  
  3127.         Expressions  are  not  allowed.  However  arguments  to  EXTERNAL 
  3128.         PROCEDURES  (FORTRAN,PASCAL,MACRO  ASSEMBLER)  can be  any  legal 
  3129.         expression. Consult your BASIC manual.
  3130.  
  3131.         5.  Variable names are allowed up to 40 characters,the first must 
  3132.         be alphabetic. Lower case characters are allowed.
  3133.  
  3134.         6.  All  variables and PROCEDUREs except LABELS must be  declared 
  3135.         before referencing them.
  3136.  
  3137.         7.  No Structured Programming Language reserved word may be  used 
  3138.         as a variable name.
  3139.  
  3140.         8. In Structured Programming Language statements that have either 
  3141.         arithmetic  or  string expressions,  only some positional  syntax 
  3142.         checking is done in the arithmetic expression.  There is checking 
  3143.         to  see if parentheses balance,  if an illegal  operator  follows 
  3144.         another indicating that an operand is missing,  if an operator or 
  3145.         punctuation  is missing.  Checking is done to see that  variables 
  3146.         are declared and that operators and special characters are valid. 
  3147.         Reserved word usage is checked also.
  3148.  
  3149.         9. No checks are made to see if the number of subscripts in a use 
  3150.         of  an ARRAY variable match the number of bounds of that declared 
  3151.         ARRAY variable.
  3152.  
  3153.         10.  No  checks are made to see if the number of arguments  in  a 
  3154.         PROCEDURE  call  match the number of parameters of that  declared 
  3155.         PROCEDURE.
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                        48
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.         11.  Concerning  points  8  and 9,any errors not  caught  by  the 
  3173.         Structured Programming Language processor,  will surely be caught 
  3174.         by  the  BASIC interpreter in its run time system and  surely  by 
  3175.         your  machine's BASIC compiler at compilation stage.  The  Symbol 
  3176.         table can be of great help in debugging a Structured  Programming 
  3177.         Language program.
  3178.  
  3179.         12.  There  is a limit of 250 variables that can be declared in a 
  3180.         BEGIN block.  Variables can be declared in any BEGIN block,  even 
  3181.         if it is a clause of THEN,ELSE,FOR loop,WHILE DO,PROCEDURE,etc.
  3182.  
  3183.         13.  String  constants are limited to 250 characters  although  a 
  3184.         string  variable  can  contain  up  to  32767  characters,if  the 
  3185.         translated BASIC program is compiled.
  3186.  
  3187.         14.   All  bounds that are declared in any ARRAY declaration must 
  3188.         be an integer constant. Variable bounds are not legal.
  3189.  
  3190.         15.   Declaration statements i.e. REAL,REAL ARRAY,INTEGER,INTEGER 
  3191.         ARRAY,STRING,STRING   ARRAY,PROCEDURE   must  be  placed   before 
  3192.         executable  statements  in a BEGIN END block.  An error  will  be 
  3193.         generated  if  you  place  a  declaration  after  an   executable 
  3194.         statement in that block.
  3195.  
  3196.         16.   PROCEDURE  parameters if not declared are string variables. 
  3197.         They  are considered as being declared in the BEGIN block that is 
  3198.         part of the PROCEDURE declaration. The parameter is only known in 
  3199.         that block or blocks nested in the PROCEDURE.
  3200.  
  3201.         17.   Labels  are declared implicitly and are considered known in 
  3202.         every block in the program. They are considered as being declared 
  3203.         in the main program block,  and therefore they are counted in the 
  3204.         total number of variables declared in the main program block.   
  3205.  
  3206.         REAL CONSTANTS
  3207.  
  3208.         -1
  3209.         -.433*10^5     Input form: -.433E5
  3210.  
  3211.         INTEGER CONSTANTS
  3212.  
  3213.         3200
  3214.         -5
  3215.         32767
  3216.  
  3217.         STRING CONSTANTS
  3218.  
  3219.         'ABC'
  3220.         'This is a string'
  3221.         '' ,the null string
  3222.  
  3223.         Note:On  entering a string for INPUT it must be between "  double 
  3224.         quotes.  Although  if  a  string constant is  the  only  constant 
  3225.         entered on INPUT or LINEIN then no " characters need to  surround 
  3226.         the string. See your BASIC manual for entering string constants. 
  3227.  
  3228.  
  3229.                                        49
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.         APPLICATION NOTES
  3239.  
  3240.         1.   All  variables in a Structured Programming Language  program 
  3241.         are  put  in  COMMON in a certain order.  If you  wish  to  CHAIN 
  3242.         Structured  Programming  Language  programs and  use  COMMON  you 
  3243.         should declare the same variables from one module to another, and 
  3244.         they  must  be in the same order.  It would help to use the  same 
  3245.         declaration  statements.  If you don't declare the same  variable 
  3246.         names,  but you declare the same number of variables, and type of 
  3247.         variables or arrays with the same bounds,  you may be able to use 
  3248.         the  variables  in  COMMON.  See your  BASIC  interpreter  and/or 
  3249.         compiler  manuals for details on COMMON.  In addition,  the  same 
  3250.         procedures,  if they use arguments must be declared in all  CHAIN 
  3251.         modules.  Again  they should be in the same order in reference to 
  3252.         other variables.
  3253.  
  3254.         2.   You  may  wish to use double  precision variables   in  your 
  3255.         program  operations.  To  accomplish  this  you  can  modify  the 
  3256.         translated  BASIC program by placing a DEFDBL A statement  before 
  3257.         any  other  statement  in  the  program.  This  will  change  the 
  3258.         precision of all the REAL variables to double precision.
  3259.  
  3260.         3.   You will notice that the LOCATE, COLOR and SCREEN statements 
  3261.         are  described  in a format for the  Zenith  Z-100  machine.  The 
  3262.         translator  will understand those statements for your machine  as 
  3263.         well,if  you have an IBM PC or other machine.  As long as you use 
  3264.         variables   that  conform  to  Structured  Programming   Language 
  3265.         standards,  the statements will be translated properly. Of course 
  3266.         your  BASIC  compiler  or  interpreter  will  check  for  further 
  3267.         possibilities  of syntax errors.  For additional information  you 
  3268.         should  also  check your machine's Basic  language  manual.  (See 
  3269.         Implementation restrictions points 8 and 9)
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.                                        50
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.               RUNNING THE STRUCTURED PROGRAMMING LANGUAGE PROCESSOR
  3305.  
  3306.              Make  sure  that  your diskette contains the  execute  files 
  3307.         SP.EXE  and  SPA.EXE.  These are the two files that make  up  the 
  3308.         Structured  Programming Language processor.  Place the disk  with 
  3309.         the Structured Programming Language processor in the default disk 
  3310.         drive and enter SP.  The processor will announce its name and ask 
  3311.         for a filename. If at this point you enter a letter followed by a 
  3312.         colon,  the processor will display the [.SP] source files on that 
  3313.         disk drive.  Enter a filename but not an extension. The processor 
  3314.         will  add the extension .SP.  All Structured Programming Language  
  3315.         programs  must have a file extension .SP.  It will ask  the  user 
  3316.         where scratch files and the final output file will be created. It 
  3317.         will  ask if the user wants a symbol table,  if the user wants  a 
  3318.         listing,  and if a listing is desired,  then if the listing is to 
  3319.         go  to the screen,  disk or printer.  This is for the first  pass 
  3320.         only.  If no listing is requested, all  error messages will go to 
  3321.         the  screen.  The  second pass messages go to the screen  if  the 
  3322.         listing  is sent to the screen or to a disk file.  If the listing 
  3323.         is sent to the printer,  then the second pass messages go to  the 
  3324.         printer  as well.  If you don't need a listing then the operation 
  3325.         of the translator is speeded up.  The translator may be halted at 
  3326.         anytime during the first pass by pressing the space bar. When the 
  3327.         processor is done a program file <dev>:<filename>.BAS will reside 
  3328.         on the desired drive as an ascii file.  This file MUST be  loaded 
  3329.         into  your  BASIC  interpreter workspace and SAVED IN  THE  ASCII 
  3330.         FORMAT,in order for compilation by your machine's BASIC compiler, 
  3331.         or the MICROSOFT BASIC Compiler.
  3332.  
  3333.         SYMBOL TABLE AND SOURCE LISTING
  3334.  
  3335.              The symbol table contains a dictionary which tells the  user 
  3336.         information  about each variable,label,procedure that is declared 
  3337.         in a Structured Programming Language program.  The internal  name 
  3338.         for  a  scalar variable is directly used in the translated  BASIC 
  3339.         program.  The  internal names for ARRAY variables are  the  names 
  3340.         without the subscripts,  labels are denoted as !,  and PROCEDUREs 
  3341.         are  shown  as numbers,  which is the exact number found for  the 
  3342.         PROCEDURE in the translated BASIC program.  The filename for  the 
  3343.         optional symbol table file is <dev>:<filename>.SYM . The optional 
  3344.         source  listing  when  directed  to a disk file is  in  the  file 
  3345.         <dev>:<filename>.LST.  In  the  source  listing,  the  Structured 
  3346.         Programming Language source code line number and the  approximate 
  3347.         translated   BASIC   program  line  number  appear  before   each 
  3348.         statement.  This is supplied for debugging purposes.
  3349.  
  3350.         LABEL FILE
  3351.  
  3352.              A  label file with the name <filename>.LBL is always created 
  3353.         and is used by the processor for creating a label dictionary.  It 
  3354.         is  retained so you can use it for debugging purposes.  Since  it 
  3355.         takes  up disk space,  you should consider that in operations  of 
  3356.         the translator so as not to overflow disk space.
  3357.  
  3358.  
  3359.  
  3360.  
  3361.                                        51
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.         TRANSLATOR ERROR MESSAGES
  3371.  
  3372.              Error  messages generated are described in plain english and 
  3373.         go to the desired listing device.  If no listing is desired  then 
  3374.         the error messages go to the screen. A beep is sounded. The error 
  3375.         messages  tell the user what line of the original source file the 
  3376.         error occurred,  and the offending word is mentioned in the error 
  3377.         message.  You  will also find the footing *** ERROR IN  LINE  xxx  
  3378.         ***  below  the  description.  Since error  messages  are  always 
  3379.         generated,  and  the line number is mentioned,  it is a  definite 
  3380.         speed advantage not to have a source listing generated. With many 
  3381.         editors you can call up a line by giving its line number and then 
  3382.         change it, so a source listing is not always needed.
  3383.  
  3384.                             Error  Messages  produced
  3385.                by the Structured  Programming  Language Processor
  3386.              ------------------------------------------------------
  3387.  
  3388.  
  3389.              Section 1   Fatal Internal Errors. 
  3390.  
  3391.  
  3392.         I1.  IMPLEMENTATION RESTRICTION,INTERNAL NAME OVERFLOW
  3393.              TRANSLATION TERMINATED
  3394.  
  3395.         I2.  INTERNAL STACK OVERFLOW,IMPLEMENTATION RESTRICTION: OOO 
  3396.              TRANSLATION TERMINATED.
  3397.  
  3398.         I3.  ERROR # XXX IN LINE NO. XXX    {Contact author.}
  3399.                                             {Line is in processor.}
  3400.  
  3401.  
  3402.              Section 2   Auxilliary Error Messages.
  3403.  
  3404.  
  3405.         M1.  ***  ERROR IN LINE XXX  ***
  3406.  
  3407.         M2.  ERROR: WWW
  3408.  
  3409.  
  3410.  
  3411.              Section 3   Main Error Messages.
  3412.  
  3413.  
  3414.         1.   MISSING OPERAND: WWW
  3415.  
  3416.         2.   UNBALANCED PARENTHESES
  3417.  
  3418.         3.   MISSING :=   : WWW
  3419.  
  3420.         4.   VARIABLE NOT DECLARED: WWW
  3421.  
  3422.         5.   VARIABLE IS NOT INTEGER,REAL,OR STRING: WWW
  3423.  
  3424.         6.   DECLARED VARIABLE PPP IS SCALAR,SUBSCRIPTED REFERENCE IS ILLEGAL
  3425.  
  3426.  
  3427.                                        52
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.         7.   DECLARED VARIABLE PPP
  3437.              IS AN ARRAY, MISSING LEFT PARENTHESIS,COMMA,OR SEMICOLON
  3438.  
  3439.         8.   MISSING  OPERATOR OR PUNCTUATION FOLLOWING AN IDENTIFIER OR
  3440.               CONSTANT : PPP
  3441.  
  3442.         9.   MISSING BEGIN STATEMENT: WWW
  3443.              FATAL ERROR,TRANSLATION STOPPED
  3444.  
  3445.         10.  ILLEGAL VARIABLE NAME: WWW
  3446.  
  3447.         11.  ILLEGAL PROCEDURE NAME: WWW
  3448.  
  3449.         12.  MISSING (
  3450.  
  3451.         13.  MISSING DIMENSION: WWW
  3452.  
  3453.         14.  MISSING ) OR , : WWW
  3454.  
  3455.         15.  MISSING , OR ; : WWW
  3456.  
  3457.         16.  ILLEGAL OR MISSING PARAMETER: WWW
  3458.  
  3459.         17.  MISSING ; : WWW
  3460.  
  3461.         18.  ILLEGAL PROCEDURE: WWW
  3462.  
  3463.         19.  MISSING ( : WWW
  3464.  
  3465.         20.  INVALID INPUT LIST: WWW
  3466.  
  3467.         21.  MISSING ) : WWW
  3468.  
  3469.         22.  INVALID OUTPUT LIST: WWW
  3470.  
  3471.         23.  ILLEGAL LOOP VARIABLE: WWW
  3472.  
  3473.         24.  ILLEGAL EXPRESSION: WWW
  3474.  
  3475.         25.  DUPLICATE LABEL: WWW
  3476.  
  3477.         26.  ILLEGAL STATEMENT TYPE: WWW
  3478.  
  3479.         27.  UNDECLARED VARIABLE NAME, OR MISSING COLON : WWW
  3480.  
  3481.         28.  IN THIS INSTANCE WWW STATEMENT MUST BE ENCLOSED WITHIN 
  3482.              A BEGIN END BLOCK,ERROR
  3483.  
  3484.         29.  END STATEMENT IS NOT A LEGAL STATEMENT HERE
  3485.  
  3486.         30.  TOO MANY NESTED BEGIN BLOCKS
  3487.              TRANSLATION TERMINATED
  3488.  
  3489.         31.  DUPLICATE PROCEDURE NAME: WWW
  3490.  
  3491.  
  3492.  
  3493.                                        53
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.         32.  OVERFLOW OF SYMBOL TABLE: WWW
  3503.  
  3504.         33.  ATTEMPT TO NEST 11TH LEVEL TRANSLATION TERMINATED
  3505.  
  3506.         34.  DUPLICATE PARAMETER: WWW
  3507.  
  3508.         35.  LIMIT OF 10 PARAMETERS EXCEEDED: WWW
  3509.  
  3510.         36.  DUPLICATE VARIABLE: WWW
  3511.  
  3512.         37.  DUPLICATE ARRAY NAME: WWW
  3513.  
  3514.         38.  SYMBOL TABLE OVERFLOW,TOO MANY VARIABLES: WWW
  3515.  
  3516.         39.  ILLEGAL LABEL: WWW
  3517.  
  3518.         40.  MISSING ; OR ( : WWW
  3519.  
  3520.         41.  ILLEGAL ARGUMENT: WWW
  3521.  
  3522.         42.  MISSING , OR ) : WWW
  3523.  
  3524.         43.  MISSING WORD,STEP : WWW
  3525.  
  3526.         44.  MISSING WORD,UNTIL: WWW
  3527.  
  3528.         45.  MISSING WORD,DO: WWW
  3529.  
  3530.         46.  MISSING WORD,THEN: WWW
  3531.  
  3532.         47.  ERROR,LAST WORD NOT END OR EOT : WWW
  3533.  
  3534.         48.  ERROR,UNTIL WITHOUT REPEAT CLAUSE 
  3535.  
  3536.         49.  ILLEGAL USE OF RESERVED WORD
  3537.               AS STATEMENT,VARIABLE,OR LABEL: WWW
  3538.  
  3539.         50.  ELSE CLAUSE NOT EXPECTED,ERROR
  3540.  
  3541.         51.  ILLEGAL PLACEMENT OF A DECLARATION STATEMENT: WWW
  3542.  
  3543.         52.  MISSING WORD,CALL: WWW
  3544.  
  3545.         53.  WORD IS NOT KEY OR COM: WWW
  3546.  
  3547.         54.  DOUBLE QUOTE ILLEGAL,REPLACED WITH SPACE,USE CHR$(34)
  3548.               ***  ERROR IN LINE XXX  ***
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.                                        54
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.              Legend:   XXX       Line number.
  3569.  
  3570.                        WWW       Offending word in source program.
  3571.  
  3572.                        PPP       Word previous to one that caused error.
  3573.  
  3574.                        OOO       Line that overflowed internal stack.
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.                                        55
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.              INDEX of Statements for the Structured Programming Language.
  3635.  
  3636.              The numbers refer to pages in this manual except in the case 
  3637.         where a Z or an I preceeds it.
  3638.  
  3639.  
  3640.           ;                         39
  3641.           Arithmetic assignment     44
  3642.           BEEP                *Z 10.5             *I 4-28
  3643.           BEGIN                     14
  3644.           BLOAD               **Z 10.6-10.7       **I 4-29
  3645.           BSAVE               **Z 10.8-10.9       **I 4-32
  3646.           CALL                      33
  3647.           CALL [EXTERNAL]     *Z 10.10-10.11      *I 4-34
  3648.           CHAIN               **Z 10.13-10.14     **I 4-36
  3649.           CIRCLE              *Z 10.17            *I 4-41
  3650.           CLEAR               *Z 10.18            *I 4-44
  3651.           CLOSE               **Z 10.19           **I 4-46
  3652.           COLOR               *Z 10.21-10.22      *I 4-49,4-54
  3653.           COM(N)              *Z F.8-F.10         *I 4-56
  3654.           COMMENT                   25
  3655.           DATE$               *Z 10.32            *I 4-66
  3656.           DEFSEG                    42
  3657.           DOS                       40
  3658.           DRAW                *Z 10.40-10.41      *I 4-79
  3659.           END                       36
  3660.           EOT                       43
  3661.           ERROR               *Z 10.47-10.48      *I 4-91
  3662.           FIELD               *Z 10.50            *I 4-94
  3663.           FILES               **Z 10.51           **I 4-97
  3664.           FOR                       34
  3665.           GET [GRAPHICS]      *Z 10.59-10.61      *I 4-108
  3666.           GET [I/O]                 31
  3667.           GO                        26
  3668.           GO TO                     26
  3669.           GOTO                      26
  3670.           HOME                      41
  3671.           IF                        35
  3672.           INPUT                     29
  3673.           INTEGER                   18
  3674.           INTEGER ARRAY             21
  3675.           KEY                 *Z 10.81-10.83      *I 4-131
  3676.           KEY(N)              *Z F.8-F.10         *I 4-134
  3677.           KILL                **Z 10.84           **I 4-136
  3678.           Labeled statement         46
  3679.           LINE                *Z 10.88-10.89      *I 4-141
  3680.           LINEIN                    30
  3681.           LOCATE              *Z 10.97-10.98      *I 4-155
  3682.           LSET                *Z 10.103           *I 4-163
  3683.           MID$                *Z 10.106           *I 4-167
  3684.           NAME                **Z 10.108          **I 4-173
  3685.           NULL                *Z 10.110
  3686.           ON COM(N)           *Z F.8-F.10         *I 4-176
  3687.           ON KEY(N)           *Z F.8-F.10         *I 4-182
  3688.           ONERRGOTO                 27
  3689.  
  3690.  
  3691.                                        56
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.           OPEN                **Z 10.115-10.121   **I 4-189,4-194
  3701.           OUT                 **Z 10.123          **I 4-201
  3702.           OUTPUT                    32
  3703.           PAINT               *Z 10.124           *I 4-203
  3704.           POKE                *Z 10.127           *I 4-214
  3705.           PRESET              *Z 10.129           *I 4-228
  3706.           PROCEDURE                 23
  3707.           PSET                *Z 10.138-10.139    *I 4-228
  3708.           PUT [GRAPHICS]      *Z 10.59-10.61      *I 4-232
  3709.           PUT [I/O]                 31
  3710.           RANDOMIZE           *Z 10.141           *I 4-236
  3711.           REAL                      16
  3712.           REAL ARRAY                20
  3713.           REPEAT                    38
  3714.           RESET               *Z 10.146           *I 4-243
  3715.           RESUME              *Z 10.148           *I 4-245
  3716.           RETURN                    28
  3717.           RSET                *Z 10.103           *I 4-163
  3718.           RUN                 **Z 10.152          **I 4-251
  3719.           SCREEN              *Z 10.155           *I 4-257
  3720.           STOP                *Z 10.161           *I 4-270
  3721.           STRING                    19
  3722.           STRING ARRAY              22
  3723.           String assignment         45
  3724.           SWAP                *Z 10.164           *I 4-277
  3725.           TIME$               *Z 10.168-10.169    *I 4-281
  3726.           WAIT                *Z 10.176           *I 4-290
  3727.           WHILE                     37
  3728.           WIDTH               *Z 10.178           *I 4-294
  3729.           WRITE               *Z 10.179-10.180    *I 4-298 4-299
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.                                        57
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.