home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
xactus.zip
/
macros
/
readsp.xc$
/
xsmp32
/
os2
/
uk
/
readsp.xcd
Wrap
Text File
|
1994-09-29
|
2KB
|
61 lines
/*************************************************************************
* Xact macro
*
*************************************************************************/
Parse Arg handle
Say "This macro opens an existing table and copies any lines that "||,
"meet certain criteria into a new table."
tHandle1 = XR_OpenTab("TABLES\STATES.XTF") /* Open a table */
tHandle2 = XR_OpenTab() /* Create a new table */
totalCols = XR_NumOfColumns(tHandle1) /* Number of columns */
totalLines = XR_NumOfLines(tHandle1) /* Number of lines */
Call getRowValues tHandle1, 0, totalCols /* read line 0 */
Call setRowValues tHandle2, 0, totalCols /* write line 0 */
wi = 1 /* counter for written lines */
Do ri = 1 To totalLines
If XR_ReadCell(tHandle1, ri, 3) = 'w' Then Do /* check cell */
Call getRowValues tHandle1, ri, totalCols /* read the line */
Call setRowValues tHandle2, wi, totalCols /* write the line */
wi = wi + 1
End
End
Return
/*************************************************************************
* getRowValues
*
* Read all cells of line 'rowNo' from the window 'handle'
*************************************************************************/
getRowValues: procedure expose row.
Parse Arg handle, rowNo, total
Do i = 0 To total
row.i = XR_ReadCell(handle, rowNo, i)
end
Return
/*************************************************************************
* setRowValues
*
* Write all cells of line 'rowNo' to the window 'handle'
*************************************************************************/
setRowValues: procedure expose row.
Parse Arg window, rowNo, total
Do i = 0 To total
Call XR_WriteCell window, rowNo, i, row.i
end
Return