1. Home
  2. /
  3. Rpg-iv-as400
  4. /
  5. Basic Arithmetic Calculation

Basic Arithmetic Calculation - Rpg-iv-as400 Typing CST Test

Loading…

Basic Arithmetic Calculation — Rpg-iv-as400 Code

Compute total price including tax.

DCL-S Price PACKED(7:2) INZ(100);
DCL-S TaxRate PACKED(5:2) INZ(0.13);
DCL-S TaxAmount PACKED(7:2);
DCL-S Total PACKED(7:2);
TaxAmount = Price * TaxRate;
Total = Price + TaxAmount;
DSPLY ('Total Price: ' + %CHAR(Total));
*INLR = *ON;

Rpg-iv-as400 Language Guide

RPG IV (also known as RPGLE) is a high-level programming language for IBM i (AS/400) systems, designed for business applications, supporting structured programming, modern free-form syntax, and integration with DB2 databases.

Primary Use Cases

  • ▸Developing core business applications on IBM i
  • ▸Transaction processing and batch jobs
  • ▸Integration with DB2 databases
  • ▸Generating reports and financial calculations
  • ▸Maintaining legacy ERP and order processing systems

Notable Features

  • ▸Free-form and fixed-form syntax support
  • ▸Deep integration with DB2 for IBM i
  • ▸Service programs for modular code reuse
  • ▸Built-in support for files, arrays, and data structures
  • ▸Batch and interactive program support

Origin & Creator

IBM developed RPG in the 1960s for business applications. RPG IV, released in the 1990s, modernized the language with free-form syntax, modularization, and integration with DB2.

Industrial Note

RPG IV is highly specialized for IBM i / AS/400 environments, primarily used in banking, retail, and enterprise ERP systems where reliability, legacy integration, and transaction processing are essential.

More Rpg-iv-as400 Typing Exercises

Simple Hello World in RPG IVRead Data from a FileUpdate a Field in a FileConditional ProcessingLoop Through RecordsPerform SubprocedureUse Array in RPG IVConditional Loop With LeaveCalculate and Display Totals

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher