× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



After many years of coding RPG, I am working on my first embedded SQL
program. It is working, but not exactly the way I want it to.

(I finally found a resource that explained how to do embedded SQL that made
sense to me and I don't want to create a new set of logicals for just this
program.)



Anyway, this is a subfile program but my records are not appearing in the
specific sequence I want.



My declare is

Select field1, field2.field10

from mylib.file1

inner join mylib.file2 on file1.fielda = file2.fieldb

Where file1.fieldc = :pgmvar1 and

File1.fieldd < 'XX' and
//static value

File1.fielde >= :pgmvar2
//date in cyymmdd format

Order by file file1.fielde,

File1.fielde,

File2.fieldf;



Essentially I want the user to be able to enter the a date (pgmvar2) and
position to the first occurrence of that date and scroll from there, but it
is no working as expected.



If I had the logicals I would just have



Setll (pgmvar1:pgmvar2) jfile1;

Reade pgmvar1 jfile1;

Dou %eof(jfile1);

//do stuff

Reade pgmvar1 jfile1;

Enddo;



I have: declare, open, close, fetch first, fetch next, fetch relative (for
scrolling back) statements. The program is working except for the sequence
of the records.



I am sure I am missing something, just not sure what.





Regards,



Jim Hawkins

Programmer Analyst

Interkal LLC

Kalamazoo, MI




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.