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



Dave,

First off, good luck with the job hunt.

The only time I use procedure pointers is for call-back processing. Using it in place of a Select, as you say, seems like it would only add code and provide no benefit.

Added code being that instead of:

Select;
When x = 1;
sortByCust();
When x =2 ;
sortByOrder();
EndSl;

You'd have:
Select;
When x = 1;
p_Sort = PADDR_SORT_BY_CUST;
sort();
When x =2 ;
p_Sort = PADDR_SORT_BY_ORDER;
sort();
EndSl;

I suppose they might have a program that can run in 3 (arbitrary number) "modes." At the beginning of the program they could point the procedures they'll be using at the ones appropriate for the mode. Then within the code all the varied procedures would share a common name. I don't know how likely it is to actually write a program like this, but maybe that's what they're doing.

-Kurt Anderson

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dave
Sent: Monday, January 21, 2013 1:40 PM
To: RPG programming on the IBM i / System i
Subject: Unbound procedure call

Hi all,

I was asked in an interview how I would go about coding a call to a procedure so that no binding to that procedure would occur at compilation.
I said I would need to have the addresses of the callable procedures and I would have a generic prototype based on a pointer that called the procedure indicated by its address. Depending upon what the program needed to do I would initialise that pointer so the right procedure would be called.
This was a test to get an idea of my RPG skills, but I discovered that this was a technique favoured by the shop. I did not dare ask why would they want to use this technique, so I'm asking : why would you really want to do it this way? Why not just use a SELECT statement?
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.