Question

How can i set color to specific records in a subfile on some condition execution? I have a display file where the SFL and CTL have been defined.Where can i refer the indicators in the DSP file or use them in the RPG to trigger appropriate conditioning.

For eg:

       Name      Age       Location
      Rosell     26        Amsterdam
      Smarkon    31        London
      Jack       40        Chicago
      Jim        22        Mauritius

I now want to display records in my subfile only of those whose age is greater than 30.(age>30) I want those records that have been retrieved in a different color.

Was it helpful?

Solution

Use numbered indicators in your display file to control the COLOR attributes like so:

.....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+
                  S1AGE          3  0   5 12EDTCDE(Z)
    30                                  COLOR(BLU)

These number indicators in your display file records are passed back and forth to your RPG program in the display file's record formats. So, in your RPG, you set indicator 30 on or off depending on the value of the person's age. (Note: The following example is in free-form RPG.)

If S1AGE > 30;
  *IN30 = *On;
Else;
  *IN30 = *Off;
EndIf;

Or, if you like concise code in your RPG:

*IN30 = (S1Age > 30);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top