home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR4
/
THEOS215.ZIP
/
TOTAL.THE
< prev
next >
Wrap
Text File
|
1993-09-19
|
1KB
|
38 lines
/*
$Header: C:\THE\RCS\total.the 1.4 1993/09/01 16:27:20 MH Interim MH $
*/
/***********************************************************************/
/* Description: REXX macro to sum numbers in a marked block. */
/* Syntax: total */
/* Notes: This macro will sum the numbers in the marked block */
/* and insert a new line with the total at the end of the */
/* block. */
/***********************************************************************/
Trace o
'EXTRACT /BLOCK/FNAME/FPATH/'
If block.0 = 1 Then Do
'EMSG No Marked block'
Return
End
If block.1 \= 'BOX' Then Do
'EMSG No Marked BOX block'
Return
End
current_file = fpath.1||fname.1
If current_file \= block.6 Then Do
'EMSG Marked block not in current file'
Return
End
':'||block.2
tot = 0
Do i = block.2 To block.4
'EXTRACT /CURLINE/'
num = Substr(curline.3,block.3,block.5-block.3+1)
If Datatype(num,'NUM') Then tot = tot + num
'N'
End
'U'
'i' Copies(' ',block.3-1)||tot
'N'
Return