SandraDiehl
6th February 2012, 22:00
NOTE: our environment is windows not UNIX and this company having issues uses notepad rather than the baan text editor.
I have this custom program that reads input from a file, and is suppose to read the routing table based on the routing item and operation then update the routing text or create a routing text adding the last value from the input file.
I have performed this in both companies where one uses the BaaN text editor and the one that uses notepad. The company that uses BaaN text editor seems to be fine, the company that uses notepad I have ran into some quirky stuff
This company has two text groups that is being used:
small (2, 3, 31 x 23)
standard (2, 3, 80 x 23)
Observation of issue:
I have starting text that will be two lines, after I run my update that is adding a single line such "Required Tooling: JFF1234" and I will end up with a text file that has more than 3 lines, some I find has more than 1600 lines with them all being blank.
I need to see if there is something wrong with my code that I am not seeing, or is this an issue within BaaN using windows/notepad? Any suggestion would be helpful.
Source code:
function process.notes()
{
domain tcmcs.str6 buf.cprj
domain tcitem temp.item
repeat
ret = seq.gets(buf, 200, in.fp)
ret = string.scan(buf, "%s|%d|%s|%s", buf.mitm, buf.opno, buf.sitm, buf.cust)
ret = tt.align.according.domain(buf.sitm, align.sitm, "tcitem")
if buf.cust = "Y" then
buf.cprj = buf.mitm(1;6)
temp.item = buf.mitm(8;16)
ret = tt.align.according.domain(temp.item, align.mitm, "tcitem")
ret = tt.align.according.domain(buf.cprj, align.cprj, "tccprj")
update.cus.routing.notes()
else
ret = tt.align.according.domain(buf.mitm, align.mitm, "tcitem")
update.std.routing.notes()
endif
until seq.eof(in.fp)
}
function update.std.routing.notes()
{
string text.buffer(60, 900)
string temp.file.name(100)
string temp.text.line(4096)
string tgroup(8)
string edit_opt(15)
long temp.file.numb
long text.buffer.lines
long curr.line
db.retry.point()
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:align.mitm}
and tirou102.opno = :buf.opno
selectdo
ret = text.to.buf("tirou102.txta", "2", 900, text.buffer)
text.buffer.lines = ret
if ret <> 0 then
ret = text.defaults("tirou102.txta", tgroup, edit_opt)
endif
temp.file.name = creat.tmp.file$(bse.tmp.dir$())
temp.file.name = strip$(temp.file.name)
temp.file.numb = seq.open(temp.file.name, "w+")
if text.buffer.lines > 0 then
for curr.line = 1 to text.buffer.lines
temp.text.line(1;60) = text.buffer(1, curr.line)
ret = seq.puts(temp.text.line, temp.file.numb)
endfor
endif
temp.text.line = "Tooling Required: " & align.sitm
ret = seq.puts(temp.text.line, temp.file.numb)
ret = seq.close(temp.file.numb)
if ret = 0 then
if tirou102.txta = 0 then
ret = text.write("tirou102.txta", "2", "Operation Text", align.mitm, "Operation" & str$(tirou102.opno),
"", "standard", "standard", temp.file.name)
else
ret = text.rewrite("tirou102.txta", "2", "Operation Text", align.mitm, "Operation" & str$(tirou102.opno),
"", tgroup, tgroup, temp.file.name)
endif
endif
db.update(ttirou102, db.retry)
endselect
commit.transaction()
}
I have this custom program that reads input from a file, and is suppose to read the routing table based on the routing item and operation then update the routing text or create a routing text adding the last value from the input file.
I have performed this in both companies where one uses the BaaN text editor and the one that uses notepad. The company that uses BaaN text editor seems to be fine, the company that uses notepad I have ran into some quirky stuff
This company has two text groups that is being used:
small (2, 3, 31 x 23)
standard (2, 3, 80 x 23)
Observation of issue:
I have starting text that will be two lines, after I run my update that is adding a single line such "Required Tooling: JFF1234" and I will end up with a text file that has more than 3 lines, some I find has more than 1600 lines with them all being blank.
I need to see if there is something wrong with my code that I am not seeing, or is this an issue within BaaN using windows/notepad? Any suggestion would be helpful.
Source code:
function process.notes()
{
domain tcmcs.str6 buf.cprj
domain tcitem temp.item
repeat
ret = seq.gets(buf, 200, in.fp)
ret = string.scan(buf, "%s|%d|%s|%s", buf.mitm, buf.opno, buf.sitm, buf.cust)
ret = tt.align.according.domain(buf.sitm, align.sitm, "tcitem")
if buf.cust = "Y" then
buf.cprj = buf.mitm(1;6)
temp.item = buf.mitm(8;16)
ret = tt.align.according.domain(temp.item, align.mitm, "tcitem")
ret = tt.align.according.domain(buf.cprj, align.cprj, "tccprj")
update.cus.routing.notes()
else
ret = tt.align.according.domain(buf.mitm, align.mitm, "tcitem")
update.std.routing.notes()
endif
until seq.eof(in.fp)
}
function update.std.routing.notes()
{
string text.buffer(60, 900)
string temp.file.name(100)
string temp.text.line(4096)
string tgroup(8)
string edit_opt(15)
long temp.file.numb
long text.buffer.lines
long curr.line
db.retry.point()
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:align.mitm}
and tirou102.opno = :buf.opno
selectdo
ret = text.to.buf("tirou102.txta", "2", 900, text.buffer)
text.buffer.lines = ret
if ret <> 0 then
ret = text.defaults("tirou102.txta", tgroup, edit_opt)
endif
temp.file.name = creat.tmp.file$(bse.tmp.dir$())
temp.file.name = strip$(temp.file.name)
temp.file.numb = seq.open(temp.file.name, "w+")
if text.buffer.lines > 0 then
for curr.line = 1 to text.buffer.lines
temp.text.line(1;60) = text.buffer(1, curr.line)
ret = seq.puts(temp.text.line, temp.file.numb)
endfor
endif
temp.text.line = "Tooling Required: " & align.sitm
ret = seq.puts(temp.text.line, temp.file.numb)
ret = seq.close(temp.file.numb)
if ret = 0 then
if tirou102.txta = 0 then
ret = text.write("tirou102.txta", "2", "Operation Text", align.mitm, "Operation" & str$(tirou102.opno),
"", "standard", "standard", temp.file.name)
else
ret = text.rewrite("tirou102.txta", "2", "Operation Text", align.mitm, "Operation" & str$(tirou102.opno),
"", tgroup, tgroup, temp.file.name)
endif
endif
db.update(ttirou102, db.retry)
endselect
commit.transaction()
}