SQLRPGLE- Query Not fetching records in program

95 pts.
Tags:
AS/400
i series
IBM
SQLRPGLE
Hi I have below query in my program , when i executed it interactively thro strsql , its fetching records but the same query is not fetching records when i execute it in my program. Please provide your valuable answers as soon as possible.. as i need it very urgently... As si mentioned it has proper data in all the file and its fetching record in strsql but not in program, anyone with expertise in sqlrpgle, please advise soon Select fld1 , fld2 , sum(fld3), Sum(fld4), sum(fld3) - sum(fld4) as Balance from FILE1,FILE2 Left join FILE3 on File1.Fld1 = File3.Fld1 and File1.Fld2 = File3.Fld2 and File1.Fld3 = File3.Fld3 Where File1. Fld1 = 'im passing a char valu from screen field here' File1. Fld2 = File2.Fld2 File1. Fld3 = File2.Fld3 Group by Flie1.Fld1, File1.Fldx Order by Balance Desc

Software/Hardware used:
SQLRPGLE , AS400 , IBM , i series
ASKED: January 17, 2013  7:28 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Group by Flie1.Fld1, File1.Fldx Order by Balance Desc should be File1.Fld1, File1.Fld2 I think that you will only be able to order by fields that are extracted.
    48,575 pointsBadges:
    report
  • philpl1jb
    so if this is going to return multiple records you need to declare a cursor for the sql, open it and fetch records from it...
    48,575 pointsBadges:
    report
  • TomLiotta
    Yeah, the query is only the description of records that will be returned. It doesn't actually return any records. They need to be FETCHed. What does the embedded SQL look like other than the query? Further, the SELECT statement that you show clearly cannot work in STRSQL nor embedded in a program. And if you are going to select based on a value input through a display file, you can't use the same statement in a program as you would in STRSQL anyway. If you're going to show us a statement that has a problem, you have to show us the actual statement. We can't guess how you might have changed it from what your program is running. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following