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



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

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.