Using a DSPATR(&name) field to set color is a solution that will persist after a subfile record is read again.
Without the need for an indicator at all.
This was hinted at by Eric's response.

A DA_S0TEXT 1A P
A S0TEXT 94A B 06 38DSPATR(&DA_S0TEXT)

Then you set DA_S0TEXT when you load the subfile record.
You can also update the value as needed if you want the color to change.
But once it is set to a color, it will remain that color as long as the record exists in the subfile.


DA_S0TEXT = X'28';

We use a procedure to return the value. Has options for color, attribute, and protect.

DA_S0TEXT = RtnDspAtr( 'RED' : 'UL' );


Shared the procedure here back in 2022:
https://gist.github.com/chrishiebert/25b4bdeebe104098a8b7e69514698875
https://archive.midrange.com/rpg400-l/202208/msg00170.html



--
Chris Hiebert
Lead Software Developer
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 mlazarus
Sent: Wednesday, November 27, 2024 8:20 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: External Subfile indicator question...


Jerry,



To solve the "read issue" you're running into, I create a hidden field

and save the value there. That value would get returned to you when you

read the subfile record. Then set the color accordingly, before you

update the record.



-marl



On 11/27/2024 8:34 AM, (WalzCraft) Jerry Forss wrote:

I have had better luck changing the subfile field to a char that is 1 longer than the display size. A 7.2 Amt with a J code would be 10 + 1=11

In the pgm if you want red I do a AmtOut = HexRed + %EditC(Amt : 'J')



HexRed is x'28', HexWhite is x'22' and hexgreen is x'20'



I have had issues with losing the indicator value when the record is read.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 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.