Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

7.30.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 numeric field based on another field

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

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

Anchor
Define a work / counter field #I for internal use
Define a work / counter field #I for internal use
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:

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

Anchor
Define a field called #LASTORDER with same #ORDER attributes
Define a field called #LASTORDER with same #ORDER attributes
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.

Code Block
DEFINE FIELD(#LASTORDER) REFFLD(#ORDER)

Anchor
Define a field called #LASTORDER with different #ORDER attributes
Define a field called #LASTORDER with different #ORDER attributes
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.

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

Anchor
Define a field called #TOTQTY with 3 more significant digits than #QTY
Define a field called #TOTQTY with 3 more significant digits than #QTY
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.

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

Anchor
Define a field called #TOTQTY with different attributes to #QTY
Define a field called #TOTQTY with different attributes to #QTY
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.

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

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

Make sure #SHORT is exactly 10 characters long.

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

Anchor
Define a field called #SHORT with similar attributes to #LONG
Define a field called #SHORT with similar attributes to #LONG
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.

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

Anchor
Define a numeric field based on another field
Define a numeric field based on another field
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.

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