home *** CD-ROM | disk | FTP | other *** search
- <<* REPUTIL.INC *>>
- <<#
-
- procedure GenReportFile
- string lastals
- integer lastrow,lastcol
-
-
- procedure GenReportFld
- integer row,col
- string picstrg,thename
- begin
- if fldhor
- row := (fldpag - 1) * 20 + fldrow
- else
- row := (fldpag - 1) * 20 + fldrow + 1
- endif
- col := fldcol
- if fldhor
- col := col + len( fldlab )
- endif
- lastcol := col <<*Determines last printed col*>>
- gen( '@ ',str( row,2 ),',',str( col,2 ),' SAY ' )
-
- if fldals = 'M'
- thename := fldnam
- else
- thename := fldals + '->' + fldnam
- endif
- if fldtyp = 'C'
- gen( 'TRIM(',thename,')' )
- else
- gen( thename )
- endif
-
- if fldpic
- gen( ' PICTURE "',fldpic,'"' )
- elsif (fldpic = '') and (fldtyp = 'N')
- picstrg := replicate( '9',fldwid )
- if (flddec <> 0)
- picstrg[ fldwid-flddec ] := '.'
- endif
- gen( ' PICTURE "',picstrg,'"' )
- endif
- genln <<*Send CR/LF*>>
- end <<*GenReportFld*>>
-
-
- function ScanBuf( startrow,stopcol : integer ) : string
- integer len1,len2
- string strg
- begin
- strg := substr( textline( startrow ),lastcol+1,stopcol - lastcol )
- strg := rtrim( strg ) <<*if all blanks*>>
- if strg
- len1 := len( strg )
- strg := ltrim( strg ) <<*remove leading blanks*>>
- len2 := len( strg )
- lastcol := lastcol + (len1 - len2)
- endif
- RETURN strg
- end <<*ScanBuf*>>
-
-
- procedure genTEXT( frow,fcol,fpag : integer )
- integer row,offset
- string strg
- begin
- OFFSET := 20 <<*Offset value to increment 'ROW()' on subsequent pages*>>
- if lastrow < frow <<*Print text beforehand*>>
- for row := lastrow to (frow - 1)
- strg := ScanBuf( row,80 ) <<*Scan entire line*>>
- if strg
- GenSay( (fpag-1) * OFFSET + row,lastcol,strg )
- endif
- lastcol := 0
- endfor
- endif
- strg := ScanBuf( frow,fcol )
- if strg
- GenSay( (fpag-1) * OFFSET + frow,lastcol,strg )
- endif
- lastrow := frow
- end <<*genTEXT*>>
-
-
- begin <<*GenReportFile*>>
- lastals := 'A'
- select all
- forall pages
- lastrow := 0
- lastcol := 0
- inittext
- forall (fldtyp $ 'CDLNM') and (fldsay or fldget) <<*Now, gen @/SAYs*>>
- if fldhor
- genTEXT( fldrow,fldcol + len( fldlab ),fldpag )
- else
- genTEXT( fldrow+1,fldcol,fldpag )
- endif
- GenReportFld
- endfor
- genTEXT( 25,80,pagcount ) <<*Flush the screen buffer*>>
- endfor
- end <<*GenReportFile*>>
-
- <<* EOF: REPUTIL.INC *>>
- #>>