arrays or subscripts
Posted in 1994
I hope someone here can help me. I am using Informix-SQL Version 4.10.UE2
I am trying to use some form (any form) of an array to print table data.
Currently the printed ascii text data appears as;
S000001|060194|12|Apple|J|Davis|1 Main|Norfolk|Va|32211|2121111234|xx1|
S000001|060194|12|Apple|J|Davis|1 Main|Norfolk|Va|32211|2121111234|xx2|
S000001|060194|12|Apple|J|Davis|1 Main|Norfolk|Va|32211|2121111234|xx3|
As
you can see the only diff. is xx1 xx2 and xx3 What I want to do is to use
the arry to print only one line; Such as;
S000001|060194|12|Apple|J|Davis|1 Main|Norfolk|Va|32211|2121111234|xx1|xx2|xx3| Also if there are only two
xx?, then print only two. If there are 7 xx?, then print 7 ie;
xx1|xx2|xx3|xx4|xx5|... so please if someone can help me with this
challenge, it will be greatly appreciated. Thanks. See code below.
database
pro end define
variable nlines integer
variable dtl_total decimal(7,2)
variable v_custno char(10)
variable v_compname char(16) :q! lowryj:/users/lowryj/Test>vi net.sql
"net.sql" 126 lines, 3028 characters I hope someone here can help me. I
am using Informix-SQL Version 4.10.UE2 I am trying to use some form (any
form) of an array to print table data. Currently the printed ascii text
data appears as; S000001|060194|12|Apple|J|Davis|1
Main|Norfolk|Va|32211|2121111234|xx1| S000001|060194|12|Apple|J|Davis|1
Main|Norfolk|Va|32211|2121111234|xx2| S000001|060194|12|Apple|J|Davis|1
Main|Norfolk|Va|32211|2121111234|xx3| As you can see the only diff. is xx1
xx2 and xx3 What I want to do is to use the arry to print only one line;
Such as; S000001|060194|12|Apple|J|Davis|1
Main|Norfolk|Va|32211|2121111234|xx1|xx2|xx3| Also if there are only two
xx?, then print only two. If there are 7 xx?, then print 7 ie;
xx1|xx2|xx3|xx4|xx5|... so please if someone can help me with this
challenge, it will be greatly appreciated. Thanks. See code below.
database
pro
end
define
variable nlines integer
variable dtl_total decimal(7,2)
variable v_custno char(10)
variable v_compname char(16)
variable v_addr1 char(40)
variable v_addr2 char(40)
variable v_city char(30)
variable v_state char(2)
variable v_zip char(10)
variable v_dayphone char(18)
variable v_firstname char(16)
variable v_lastname char(16)
variable v_type char(4)
variable v_item char(4)
variable i smallint
end
output
report to "test.txt"
top margin 1
bottom margin 0
left margin 0
end
select *, dtl_fname1[1,1] dtl_init from data1,
outer data2
where campaign = "test"
and orddate = "05/31/94"
and dtl_itemno = "CAT"
and order_id = detail_id
and rec = dtl_rec
and addr = dtl_addr
and rec = 4
order by order_id, rec, addr, dtl_seq
endformat
on every row
if rec = 4 then
begin
let v_custno = custno
let v_compname = compname
let v_addr1 = addr1
let v_addr2 = addr2
let v_city = city
let v_state = state
let v_zip = zip
let v_dayphone = dayphone
let v_firstname = firstname
let v_lastname = lastname
for i = 1 to 10
do
begin
if (v_type = " ") then
begin
let i = i
end
else
let i = i + 1
end
end
if (rec = 4) then
begin
print
"S",order_id using "#####&","|",
orddate,"|",
v_custno,"|",
v_compname,"|",
v_firstname clipped,"|",
v_lastname,"|",
v_addr1,"|",
v_addr2,"|",
v_city clipped,"|",
v_state,"|",
v_zip,"|",
v_dayphone,"|";
for i = 1 to 10
do
begin
if (v_type = " ") then
begin
let i = 1
end
else
let i = i + 1
end
print v_type(i),"|"
end
after group of order_id
print
end
_______________________________________________________________________
_______________________________________________________________________
1G