× 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.



Another option would be to encapsulate the read on the file in a (SQL)RPGLE
service program/module. Then you could call a procedure to set the
position to the file, then read the record, finally call procedures to
return
individual field names.

(column positioning not exact)

FMYFILE IF E K DISK USROPN
D MYFILEDS E DS EXTNAME(MYFILE:*INPUT) PREFIX(@)

P PositionFile B Export
D PositionFile PI N
D Key1 7 0 Const

/Free
If not %Open(MyFile);
Open(E) MyFile;
If %Error();
Return *off;
EndIf;
EndIf;
SetLL (Key1) MYFILE;
Return %Equal(MYFILE);
/End-Free
P E
P ReadFile B Export
D ReadFile PI N
/Free
Read MyFile MyFileDS;
Return %EoF(MyFile);
/End-Free
P E
P getField1 B Export
D getField1 PI 7 0
/free
return @field1;
/end-free
P E
P closeFile B
D closeFile PI
/free
If %Open(MyFile);
Close MyFile;
EndIf;
return;
/end-free
P E
...etc.


So when you compile your CLLE. You would compile as a module then create
program binding in the service program. Finally use the CALLPRC command to
call the procedures in the service program.

FYI, there's been previous threads about encapsulating which is something I
wanted to do. But some have convinced me not to do. The reason I would like
to encapsulate file access is because if there's a file change, only the
service program would need to be recompiled (when done correctly) if the
file is changed.




On Thu, May 31, 2012 at 2:05 PM, Musselman, Paul <
pmusselman@xxxxxxxxxxxxxxxx> wrote:

Another possibility is to create an index/LF over the file, then read that
file sequentially. You can then read the file in order, skipping any
un-needed records, with one open.

Paul E Musselman
PaulMmn@xxxxxxxxxxxxxxxxxxxx

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.