|
list
Yes you could probably come up with a way to do this using pointers.
But any way you look at it there needs to be a decision made somewhere
as to which date you want and a value returned, the actual date value or
a pointer. Because of that, I really don't see pointers providing a
benefit in this situation. I'd go with the select group.
If the issue is having the select group cluttering up a section of code
put the select into a procedure that returns the proper date value based
on the input value passed and call it where needed.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of sjl
Sent: Thursday, June 05, 2008 12:26 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Pointer question
I'll preface this by saying I'm not a pointer expert...
One of my co-workers is writing a program in which he needs to access
several different fields within a record in a file depending on a
soft-coded criteria that is fed into the program, and he was hoping that
he could somehow use a pointer to accomplish this and thus have a more
elegant solution.
The file has six different date fields:
DATE1
DATE2
DATE3
DATE4
DATE5
DATE6
and depending of the value of the input field (I'll call it WHICHDATE),
he wants to be able to set a pointer to one of these six different date
fields in order to reference the value of the field, instead of using a
SELECT group with six different branches...
So, if WHICHDATE = 'DATE1', he wants the pointer to reference the
address of field DATE1, if WHICHDATE = 'DATE2', he wants the pointer to
reference the address of field DATE2, etc.
Does this even make sense? Is this possible?
As for me, I'd just use SELECT...
Regards,
sjl
Privileged and Confidential. This e-mail, and any attachments there
to, is intended only for use by the addressee(s) named herein and
may contain privileged or confidential information. If you have
received this e-mail in error, please notify me immediately by a
return e-mail and delete this e-mail. You are hereby notified that
any dissemination, distribution or copying of this e-mail and/or any
attachments thereto, is strictly prohibited.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
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 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.