Capítulo II: Modelación Teórica Práctica de la Propuesta
2.2 Fundamentación teórica de la propuesta
2.2.1 Consideraciones acerca de la alternativa como resultado científico
Array subscripts begin with 1. Array variables can be dimensioned only once
in a program. Example:
10 DIM SALES(10,1O),SAf.EM$(10)*30,TEMP$*lO
When executed, the following allocations are made:
SALES : two-dimensional numeric array of size 10 by 10
SALEM$: one-dimensional character
array of size 10 by
I;
each character element with length 30 TE!'ÍP$ : single character variable with length 10
END
The END
statement
is
used to terminate a DeltaBASIC program.It
closesall
files
and returns DeltaBASIC to the command/programedit
rnode. Programexit
should be through the ENDstatement
if
you want to remainin
DeltaBASIC command/program edit mode afterwards. Terminating a program withEND (or OFF)
is
especially important to ensure thatfiles
otherwiseleft
openare properly closed.
Example: 9999 END
When program termination
is
required, statement 9999is
executed.All
openfiles
are closed and DeltaBASIC enters the command/programedit
mode.EXIT {IOERR line-mm} {,IOERR line—mm)
(9···)
{DUPKEY line-num) {,DUPKEY line-num}{NOKEY line-mm) {,NOKEY line-mm)
{EOF line-mm) {,E0F line-num)
The EXIT statement can be used with OPEN, READ, WRITE, REWRITE, and CLOSE
statements to provide branching when the specified errors occur. (See the appropriate statements for more information concerning these
errors.)
The EXIT statement can be accessed only by way of one of these I/O statements; when otherwise encountered during execution, EXITis
ignored much as a REMstatement would be.
EXIT
is
especially useful when a number of I/O operations have the saíne errorprocessing
lines.
Each I/O statement would contain an EXITline
numberreferring
to the EXIT statement, which would in turn contain theline
numbersfor the various error traps.
Examples:
10 READ #1,USING
II:
A,B EOF 100 IOERR 130II
FORM...
0 0 0
lOó REM END-OF-FILE ERROR PROCESSING
105
...
0 0 O
130 REM I/O ERROR PROCESSING
135
...
EXIT
is
not used inthis
program segment.If
anend-of-file
error occurswhile
file
#1is
being read, the program branches toline
100for
recoveryprocessing.
If
an I/O error occurs, the program branches toline
130. Yow consider an equivalent method using the EXIT statement.10 READ #I,USING
II:
A,B EXIT 2011 FORM
...
20 EXIT EOF 1OO,IOERR 130
0 9 0
lOó REM END-OF-FILE ERROR PROCESSING
105
...
0 0 0
130 REM l/O ERROR PROCESSING
135
...
An error in the READ
statement of
line
10 causes execution todivert
to theEXIT statement of
line
20. Here the various error conditions are handled.Besides making the READ
statement simpler, the EXIT statement can be used by
other I/O statements for error branching to
line
20.FUR var=num-expr I TO nuin-expr 2 {STEP num-expr 3}
0 e D
included DeltaBASIC staternents
e e *
NEXT var
The FOR/NEXT statements set up a loop that performs the included DeltaBASIC
statements one or more times, depending on the beginning value of the index
variable (num-expr
I),
ending value (num-expr 2), and the step size (nurn-expr3).
If
not specified, the step sizeis
l.
The included DeltaBASIC statements
will
be executed at least one time beforetermination conditions are checked. The
"exit"
value of the index variablewill
be thefirst
value that meets or exceeds num-expr2.FOR/NEXT loops can be nested to a level of 8 deep.
Exiting a FOR/NEXT loop before normal termination
is
allowed but notrecommended. Repeated exits of
this
typewill
cause the maximum FOR/NEXTlevel to be exceeded. Examples: 10 FOR INDEX=1 to 20 STEP 2 20 PRINT INDEX 30 NEXT INDEX
These FOR/NEXT statements cause
line
20 to be executed 10 times,printing
thevalues from 1
to 19 in steps of 2. The
"exit"
value of INDEXis
21.FORM specification
list
The FORM
statement gives the format specification
for
PRINT, READ, WRITE, andREWRITE statements. The specification
list
can consist of any combination ofthe following specifications, separated by commas:
"char-cnst"
Character constant: the character
string
between the quotation marksis
output at the current position. Allowed in PRINT and WRITE only.
C w
Character
field:
the matching character valueis
treated as a characterstring that
is left-justified
in a blankfield
of width w. CUR(m,n)Cursor: the next value
will
be output atline
m and position n. Allowed inPRINT only.
N w{.d)
Numeric
field:
the matching numeric valueis
treated as a characterstring
ofwidth w, including d decimal positions. For output, the width must include
both a sign and decimal point position. For input, an
explicit
decimaloverrides the
implicit
decimal position d.PI) w.d
Packed decimal: the matching numeric value
is
given in packed decimal format.For output, the value
is
rounded to d decimal places, then packed two binarycoded decimal
digits
per position and writtenright-justified
into afield
ofwidth w. Only the low nibble of the leftmost position contains a
digit.
Thehigh nibble
is
0000 binaryfor
a positive value and 1000 binaryfor
anegative. As with zone decimal, no
explicit
decimalis written.
For input,the value
is
read from afield
w wide and then given d decimal positions.Packed decimal
is
not allowed in the PRINT statement.PIC(char-str)
Picture: the matching numeric value
is
written into afield
with width andcomposition given by the character
string.
Valid characters are describedbelow:
#
Number
digit:
always replaced by adigit.
ZLeading zero: any leading zero replaced by a blank.
$
Leading