f.martel
4th November 2015, 15:48
Iaorana !
I have a problem with brp.open.
When i try my session OK :)
When i try my session in job with ttaad5203m00 it doesnt work :confused:
My code :
db.retry.point()
select tcqms305.iorn, tcqms305.txta, tcqms305.quid
from tcqms305 for update
where tcqms305._index1 inrange {:iorn.f} and {:iorn.t}
and tcqms305.txta between :txta.f and :txta.t
and exists
(
select tcqms315.iorn
from tcqms315 qms
where tcqms315.iorn = tcqms305.iorn
and
(
( tcqms315.resl = tcqms.resl.bad and tcqms315.char <> "LOGISTIQ" )
or
( tcqms315.mopt = " N" and tcqms315.char = "LOGISTIQ")
)
)
selectdo
brp.id = brp.open( "rlrqms341511000", "EXT-FM-W", 0 )
select tcqms315.*, tcqms305.*, tcqms310.*, tcqms306.*,
tcqms001.*, tcqms014.*, tcqms007.*, tccom001.*, tcqms008.*,
tiitm001.dsca, tiitm001.cuni, tiitm001.buyr, tiitm001.suno
from tcqms315, tcqms305, tcqms310, tcqms306, tcqms001,
tcqms014, tcqms007, tccom001, tcqms008,
tiitm001
where tcqms315._index1 = {:tcqms305.iorn}
and tcqms315.iorn refers to tcqms305
and tcqms315.cmba refers to tcqms310
and tcqms315.cmbb refers to tcqms306
and tcqms315.char refers to tcqms001
and tcqms315.cmbc refers to tcqms014
and tcqms315.tare refers to tcqms007
and tcqms315.emno refers to tccom001
and tcqms315.inst refers to tcqms008
and tcqms305.item refers to tiitm001
order by tcqms315._index1
selectdo
tdpur045.dqua = 0
tdpur045.dino = ""
tccom001.nama = ""
tdpur040.suno = ""
tccom020.nama = ""
select tccom001.nama
from tccom001
where tccom001._index1 = {:tiitm001.buyr}
selectdo
endselect
if strip$(tcqms315.char) = "LOGISTIQ" then
tcqms315.resl = tcqms.resl.good
endif
if tcqms305.orgn = tcqms.orgn.purchase then
select tdpur045.dqua, tdpur045.dino, tdpur040.suno, tccom020.nama
from tdpur045, tdpur040, tccom020
where tdpur045._index1 = {:tcqms305.orno, :tcqms305.pono, :tcqms305.srnb}
and tdpur045.orno refers to tdpur040
and tdpur040.suno refers to tccom020
selectdo
tiitm001.suno = tdpur040.suno
tdpur045.dqua = tdpur045.dqua
endselect
else
select tccom020.nama
from tccom020
where tccom020._index1 = {:tiitm001.suno}
selectdo
endselect
endif
brp.ready(brp.id)
endselect
brp.close(brp.id)
tcqms305.txta = 1
db.update(ttcqms305,db.retry)
commit.transaction()
endselect
commit.transaction()
Device EXT-FM-W in attachement
With normal device (without ttstpconv) all it's OK
Have you idea's ?
Thanks
François
benito
4th November 2015, 16:48
can you try and change your Repertoire to NOT use variables? for example don't use TEMP. go to unix and copy exactly what you're getting from $BSE_TMP. the reason could be that your JOB USER invoking the session doesn't have the unix profile set, so it works for you but not your job user.
f.martel
4th November 2015, 17:00
Hi benito,
Thanks
I try to change ${TEMP} in /d5/tmp and it's the same result.
With my user (super user) and user specific for job.
benito
4th November 2015, 18:14
i just tried the code below with a device using ttstpconv and it worked. when i run the session manually it opens notepad. when i run it in a job, i need to search the file in my unix directory. my equivalent Repertoire is:
${BSE}/tmp/temp-notepad.txt
so i have to search the file temp-notepad.txt and sure enough it has the correct report in it.
function extern read.main.table()
{
long brp_id
extern string i_item(100)
extern string message1(200)
spool.report = "rxxbom021101000"
spool.device = "NOTEPAD"
brp_id = brp.open(spool.report,spool.device,0)
if brp_id > 0 then
select xxcom001.*
from xxcom001
order by xxcom001._index1
as set with 1 rows
selectdo
i_item = trim$(xxcom001.st11)
message1 = "Testing."
brp.ready(brp_id)
endselect
brp.close(brp_id)
endif
}
günther
5th November 2015, 08:35
Hi François.
First of all, what exactly do you mean by ".. it doesnt work"? No file created at all? File is empty? Error messages in job history?
Second, you should defintively change your program structure. Always: open report, db.retry.point, database operations, commit.transaction, close report.
Otherwise, you will open your report for a second time when a retry happens, and so your report will at least be truncated.
Regards
Günther
f.martel
5th November 2015, 08:50
Iorana benito,
Iorana günter,
In job, no file is created ... and no error message in job
For the program structure, i try to change today
Regards François
f.martel
5th November 2015, 09:31
I modified my program (open report, db.retry, commit, close report).
The problem is the same
bhushanchanda
5th November 2015, 10:45
Hi,
You might try writing a log file at each points in the program to make sure whether its executing those commands or not. Also, I see, you have brp.open() and brp.close() inside your selectdo?
Some changes to the script and the log writing you might try and check
e.g.
long fp
db.retry.point()
brp.id = brp.open( "rlrqms341511000", "EXT-FM-W", 0 )
fp = seq.open("log_file.txt","w+")
select tcqms305.iorn, tcqms305.txta, tcqms305.quid
from tcqms305 for update
where tcqms305._index1 inrange {:iorn.f} and {:iorn.t}
and tcqms305.txta between :txta.f and :txta.t
and exists
(
select tcqms315.iorn
from tcqms315 qms
where tcqms315.iorn = tcqms305.iorn
and
(
( tcqms315.resl = tcqms.resl.bad and tcqms315.char <> "LOGISTIQ" )
or
( tcqms315.mopt = " N" and tcqms315.char = "LOGISTIQ")
)
)
selectdo
select tcqms315.*, tcqms305.*, tcqms310.*, tcqms306.*,
tcqms001.*, tcqms014.*, tcqms007.*, tccom001.*, tcqms008.*,
tiitm001.dsca, tiitm001.cuni, tiitm001.buyr, tiitm001.suno
from tcqms315, tcqms305, tcqms310, tcqms306, tcqms001,
tcqms014, tcqms007, tccom001, tcqms008,
tiitm001
where tcqms315._index1 = {:tcqms305.iorn}
and tcqms315.iorn refers to tcqms305
and tcqms315.cmba refers to tcqms310
and tcqms315.cmbb refers to tcqms306
and tcqms315.char refers to tcqms001
and tcqms315.cmbc refers to tcqms014
and tcqms315.tare refers to tcqms007
and tcqms315.emno refers to tccom001
and tcqms315.inst refers to tcqms008
and tcqms305.item refers to tiitm001
order by tcqms315._index1
selectdo
tdpur045.dqua = 0
tdpur045.dino = ""
tccom001.nama = ""
tdpur040.suno = ""
tccom020.nama = ""
select tccom001.nama
from tccom001
where tccom001._index1 = {:tiitm001.buyr}
selectdo
endselect
if strip$(tcqms315.char) = "LOGISTIQ" then
tcqms315.resl = tcqms.resl.good
endif
if tcqms305.orgn = tcqms.orgn.purchase then
select tdpur045.dqua, tdpur045.dino, tdpur040.suno, tccom020.nama
from tdpur045, tdpur040, tccom020
where tdpur045._index1 = {:tcqms305.orno, :tcqms305.pono, :tcqms305.srnb}
and tdpur045.orno refers to tdpur040
and tdpur040.suno refers to tccom020
selectdo
tiitm001.suno = tdpur040.suno
tdpur045.dqua = tdpur045.dqua
endselect
else
select tccom020.nama
from tccom020
where tccom020._index1 = {:tiitm001.suno}
selectdo
endselect
endif
brp.ready(brp.id)
seq.puts("Record printed..",fp)
endselect
tcqms305.txta = 1
db.update(ttcqms305,db.retry)
commit.transaction()
seq.puts("Record Updated..",fp)
endselect
commit.transaction()
seq.puts("Final Commit.",fp)
brp.close(brp.id)
seq.puts("Report Closed.",fp)
seq.close(fp)
f.martel
5th November 2015, 11:34
Iorana Bhushan
Thanks,
For this session i need 1 report for each bad QMS order. That why i put brp.open/brp.close in selectdo.
Source code modified according to Günters answers
fp = seq.open("${TEMP}/lrqms3415.log","w+")
select tcqms305.iorn, tcqms305.txta, tcqms305.quid
| from tcqms305 for update|-> 2015-11-05
from tcqms305 |-> 2015-11-05
where tcqms305._index1 inrange {:iorn.f} and {:iorn.t}
and tcqms305.txta between :txta.f and :txta.t
and exists
(
select tcqms315.iorn
from tcqms315 qms
where tcqms315.iorn = tcqms305.iorn
and
(
( tcqms315.resl = tcqms.resl.bad and tcqms315.char <> "LOGISTIQ" )
or
( tcqms315.mopt = " N" and tcqms315.char = "LOGISTIQ")
)
)
selectdo
brp.id = brp.open( "rlrqms341511000", "EXT-FM-W", 0 )
|-> 2015-11-05 Memo édition
db.retry.point()
select tcqms305.iorn, tcqms305.txta
from tcqms305 for update
where tcqms305._index1 = {:tcqms305.iorn}
selectdo
tcqms305.txta = 1
db.update(ttcqms305,db.retry)
commit.transaction()
seq.puts("Record Updated..",fp)
endselect
commit.transaction()
seq.puts("Final Commit.",fp)
|-> 2015-11-05
select tcqms315.*, tcqms305.*, tcqms310.*, tcqms306.*,
tcqms001.*, tcqms014.*, tcqms007.*, tccom001.*, tcqms008.*,
tiitm001.dsca, tiitm001.cuni, tiitm001.buyr, tiitm001.suno
from tcqms315, tcqms305, tcqms310, tcqms306, tcqms001,
tcqms014, tcqms007, tccom001, tcqms008,
tiitm001
where tcqms315._index1 = {:tcqms305.iorn}
and tcqms315.iorn refers to tcqms305
and tcqms315.cmba refers to tcqms310
and tcqms315.cmbb refers to tcqms306
and tcqms315.char refers to tcqms001
and tcqms315.cmbc refers to tcqms014
and tcqms315.tare refers to tcqms007
and tcqms315.emno refers to tccom001
and tcqms315.inst refers to tcqms008
and tcqms305.item refers to tiitm001
order by tcqms315._index1
selectdo
tdpur045.dqua = 0
tdpur045.dino = ""
tccom001.nama = ""
tdpur040.suno = ""
tccom020.nama = ""
select tccom001.nama
from tccom001
where tccom001._index1 = {:tiitm001.buyr}
selectdo
endselect
if strip$(tcqms315.char) = "LOGISTIQ" then
tcqms315.resl = tcqms.resl.good
endif
if tcqms305.orgn = tcqms.orgn.purchase then
select tdpur045.dqua, tdpur045.dino, tdpur040.suno, tccom020.nama
from tdpur045, tdpur040, tccom020
where tdpur045._index1 = {:tcqms305.orno, :tcqms305.pono, :tcqms305.srnb}
and tdpur045.orno refers to tdpur040
and tdpur040.suno refers to tccom020
selectdo
tiitm001.suno = tdpur040.suno
tdpur045.dqua = tdpur045.dqua
endselect
else
select tccom020.nama
from tccom020
where tccom020._index1 = {:tiitm001.suno}
selectdo
endselect
endif
brp.ready(brp.id)
seq.puts("Record printed..",fp)
endselect
brp.close(brp.id)
seq.puts("Report Closed.",fp)
seq.close(fp)
endselect
Log file :
Record Updated..
Final Commit.
Record printed..
Record printed..
Record printed..
Record printed..
Report Closed.
The problem is the same ....
I've tried to disconnect the first select with tcqms305.iron variable static, the result is the same ...
For me, the problem it's with ttspconv in my device because with normal device (without ttstpconv) all it's OK
Any idea's ?
bhushanchanda
5th November 2015, 12:29
That's good. So, the log says, the program logic is going fine. The problem is at brp.close()
You might try changing the path in the device setup.
Try giving just a simple file name like fileout.rtf
f.martel
5th November 2015, 12:45
And the Winner it's ... Bhushan ! I find a file .... not MY file but A file ...
I give file name fileout.rtf, whitout path.
In my home directory 1 file was create with name .... Fileout :eek:
For me there is a bug in ttspconv when i try to print in job ...
Now i go integrate this particularity in my script !
Many thanks to Günter, Benito and Bhushan !!!
benito
5th November 2015, 14:50
...<snip> ...For me there is a bug in ttspconv when i try to print in job ...
no, it's not a bug in ttstpconv but your path had a problem. by typing just Filout.rtf, you are telling the program to just use your default temp directory.
i assumed that you understood this, e.g. you gave the path "/d5/tmp". i'm glad you're able to make it to work.
f.martel
5th November 2015, 15:03
it's a bug :
I typing file fileout.rtf (second test with fichier.doc) in my device.
After job, the file Fileout was create not fileout.rtf or fichier.doc