I have created a sp that should return a JDE date in yyyymmdd format (*ISO). Here is the sp:
create procedure get_jobdet
(in @jobnumber char(12),
@costcode char(8))
result set 1
language sql
reads sql data
begin
declare c1 scroll cursor with return for
select glmcu, glsub, glu,
date(digits(dec(gldgj + 1900000,7,0)))
from vgiprddta/f0911li
where glmcu = @jobnumber and
glsub = @costcode and
gldct = 'FP' and
globj = ' '
group by glmcu, glsub, glu, gldgj;
open c1;
end;
Now when I call the sp using the iSeries navigator (or using linked server on Sequel Server 2005) like this:
call qgpl.get_jobdet(' 1100281', '0080 ')
I get following result:
1100281 0080 8000 0813-09-30
1100281 0080 50000 0113-09-30
The date being returned (last field) is not correct
Now if I call with a "select...) like this:
select glmcu, glsub, glu, date(digits(dec(gldgj + 1900000,7,0)))
from vgiprddta.f0911li
where glmcu = ' 1100281' and
glsub = '0080 ' and
gldct = 'FP' and
globj = ' 'I get a good result for the date:
1100281 0080 8000 2007-01-31
1100281 0080 50000 2008-08-31
I do not understand why my sp is not working on the date convert when my select is working and basically do the same thing. I've been working on this probelm for several days, does anyone have some good tips? Thank you
create procedure get_jobdet
(in @jobnumber char(12),
@costcode char(8))
result set 1
language sql
reads sql data
begin
declare c1 scroll cursor with return for
select glmcu, glsub, glu,
date(digits(dec(gldgj + 1900000,7,0)))
from vgiprddta/f0911li
where glmcu = @jobnumber and
glsub = @costcode and
gldct = 'FP' and
globj = ' '
group by glmcu, glsub, glu, gldgj;
open c1;
end;
Now when I call the sp using the iSeries navigator (or using linked server on Sequel Server 2005) like this:
call qgpl.get_jobdet(' 1100281', '0080 ')
I get following result:
1100281 0080 8000 0813-09-30
1100281 0080 50000 0113-09-30
The date being returned (last field) is not correct
Now if I call with a "select...) like this:
select glmcu, glsub, glu, date(digits(dec(gldgj + 1900000,7,0)))
from vgiprddta.f0911li
where glmcu = ' 1100281' and
glsub = '0080 ' and
gldct = 'FP' and
globj = ' 'I get a good result for the date:
1100281 0080 8000 2007-01-31
1100281 0080 50000 2008-08-31
I do not understand why my sp is not working on the date convert when my select is working and basically do the same thing. I've been working on this probelm for several days, does anyone have some good tips? Thank you