7 25 2 DEFINE Examples

LANSA Technical

7.25.2 DEFINE Examples

Define a work / counter field #I for internal use in an RDML program

Define a work / counter field #I for internal use

Define a field called #LASTORDER with same #ORDER attributes

Define a field called #LASTORDER with different #ORDER attributes

Define a field called #TOTQTY with 3 more significant digits than #QTY

Define a field called #TOTQTY with different attributes to #QTY

Define a field called #SHORT with similar attributes to field #LONG

Define a field called #SHORT with similar attributes to #LONG

Define a work / counter field #I for internal use in an RDML program

DEFINE FIELD(#I) TYPE(*DEC) LENGTH(7) DECIMALS(0)
 

Define a work / counter field #I for internal use

Define in an RDML program so that it will contain value 2 when the function begins to execute:

DEFINE FIELD(#I) TYPE(*DEC) LENGTH(7) DECIMALS(0) DEFAULT(2)
 

Define a field called #LASTORDER with same #ORDER attributes

Ensure that it has exactly the same attributes as field #ORDER which is defined in the LANSA data dictionary.

DEFINE FIELD(#LASTORDER) REFFLD(#ORDER)
 

Define a field called #LASTORDER with different #ORDER attributes

Ensure that it has exactly the same attributes as field #ORDER except for the description, label and column headings.

DEFINE FIELD(#LASTORDER) REFFLD(#ORDER) DESC('Last Order Number') LABEL('Last Order') COLHDG('Last' 'Order' 'Number')
 

Define a field called #TOTQTY with 3 more significant digits than #QTY

Ensure that it has exactly the same attributes as field #QTY except for having 3 more significant digits.

DEFINE FIELD(#TOTQTY) REFFLD(#QTY) LENGTH(*REFFLD *PLUS 3)
 

Define a field called #TOTQTY with different attributes to #QTY

Ensure it has exactly the same attributes as field #QTY except for having 3 more significant digits and 2 more decimal digits.

DEFINE FIELD(#TOTQTY) REFFLD(#QTY) LENGTH(*REFFLD *PLUS 5) DECIMALS(*REFFLD *PLUS 2)
 

Define a field called #SHORT with similar attributes to field #LONG

Make sure #SHORT is exactly 10 characters long.

DEFINE FIELD(#SHORT) REFFLD(#LONG) LENGTH(10)
 

Define a field called #SHORT with similar attributes to #LONG

Make sure #SHORT has exactly the same attributes as field #LONG except that it is 10 characters shorter.

DEFINE FIELD(#SHORT) REFFLD(#LONG) LENGTH(*REFFLD *MINUS 10) 
 

Define a numeric field based on another field

Define it with the S keyboard shift so that it can be displayed with edit code J.

DEFINE FIELD(#SHIFTY) REFFLD(#SHIFTS) EDIT_CODE(J) SHIFT(Y)