[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[sqr-users] Read and Select variable data
I would like to open and read a txt file and select data from the open
file using defined prompts. The program below opens and prints all of
the data in the text file and works fine, but contains no prompts.
The example below is a fax log that opens a text file that has the fax
history. I would like to be able to use a prompt to select data where it
equals
a variable $po-num and other variables that would be a selection of data
from the file.
Any ideas would be appreciated.
!***********************************************************************
************************
Begin-Program
Do Main
Print 'Total PO FAXES Contained in Activity Report:' (+1,30, ) Bold
Print #rcds (,60,5)edit 999
End-program
!********************************** Main
************************************************************
Begin-Procedure Main
Let #rcds = 0
DO READINTOARRAY
End-procedure Main
!*******************************READS HISTORY TEXT FILE
**************************
BEGIN-PROCEDURE READINTOARRAY
LET $FILE = 'C:\SPL\POFAXHIST' ||'.TXT'
OPEN $FILE AS 1 FOR-READING record=10000:VARY
Let #rowcount = 0
Let #rcds = 0
While Not #end-file
READ 1 INTO $HISTROWREAD:10000
IF #END-FILE =1
BREAK
Else
Do printdata
Add 1 to #rcds
END-IF
END-WHILE
CLOSE 1
END-PROCEDURE
!******************************* Print Data
**************************************
Begin-procedure Printdata
ADD 1 TO #rowcount
UNSTRING $HISTROWREAD BY ';' INTO $DATE $po-num $vendor $vendname
$vendfaxnum $purchaseagent $podesc
LET $DATE1 = edit($DATE,'Mon DD YYYY HH:MI')
ALTER-PRINTER font = 4 point-size = 8
Print #rowcount (,2,4)
PRINT $date1 (,6,)
PRINT $po-num (,20,10) BOLD UNDERLINE
Print $vendor (,30,12)
PRINT $vendname (,40,40)
Print $vendfaxnum (,67,13)
Print $podesc (+1,30,)
Print $purchaseagent (, 67,5)
ALTER-PRINTER font = 4 point-size = 10
GRAPHIC (,1,76) HORZ-LINE
next-listing skiplines =0 need = 2
end-procedure
TIA
Regards,
John F. Connell Jr.
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users