Difference between revisions of "Test268 Section 3"
From MidrangeWiki
(→Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not)) |
(→Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not)) |
||
Line 100: | Line 100: | ||
=== Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not) === | === Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not) === | ||
− | + | * Addition | |
result = field1 + field2; | result = field1 + field2; | ||
− | + | * Subtraction | |
result = field1 - feild2; | result = field1 - feild2; | ||
− | + | * Multiplication | |
result = field1 * field2; | result = field1 * field2; | ||
+ | * Division | ||
+ | result = field1 / field2; | ||
+ | * ** | ||
+ | Ed - What is this?? | ||
+ | result = field1 ** field2; | ||
=== Code and use date data types and arithmetic operations, including date operations in expressions === | === Code and use date data types and arithmetic operations, including date operations in expressions === |
Revision as of 21:59, 5 December 2005
<< Previous Section | Home | Next Section >>
Contents
- 1 Section 3 - Core RPG (15%)
- 1.1 Recognize appropriate use of RPG creation commands (e.g., CRTxxxPGM, CRTxxxMOD, CRTPGM, CRTBNDxxx)
- 1.2 Define basic arrays (e.g., compile time, pre-run time, run time) using D specs
- 1.3 Use basic array handling (e.g., *IN, LOOKUP, SORTA, MOVE and MOVEA, indexing)
- 1.4 Code and use figurative constants (e.g., *LOVAL, *HIVAL, *ALL, *BLANKS, *ZEROS, *ON, *OFF)
- 1.5 Code and use job date and system date
- 1.6 Code and use structured operation codes (e.g., DO DOUxx, DOWxx, IF/ELSE/ELSEIF, SELECT/WHEN, CASxx/EXSR)
- 1.7 Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not)
- 1.8 Code and use date data types and arithmetic operations, including date operations in expressions
- 1.9 Code and use SDS
- 1.10 Code and use *INZSR
- 1.11 Code and use RPG IV built-in functions
- 1.12 Use the H-spec keywords
- 1.13 Use RPG IV OpCodes (e.g., Arithmetic, Date, Message, Array, Declarative, File, Branching, Indicator setting, String handling, Structured programming, compare, initialization, subroutine, data area)
- 1.14 Use the D-spec keywords
Section 3 - Core RPG (15%)
Recognize appropriate use of RPG creation commands (e.g., CRTxxxPGM, CRTxxxMOD, CRTPGM, CRTBNDxxx)
- CRTxxxPGM
- Used for compiling a RPG ILE 4 program without the "NOMAIN" H-Spec
- CRTxxxMOD
- Used for compiling a RPG ILE 4 program with the "NOMAIN" H-Spec
- CRTPGM
- CRTBNDxxx
Define basic arrays (e.g., compile time, pre-run time, run time) using D specs
Compile Time
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++ DARC S 3A DIM(12) PERRCD(5) CTDATA // Must be at the end of the code **CTDATA ARC 48K16343J64044HComments can be placed here 12648A47349K346Comments can be placed here 50B125 Comments can be placed here
Pre-Run Time
Figure 68 shows the definition specifications required for two prerun-time arrays, a compile-time array, and a run-time array. Figure 68. Definition Specifications for Different Types of Arrays
HKeywords+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ H DATFMT(*USA) TIMFMT(*HMS) D*ame+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++ * Run-time array. ARI has 10 elements of type date. They are * initialized to September 15, 1994. This is in month, day, * year format using a slash as a separator as defined on the * control specification. DARI S D DIM(10) INZ(D'09/15/1994') * * Compile-time arrays in alternating format. Both arrays have * eight elements (three elements per record). ARC is a character * array of length 15, and ARD is a time array with a predefined * length of 8. DARC S 15 DIM(8) PERRCD(3) D CTDATA DARD S T DIM(8) ALT(ARC) * * Prerun-time array. ARE, which is to be read from file DISKIN, * has 250 character elements (12 elements per record). Each * element is five positions long. The size of each record * is 60 (5*12). The elements are arranged in ascending sequence. DARE S 5A DIM(250) PERRCD(12) ASCEND D FROMFILE(DISKIN) * * Prerun-time array specified as a combined file. ARH is written * back to the same file from which it is read when the program * ends normally with LR on. ARH has 250 character elements * (12 elements per record). Each elements is five positions long. * The elements are arranged in ascending sequence. DARH S 5A DIM(250) PERRCD(12) ASCEND D FROMFILE(DISKOUT) D TOFILE(DISKOUT) // Must be at the end of the code **CTDATA ARC Toronto 12:15:00Winnipeg 13:23:00Calgary 15:44:00 Sydney 17:24:30Edmonton 21:33:00Saskatoon 08:40:00 Regina 12:33:00Vancouver 13:20:00
Run Time
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++ DARC S 3A DIM(12)
Use basic array handling (e.g., *IN, LOOKUP, SORTA, MOVE and MOVEA, indexing)
Code and use figurative constants (e.g., *LOVAL, *HIVAL, *ALL, *BLANKS, *ZEROS, *ON, *OFF)
- *ALL
- *BLANKS -- Fills an alpha field with ' '
- *HIVAL -- Fills a field with the highest possible value the field can hold
- *LOVAL -- Fills a field with the lowest possible value the field can hold
- *OFF -- Generally used for indicators to either turn them off or check to see if they are off
- *ON -- Generally used for indicators to either turn them on or check to see if they are on
- *ZEROS -- Fills a numeric field with 0
Code and use job date and system date
Job Date
System Date
Code and use structured operation codes (e.g., DO DOUxx, DOWxx, IF/ELSE/ELSEIF, SELECT/WHEN, CASxx/EXSR)
Code and use structured operation codes with expressions (+, -, * ,/, **, <, >, =, (), and, or, not)
- Addition
result = field1 + field2;
- Subtraction
result = field1 - feild2;
- Multiplication
result = field1 * field2;
- Division
result = field1 / field2;
- **
Ed - What is this??
result = field1 ** field2;
Code and use date data types and arithmetic operations, including date operations in expressions
Code and use SDS
See Program Status Data Structure
Code and use *INZSR
Code and use RPG IV built-in functions
Use the H-spec keywords
See H-Spec Keywords
Use RPG IV OpCodes (e.g., Arithmetic, Date, Message, Array, Declarative, File, Branching, Indicator setting, String handling, Structured programming, compare, initialization, subroutine, data area)
Use the D-spec keywords
See D-Spec Keywords