14.1 Use of Hex Values, Attributes, Hidden/Embedded Decimal Data, *LOVAL and *HIVAL

When working with hexadecimal values, attribute bytes, "hidden" or "imbedded" decimal data, *LOVAL or *HIVAL you should be aware of the following: 

FUNCTION OPTIONS(*DIRECT);

DEFINE FIELD(#A04) TYPE(*CHAR) LENGTH(4);

DEFINE FIELD(#A04A) TYPE(*CHAR) LENGTH(4) DECIMALS(0) TO_OVERLAY(#P07);

DEFINE FIELD(#P03R) TYPE(*DEC) LENGTH(003) DECIMALS(0) EDIT_CODE(J) TO_OVERLAY(#A02);

DEFINE FIELD(#C) TYPE(*DEC) LENGTH(007) DECIMALS(0);

DEF_LIST NAME(#L10) FIELDS(#P07 #P03R);

********** COMMENT(Insert 0 to 999 fields);

BEGIN_LOOP USING(#C) TO(1000);

CHANGE FIELD(#P07) TO('(#C - 1)');

CHANGE FIELD(#P03R) TO(#P07);

INSERT FIELDS(#P07 #A02) TO_FILE(F10);

END_LOOP;

********** COMMENT(Retrieve and converts previously saved fields);

SELECT FIELDS(#P07 #A02) FROM_FILE(F10);

ADD_ENTRY TO_LIST(#L10);

ENDSELECT;

**********

DISPLAY BROWSELIST(#L10);

 

CHANGE FIELD(#P03R) TO(#P07);

CHANGE FIELD(#A04) TO(#A02)

   It may or may not work as expected depending on whether the Packed Field representation #P03R (i.e., #A02) contains a byte of 0x00.

- Displaying the Alphanumeric Field

- Using the Field in a File's Key

- Using the Field in a View's Key

- Using the Field in an Access Route's Key

- Using the Field in a Batch Control Key

- Using the Field in a Rule or Trigger