Page History
...
It is important to remember that this functionality is only true at the database level. Manipulating an alphanumeric field with embedded packed fields as an alphanumeric field, rather than its packed constituent parts, will still yield unpredictable results as described in the previous point. In RDML you must refer to the embedded fields and not the alphanumeric field. This is an example of the code:FUNCTION OPTIONS
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);
- P07 is defined in the repository as packed, length 7 and decimals 0. A02 is defined as alphanumeric of length 2. These two fields are in file F10.
- Note that A02 is not manipulated directly in the RDML. Rather, P03R is manipulated in the RDML and A02 is only referred to in database commands like INSERT and SELECT. If, for example, A02 was used in a CHANGE command the behavior is unspecified.
...
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|
- These uses are not enforced by the Repository. They may work on some databases and not on others. Because of this different database behavior it is advisable not to use binary fields in this way.