Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...It's fun to see others going through the same stuff I did and be able to help. It's also a way for me to stay sharp and not lose the stuff I've learned..."

Geography

Where in the world do Tek-Tips members come from?

Problem with JDE date conversion on iSeries

snufse1 (Programmer)
19 Nov 08 21:06
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
 
mikrom (Programmer)
20 Nov 08 4:48
I see these 2 possible problems:

1. In the create statement of your procedure you have not library specified

CODE

create procedure get_jobdet
...
and then you call a procedure from QGPL:

CODE

call qgpl.get_jobdet('     1100281', '0080    ')
Do you call the same one as you created or an older one?
Proove if your procedure was truly created in QGPL and not in other library (e.g. your *curlib).
To be sure that you create it in QGPL specify in your create statement the schema:

CODE

create procedure QGPL.get_jobdet
...

2. In your procedure you use as a path separator "/"

CODE

...
from vgiprddta/f0911li
...
and when you call it you use as a path separator "."

CODE

call qgpl.get_jobdet('     1100281', '0080    ')
the same with the select (without SP)

CODE

...
from vgiprddta.f0911li
...
I wonder how it can work. Are you everytime changed your settings in iSeries Navigator?
snufse1 (Programmer)
20 Nov 08 8:12
1. I create my procedure in QTXT and use the RUNSQLSTM, by default that created the procedure in QGPL

2. From the Iseries Navigator I have to use "." as a seperator and in my sp "/", just a different syntax

3. There is only one sp out there (in QGPL) and both of the examples above calling the "sp" or doing a "select from ..." work.

The problem is in the "sp" call correct date is not being returned. Thank you.

 
snufse1 (Programmer)
20 Nov 08 8:37
Hi Microm,

Think I eventually figured it out.

I am scripting my sp in QTXT and I call the "RUNSQLSTM" to check syntax and create my procedure in QGPL (by default). I started looking at optional parameters creating the proc and changed the "Date Format" attribute to *ISO (by default it was set to *JOB). Then I ran the proc from the iSeries navigator and from SQL Server 2005 and both rendered a valid and correct date.

Thank you for yor suggestions.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close