"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 07/12/2016
12:29:36 PM:
We use a service program procedure to generate the desired attribute.
You can combine multiple attributes using the %bitor function.
Here is the function we have in a service program. It's based off of
code from this old article:
http://search400.techtarget.com/tip/Display-attributes-made-simple
I like it. So I created this for our shop. Thanks.
dcl-c clrGreen 1;
dcl-c clrWhite 2;
dcl-c clrRed 3;
dcl-c clrTurquoise 4;
dcl-c clrYellow 5;
dcl-c clrPink 6;
dcl-c clrBlue 7;
dcl-c atrReverse 1;
dcl-c atrUnderline 2;
dcl-c atrRevUline 3;
dcl-c atrNonDisplay 4;
dcl-c atrBlink 5;
dcl-c atrProtect 6;
dcl-c indProtect *on;
dcl-proc GenUtl_Get5250Attribute export;
dcl-pi *n char(1);
pColor zoned(1:0) const options(*nopass:*omit);
pAttrb zoned(1:0) const options(*nopass:*omit);
pProtect ind const options(*nopass);
end-pi;
dcl-ds color_ds;
Green char(1) inz(x'20');
White char(1) inz(X'22');
Red char(1) inz(X'28');
Turquoise char(1) inz(X'30');
Yellow char(1) inz(X'32');
Pink char(1) inz(X'38');
Blue char(1) inz(X'3A');
colors char(1) dim(7) pos(1);
end-ds;
dcl-ds attrb_ds;
Reverse char(1) inz(X'01');
Underline char(1) inz(X'04');
RevUline char(1) inz(x'05');
NonDisplay char(1) inz(X'27');
Blink char(1) inz(X'2A');
Protect char(1) inz(X'80');
attrbs char(1) dim(6) pos(1);
end-ds;
dcl-s attribute char(1);
if %parms < %parmnum(pColor) // color value not passed?
or %addr(pColor) = *null
or pColor <= *zero // or value not in range?
or pColor > %elem(colors);
attribute = colors(clrGreen); // default color
else; // else
attribute = colors(pColor); // apply color
endif;
if %parms < %parmnum(pAttrb) // attrb value not passed?
or %addr(pAttrb) = *null
or pAttrb <= *zero // or value not in range?
or pAttrb > %elem(attrbs);
else; // skip it, else
attribute = %bitor(attribute: attrbs(pAttrb)); // apply attrb
endif;
if %parms < %parmnum(pProtect) // protect indicator not passed?
or %addr(pProtect) = *null
or pProtect <> *on; // or indicator not on?
else; // skip it, else
attribute = %bitor(attribute: attrbs(atrProtect)); // apply
protect
endif;
return attribute; // return composite 5250
attribute
end-proc;
Sincerely,
Dave Clark
As an Amazon Associate we earn from qualifying purchases.