Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I want to write a report ? how to do it?

Status
Not open for further replies.

CALYAN

Programmer
Apr 23, 2001
39
0
0
US
AAO|VE|LA|21|
ABE|US|US|110|
ABJ|CI|AF|289|
ABQ|US|US|62|
ABT|SA|ME|174|
ABZ|GB|UK|437|
ACA|MX|MX|91|
ACC|GH|AF|334|
ADA|TR|EU|112|
ADD|ET|AF|162|
ADL|AU|OC|374|
ADQ|US|US|1|
AGU|MX|MX|65|
AGX|US|US|16|
AHB|SA|ME|20|
AJF|SA|ME|60|
AKL|NZ|OC|1785|
ALA|KZ|EU|182|
ALB|US|US|114|

Hi i have got the output like this , i want to write a
report for this how to do with informix 4gl reports
 
Hi,

This query belongs to Informix-4GL forum.

Here is an outline for the report driver and the report function for your requirement.

Regards,
Shriyan

database testdb
main
define d_f1 char(3), d_f2, d_f3 char(2), d_f4 smallint

set isolation to dirty read

create temp table tabx (f1 char(3), f2 char(2), f3 char(2), f4 smallint) with no log
load from 'yourdatafile' insert into tabx

declare cur1 cursor for
select f1, f2, f3, f4 from tabx

start report test_report to "out.txt"
open cur1
while (1)
fetch cur1 into d_f1, d_f2, d_f3, d_f4
if status=notfound then
exit while
end if
output to report test_report(d_f1,d_f2,d_f3,d_f4)
end while
finish report test_report

end main

report test_report(r_f1,r_f2,r_f3,r_f4)
define r_f1 char(3), r_f2, r_f3 char(2), r_f4 smallint

output
top margin 0
left margin 0
top of page "^L"
page length 68

format
page header
print column 01, " Listing of ...................";
print 4 spaces, "Pg: ", pageno using "##"
print column 01, "================================================"
print column 01, "Field1 Field2 Field3 Field4"
print column 01, "====== ================= ========== ========="

on every row
print column 01,r_f1,
column 10,r_f2,
column 20,r_f3,
column 31,r_f4
end report
 
Hey Dinakar!! As Mr.Shriyan mentioned, just load the flat file into a temp table,declare a cursor and create a report using foreach. It will work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top