Professional Documents
Culture Documents
Objectives:
Define work fields, data structures and other data items Set the initial value for data items Distinguish among program variables, literals and constants
Definition Specifcations
Define all fields in your program Specify name, length, and type Input Specifications define fields from database Definition Specifications define work fields or stand-alone fields
Numeric Literal
The literal may include a decimal point and/or sign. The sign must be the left most character of the literal. The literal may include digits 0 thru 9. The literal should never contain commas, dollar signs, or percent signs. The literal must not be enclosed in apostrophes.
Character Literals
To indicate that a value is a character literal simply enclose it with apostrophes.
Figurative Constants
*BLANK(S) - fills a character field with blanks *HIVAL - fills a character with XFFFF (all bits on), fills a numeric field with all 9s and + sign *LOVAL - fills a character with x000(all bits off), fills a numeric field with all 9s and - sign *ZERO(S) - fills a numeric field with zeros *ALL - causes a string to be repeated in a field *OFF - character value of 0 *ON - character value of 1 *NULL- used with pointers
Defining Constants
A named constant differs from a standalone in two respects:
Its value never changes during processing It is defined with no specified length
Code the letter C, for constant, in column 24 Enter the value in the Keywords area
Overlapping Subfields
Locations of subfields can overlap Absolute notation clearly indicates the overlap with the From and To Length notation uses the keyword OVERLAY
Points to Remember
RPG IV requires you to define all fields your programs will use Input fields are defined using Input Specifications and standalone fields are defined using Definition Specifications You can use the keyword INZ to assign a value to a field