Dcl-S SavedIN Ind DIM(161);
Dcl-S P_Indicators Pointer INZ(%Addr(*IN));
Dcl-S Indicators LIKE(*IN) DIM(161) Based(P_Indicators);
// save indicator values
SavedIN = Indicators;
// do something that might change indicators.
...
// restore indicator values
Indicators = SavedIN;
I had a program once that needed to use a lot of indicators within a subfile.
I needed to support a lot of input/output fields that were different sizes and different positions.
I accomplish that you needed to put an indicator on every field in the subfile.
Then you can activate the appropriate indicator to have that field displayed.
I was able to generate one subfile that used 54 indicators.
I also needed to deal with indicators on the subfile control.
I didn't want to care about indicators that are used twice.
As a way to deal with this I was able to save the indicators into a hidden character field within the subfile and another in the control record.
When you read the subfile, you "restore" the indicators from the hidden field.
When you write the subfile you "save" the indicators into the hidden field.
Then the same thing when reading and writing to the subfile control.
This idea also allows for screen to be coded within a subprocedure and use any indicators without impacting other screens. You just save the indicators when the procedure starts and restore them in the "ON-EXIT".
Mapping indicators this way also makes it easier to name the indicators without needing to deal with an INDARA in the display file.
Dcl-Ds Inscnctl Len(99) QUALIFIED;
Sfldsp Ind POS(41);
Sflclr Ind POS(40);
Sflend Ind POS(42);
Position Ind POS(75);
All Ind POS(1) DIM(99) INZ(*OFF);
// Error Indicators for SCNCTL an
S1Sortby Ind POS(20);
S1View Ind POS(21);
S1Stn Ind POS(22);
End-Ds;
Then you just set
Indicators = Inscnctl;
Or you can use the IN array.
%subarr(*IN:1:99) = Inscnctl;
Why 161 and not 99.
If you only care about the first 99, then use 99.
The "other" indicators are grouped together.
DCL-S P_INDICATORS POINTER INZ(%ADDR(*IN));
DCL-DS INDICATORS LEN(161) based(P_INDICATORS);
ALLIND IND POS(1) DIM(161);
DCL-SUBF IN IND POS(1) DIM(99);
INL1 IND POS(100);
INL2 IND POS(101);
INL3 IND POS(102);
INL4 IND POS(103);
INL5 IND POS(104);
INL6 IND POS(105);
INL7 IND POS(106);
INL8 IND POS(107);
INL9 IND POS(108);
INLR IND POS(109);
INH1 IND POS(110);
INH2 IND POS(111);
INH3 IND POS(112);
INH4 IND POS(113);
INH5 IND POS(114);
INH6 IND POS(115);
INH7 IND POS(116);
INH8 IND POS(117);
INH9 IND POS(118);
INOA IND POS(119);
INOB IND POS(120);
INOC IND POS(121);
INOD IND POS(122);
INOE IND POS(123);
INOF IND POS(124);
INOG IND POS(125);
INOV IND POS(126);
IN1P IND POS(127);
INMR IND POS(128);
INRT IND POS(129);
INKA IND POS(130);
INKB IND POS(131);
INKC IND POS(132);
INKD IND POS(133);
INKE IND POS(134);
INKF IND POS(135);
INKG IND POS(136);
INKH IND POS(137);
INKI IND POS(138);
INKJ IND POS(139);
INKK IND POS(140);
INKL IND POS(141);
INKM IND POS(142);
INKN IND POS(143);
INKP IND POS(144);
INKQ IND POS(145);
INKR IND POS(146);
INKS IND POS(147);
INKT IND POS(148);
INKU IND POS(149);
INKV IND POS(150);
INKW IND POS(151);
INKX IND POS(152);
INKY IND POS(153);
INU1 IND POS(154);
INU2 IND POS(155);
INU3 IND POS(156);
INU4 IND POS(157);
INU5 IND POS(158);
INU6 IND POS(159);
INU7 IND POS(160);
INU8 IND POS(161);
End-ds;
--
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Giovanni Arturi via RPG400-L
Sent: Sunday, January 14, 2024 11:30 AM
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Giovanni Arturi <giovanni.arturi@xxxxxxxxx>
Subject: Best way to save *In Array
Hi all In old RPG we use Movea to save *In array; in rpgle Free ? Which method do you use ? Thanks in advance for you suggestions -- This is the RPG programming on IBM i (RPG400-L) mailing list To pos
External (rpg400-l@xxxxxxxxxxxxxxxxxx<mailto:rpg400-l@xxxxxxxxxxxxxxxxxx>)
Report This Email<
https://protection.inkyphishfence.com/report?id=d2luY29mb29kcy9jaHJpcy5oaWViZXJ0QHdpbmNvZm9vZHMuY29tL2VkNzdjZDA4MDc3MWU2MTNhZDY3MDBhNmNmNzJlMmU4LzE3MDUyNTcyOTkuMDY=#key=ded4467b7d2772cadf15777eb51131da>
Hi all
In old RPG we use Movea to save *In array; in rpgle Free ?
Which method do you use ?
Thanks in advance for you suggestions
As an Amazon Associate we earn from qualifying purchases.