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



Thanks Kurt. It actually makes sense to me that all the subfields must be
the same type, but I wasn't sure if there was a way so I thought I'd ask
the group.

BTW, I had to change the line

d i_StartDay Const likeds(t_DayDs.Subfield1)

must be changed to

d i_StartDay Const likeds(DayDs.Subfield1)
to compile without errors.

Thanks and have a nice weekend.

Robert Rogerson
On 2012-06-15 3:46 PM, Anderson, Kurt wrote:

Hi Robert,

You can pass a data structure as Const so none of the subfields can change, or as not Const so all of the subfields can change. However if some should be changeable and some not, I suggest breaking them out into separate parameters.

If GetDaysOfWeek is setting the 7 days based on what field 1 is, then I suggest changing the call:

p GetDaysOfWeek b
d GetDaysOfWeek pi
d i_StartDay Const likeds(t_DayDs.Subfield1)
d o_DayDs likeds(t_DayDs)

Then you would call it as:
GetDaysOfWeek('Sunday': DayDs);


Hm, the procedure could still change subfield1 though... don't have the time to ponder this unfortunately.

-Kurt

-----Original Message-----
From: [1]rpg400-l-bounces@xxxxxxxxxxxx [[2]mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Robert Rogerson
Hi All,

I'm just hoping that someone can spare a moment and help me understand
this better.

I'm unclear how or if I can stipulate a parameter as const when passing a
datastructure defined like a template. For example, see the following
code.

h option(*nodebugio:*srcstmt)
d testpgm7 pr

d t_DayDs ds template
d subfield1 10a varying
d Overlay(t_DayDs)
d subfield2 like(subfield1)
d Overlay(t_DayDs: *next)
d subfield3 like(subfield1)
d Overlay(t_DayDs: *next)
d subfield4 like(subfield1)
d Overlay(t_DayDs: *next)
d subfield5 like(subfield1)
d Overlay(t_DayDs: *next)
d subfield6 like(subfield1)
d Overlay(t_DayDs: *next)
d subfield7 like(subfield1)
d Overlay(t_DayDs: *next)

d testpgm7 pi

d DayDs ds likeds(t_DayDs)

/free
*inlr = *on ;

DayDs.subfield1 = 'Sunday';
GetDaysOfWeek(DayDs);

Return;
/end-free

p GetDaysOfWeek b
d GetDaysOfWeek pi
d i_DayDs likeds(t_DayDs)
/free
*inlr = *on ;

If i_DayDs.subfield1 = 'Sunday';
i_DayDs.subfield2 = 'Monday';
Endif;

Return;
/end-free
p GetDaysOfWeek e

The datastructure DayDs is defined like the template t_DayDs. I don't
want the procedure GetDaysOfWeek to be able to change subfield1. If I had
passed all 7 parameters I would have specified the keyword const for the
first parameter.

How or can I do with a keyword when I pass a datastructure.

Thanks to all in advance.

Robert Rogerson

References

Visible links
1. mailto:rpg400-l-bounces@xxxxxxxxxxxx
2. mailto:rpg400-l-bounces@xxxxxxxxxxxx

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.