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
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.
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
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 3  Replies