Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp
Title: RPG/400 User's Guide
Document Number: SC09-1816-00
Build Date: 03/31/94 14:39:26 Build Version: 1.2
Document Path: /home/webapps/epubs/htdocs/book/qbkaqu00.boo

CONTENTS Table of Contents


Summarize

COVER         Book Cover 

NOTICES       Notices 

EDITION       Edition Notice 

CONTENTS      Table of Contents 

FRONT_1       Notices 
FRONT_1.1     Programming Interface Information 
FRONT_1.2     Trademarks and Service Marks 

FRONT_2       About This Manual 
FRONT_2.1     Who Should Use This Manual 
FRONT_2.2     How to Interpret Syntax Diagrams 

1.0           Chapter 1.  An Introduction to the RPG/400 
  1.1           The OS/400 System 
  1.2           The AS/400 Control Language 
    1.2.1         Commonly Used Control Language Commands 
1.3           System/38 Environment on the AS/400 System 
1.4           AS/400 Utilities and Languages 
  1.4.1         The Source Entry Utility 
  1.4.2         The Screen Design Aid 
  1.4.3         The Structured Query Language 
    1.4.3.1       Restrictions 
1.5           Designing Your RPG/400 Program 
    1.5.1         Designing the Output 
    1.5.2         Designing the Processing 
    1.5.3         Designing the Input 
1.6           Structured Programming in the RPG/400 Programming Language 
  1.6.1         Sequential Operation 
  1.6.2         Conditional Branching 
    1.6.2.1       If Else Structure 
    1.6.2.2       SELEC Structure 
    1.6.2.3       Other Conditional Branching Structures 
  1.6.3         Repeating an Operation 
    1.6.3.1       Do Operation 
    1.6.3.2       Do While Operation 
    1.6.3.3       Do Until Operation 
  1.6.4         Summary of Structured Programming Operation Codes 
1.7           Designing Applications 
  1.7.1         Single Program Design 
  1.7.2         Modular Program Design 
  1.7.3         Examples of Application Design 

2.0           Chapter 2.  Entering RPG/400 Specifications 
2.1           The RPG/400 Specifications 
  2.1.1         The Control Specification 
  2.1.2         File Description Specifications 
  2.1.3         Extension Specifications 
  2.1.4         Line Counter Specifications 
  2.1.5         Input Specifications 
  2.1.6         Calculation Specifications 
  2.1.7         Output Specifications 
2.2           Entering Your Program 

3.0           Chapter 3.  Compiling an RPG/400 Program 
3.1           Create RPG400 Program (CRTRPGPGM) Command 
  3.1.1         Using the CRTRPGPGM Command 
    3.1.1.1       Elements of the CRTRPGPGM Command Lines 
    3.1.1.2       Entering Elements from the CRTRPGPGM Command Display 
    3.1.1.3       Entering Only Certain Parameters 
    3.1.1.4       Entering Only the Parameter Values 
3.2           CRTRPGPGM Command 
3.3           Compiling under the System/38 Environment 

4.0           Chapter 4.  Error Messages, Testing, and Debugging 
4.1           Using, Displaying, and Printing Messages 
  4.1.1         Using Messages 
  4.1.2         Systems Application Architecture Flagging Messages 
  4.1.3         Displaying and Printing Messages 
4.2           How to Run an RPG/400 Program 
  4.2.1         Save-While-Active Support 
4.3           Using a Test Library 
4.4           Using Breakpoints 
  4.4.1         Example of Using Breakpoints 
  4.4.2         Considerations for Using Breakpoints 
4.5           Using a Trace 
  4.5.1         Example of Using a Trace 
  4.5.2         Considerations for Using a Trace 
4.6           Using the DEBUG Operation Codes 
4.7           Using the RPG/400 Formatted Dump 
4.8           Exception/Error Handling 

5.0           Chapter 5.  General File Considerations 
5.1           Device Independence/Device Dependence 
5.2           Spooling 
  5.2.1         Output Spool 
5.3           Externally Described and Program-Described Files 
5.4           Level Checking 
5.5           File Locking by an RPG/400 Program 
5.6           Record Locking by an RPG/400 Program 
5.7           Unblocking Input Records and Blocking Output Records 
5.8           Sharing an Open Data Path 
5.9           Using the Control Language Command RCLRSC 
5.10          Specifications for Externally Described Files 
  5.10.1        File Description Specifications 
  5.10.2        Renaming Record-Format Names 
  5.10.3        Ignoring Record Formats 
  5.10.4        Floating-Point Fields 
  5.10.5        Overriding or Adding RPG/400 Functions to an External Description 
  5.10.6        Output Specifications 
5.11          Program-Described Files 
5.12          Printer Files 
  5.12.1        Page Overflow 
  5.12.2        Overflow Indicators 
  5.12.3        Fetch-Overflow Logic 
  5.12.4        PRTCTL (Printer Control) Option 
5.13          Sequential File 
5.14          Special File 

6.0           Chapter 6.  Commitment Control 
6.1           Using Commitment Control 
  6.1.1         Starting and Ending Commitment Control 
  6.1.2         Specifying Files for Commitment Control 
  6.1.3         Commitment Control Operations 
  6.1.4         Commitment Control Locks 
  6.1.5         Commitment Control in the Program Cycle 
  6.1.6         Example of Using Commitment Control 

7.0           Chapter 7.  Using DISK Files 
7.1           Externally Described Disk Files 
  7.1.1         Record Format Specifications 
  7.1.2         Access Path 
  7.1.3         Valid Keys for a Record or File 
    7.1.3.1       Valid Search Arguments 
    7.1.3.2       Referring to a Partial Key 
  7.1.4         Processing Methods for Externally Described DISK Files 
7.2           Program-Described Disk Files 
  7.2.1         Indexed File 
    7.2.1.1       Valid Search Arguments 
  7.2.2         Sequential Files 
  7.2.3         Record Address File 
    7.2.3.1       Limits Records 
    7.2.3.2       Relative Record Numbers 
  7.2.4         Externally Described File as Program Described 
7.3           Methods for Processing Disk Files 
  7.3.1         Relative-Record-Number Processing 
  7.3.2         Consecutive Processing 
  7.3.3         Sequential-by-Key Processing 
  7.3.4         Sequential-within-Limits Processing 
  7.3.5         Keyed Processing Examples 
7.4           Valid File Operations 

8.0           Chapter 8.  Using WORKSTN Files 
8.1           Intersystem Communications Function 
8.2           Externally Described WORKSTN Files 
  8.2.1         Processing an Externally Described WORKSTN File 
  8.2.2         Function Key Indicators on Display Device Files 
  8.2.3         Command Keys on Display Device Files 
8.3           Processing WORKSTN Files 
    8.3.1         EXFMT Operation 
    8.3.2         READ Operation 
    8.3.3         WRITE Operation 
  8.3.4         WORKSTN file 
  8.3.5         Subfiles 
    8.3.5.1       Use of Subfiles 
8.4           Program-Described WORKSTN File 
  8.4.1         Program-Described WORKSTN File with a Format Name 
    8.4.1.1       Output Specifications 
    8.4.1.2       Input Specifications 
    8.4.1.3       Calculation Specifications 
    8.4.1.4       Additional Considerations 
  8.4.2         Program-Described WORKSTN File without a Format Name 
    8.4.2.1       Input File 
    8.4.2.2       Output File 
    8.4.2.3       Combined File 
8.5           Multiple-Device Files 
8.6           WORKSTN File Examples 
  8.6.1         Sample Program 1-Inquiry 
  8.6.2         Sample Program 2-Data Entry with Master Update 
  8.6.3         Sample Program 3-Maintenance 
  8.6.4         Sample Program 4-WORKSTN Subfile Processing 
  8.6.5         Sample Program 5-Inquiry by Zip Code and Search on Name 
  8.6.6         Sample Program 6-Program-Described WORKSTN File with a FORMAT Name on Output Specifications 
  8.6.7         Sample Program 7-Variable Start Line 
  8.6.8         Sample Program 8-Read Operation with Time-Out 

9.0           Chapter 9.  Data Field Formats and Data Structures 
9.1           Format of Fields in Files 
  9.1.1         Packed-Decimal Format 
  9.1.2         Zoned-Decimal Format 
  9.1.3         Binary Format 
    9.1.3.1       Program-Described File 
    9.1.3.2       Externally Described File 
  9.1.4         Signs 
    9.1.4.1       External Formats 
    9.1.4.2       Internal Format 
9.2           Data Structures 
  9.2.1         Format of Data Structure Subfields in Storage 
  9.2.2         Data Structure Statement Specifications 
    9.2.2.1       Rules for Specifying Data Structure Statements 
  9.2.3         Multiple Occurrence Data Structure 
9.3           Special Data Structures 
  9.3.1         Data Area Data Structure 
  9.3.2         File Information Data Structure 
  9.3.3         Program-Status Data Structure 
9.4           Data Structure-Subfield Specifications 
  9.4.1         Rules for Subfield Specifications 
9.5           Data Structure Examples 

10.0          Chapter 10.  Named Constants, Initialization, and SAA Data Types 
10.1          Named Constants 
  10.1.1        Rules for Named Constants 
10.2          Initialization 
  10.2.1        Initialization Subroutine (*INZSR) 
  10.2.2        CLEAR and RESET Operation Codes 
  10.2.3        Data Structure Initialization 
  10.2.4        Special Considerations for Initializing Data Structures 
  10.2.5        Rules for Initializing Subfields 
  10.2.6        Initialization and the Program Cycle 
  10.2.7        Initialization Examples 
10.3          SAA Data Types 
  10.3.1        Variable-Length Fields 
  10.3.2        Date, Time, and Timestamp Fields 
  10.3.3        DBCS-Graphic Data Type Support 
  10.3.4        Null Value Support 
  10.3.5        Error Handling for SAA Data Types 

11.0          Chapter 11.  Communicating with Objects in the System 
11.1          Calling Other Programs 
  11.1.1        CALL (Call a Program) 
  11.1.2        PLIST (Identify a Parameter List) and PARM (Identify Parameters) 
    11.1.2.1      Rules for Specifying PLIST 
    11.1.2.2      Rules for Specifying PARM 
  11.1.3        OS/400 Graphics Support 
  11.1.4        FREE (Deactivate a Program) 
11.2          Calling Special Subroutines 
  11.2.1        Message-Retrieving Subroutine (SUBR23R3) 
  11.2.2        SAA Common Programming Interface Support 
  11.2.3        Moving Bracketed Double-byte Data and Deleting Control Characters (SUBR40R3) 
  11.2.4        Moving Bracketed Double-byte Data and Adding Control Characters (SUBR41R3) 
11.3          Returning from a Called Program 
  11.3.1        A Normal End 
  11.3.2        An Abnormal End 
  11.3.3        Return without an End 
11.4          Data Areas 
  11.4.1        Program Initialization Parameters (PIP) Data Area 

12.0          Chapter 12.  Auto Report Feature 
12.1          Group Printing 
  12.1.1        Specifications 
  12.1.2        Examples 
12.2          /COPY Statement Specifications 
  12.2.1        Changing Copied Specifications 
    12.2.1.1      Changing File Description Specifications 
    12.2.1.2      Changing Input-Field Specifications 
12.3          Report Format 
  12.3.1        Spacing and Skipping 
  12.3.2        Placement of Headings and Fields 
    12.3.2.1      Page Headings 
    12.3.2.2      Reformatting *AUTO Page Headings 
    12.3.2.3      Body of the Report 
    12.3.2.4      Overflow of the D/T-*AUTO Print Lines 
12.4          Generated Specifications 
  12.4.1        Generated Calculations 
  12.4.2        Generated Output Specifications 
12.5          Programming Aids 
12.6          Using CRTRPTPGM to Compile an Auto Report Program 
  12.6.1        Using the CRTRPTPGM Command 
  12.6.2        CRTRPTPGM Command 
12.7          Examples of Using Automatic Report 
    12.7.1        EXAMPLE 1 - Sales Report 
    12.7.2        EXAMPLE 2 - Sales Report with Three Levels of Totals 
    12.7.3        EXAMPLE 3 - Sales Report with Group Indication 
    12.7.4        EXAMPLE 4 - Sales Report with Cross-Column Totals 
    12.7.5        EXAMPLE 5 - Sales Report Using Copied Specifications 
    12.7.6        EXAMPLE 6 - Override Copied Input Specifications 

13.0          Chapter 13.  RPG/400 Sample Programs 
13.1          Checklist of Program Examples 
  13.1.1        Database Design 
    13.1.1.1      Employee Master File 
    13.1.1.2      Project Master File 
    13.1.1.3      Reason-Code Master File 
  13.1.2        Transaction History Files 
  13.1.3        Data Area Control File 
  13.1.4        Master File Maintenance 
  13.1.5        Data Area Control File Maintenance 
  13.1.6        Time-File Entry 
  13.1.7        Weekly Time-File Update 
  13.1.8        Monthly Time-Entry File Reporting and Update 
13.2          Database Field Definition 
  13.2.1        Database Reference Master File - REFMST 
  13.2.2        Data Area Control File - CTLFIL 
  13.2.3        Employee Master File - EMPMST 
  13.2.4        Project Master File - PRJMST 
  13.2.5        Reason-Code Master File - RSNMST 
  13.2.6        Weekly Transaction Entry File - TRWEEK 
  13.2.7        Monthly Transaction Entry File - TRMNTH 
13.3          Time Reporting Menu Design 
13.4          Master File Maintenance 
  13.4.1        Master File Maintenance Display - PRG01FM 
    13.4.1.1      SELECT Format - Maintenance Selection 
  13.4.2        Employee Master Selection - EMPSEL Format 
  13.4.3        Employee Master Maintenance - EMPMNT Format 
  13.4.4        Project Master Selection - PRJSEL Format 
  13.4.5        Project Master Maintenance - PRJMNT Format 
  13.4.6        Reason Code Master Selection - RSNSEL Format 
  13.4.7        Reason Code Master Maintenance - RSNMNT Format 
  13.4.8        Master File Maintenance Data Descriptions - PRG01FM 
  13.4.9        Master File Maintenance RPG/400 program - PRG01 
13.5          Control File Maintenance 
  13.5.1        Control File Maintenance - PRG02FM 
  13.5.2        Control File Maintenance Data Descriptions - PRG02FM 
  13.5.3        Control File Maintenance RPG/400 Program - PRG02 
13.6          Time File Transaction Entry 
  13.6.1        Time Reporting Transaction Entry - PRG03FM 
    13.6.1.1      Employee Selection Display 
  13.6.2        Time Reporting Transaction Entry Data Descriptions - PRG03FM 
  13.6.3        Time Reporting Transaction Entry RPG/400 Program - PRG03 
13.7          Weekly Time File Update 
  13.7.1        Time File Entry Edit RPG/400 Program - PRG05 
  13.7.2        Weekly Employee Transaction Report Layout - PRG09 
  13.7.3        Master File Update and Weekly Transaction Report - PRG09 
13.8          Monthly Processing 
  13.8.1        Monthly Time File Update and Reporting 
  13.8.2        Time Reporting Employee Summary Report Layout - PRG06RP 
  13.8.3        Employee Summary Report Data Descriptions - PRG06RP 
  13.8.4        Employee Summary Report RPG/400 Program - PRG06 
  13.8.5        Time Reporting Project Summary Report Layout - PRG07RP 
  13.8.6        Project Summary Report Data Descriptions - PRG07RP 
  13.8.7        Project Summary Report RPG/400 Program - PRG07 
  13.8.8        Time Reporting Reason Code Summary Report Layout - PRG08RP 
  13.8.9        Reason Code Summary Report Data Descriptions - PRG08RP 
  13.8.10       Reason Code Summary Report RPG/400 Program - PRG08 
  13.8.11       Master File Monthly Update and Clear RPG/400 Program - PRG04 
13.9          Year End Processing 

A.0           Appendix A.  RPG Compiler and Auto Report Program Service Information 
A.1           Compiler Overview 
  A.1.1         Compiler Phases 
  A.1.2         Major Compiler Data Areas 
  A.1.3         Compiler Error Message Organization 
  A.1.4         Run-Time Subroutines 
A.2           Compiler Debugging Options 
  A.2.1         *SOURCE Value for the OPTION Parameter 
  A.2.2         *XREF Value for the OPTION Parameter 
  A.2.3         *DUMP Value for the OPTION Parameter 
  A.2.4         *LIST Value for the GENOPT Parameter 
  A.2.5         *ATR Value for the GENOPT Parameter 
  A.2.6         *XREF Value for the GENOPT Parameter 
  A.2.7         *DUMP Value for the GENOPT Parameter 
  A.2.8         *PATCH Value for the GENOPT Parameter 
  A.2.9         *OPTIMIZE Value for the GENOPT Parameter 
  A.2.10        ITDUMP Parameter 
  A.2.11        SNPDUMP Parameter 
  A.2.12        CODELIST Parameter 
  A.2.13        PHSTRC Parameter 
A.3           Examples of Using Compiler Debugging Options 
A.4           IRP Layout 
A.5           Auto Report Program 

B.0           Appendix B.  RPG/400 and AS/400 RPG II System/36-Compatible Functions 
B.1           Language Enhancements 

C.0           Appendix C.  Data Communication 
C.1           Exception and Error Handling with ICF Files 
C.2           Communications Error Recovery 

D.0           Appendix D.  Distributed Data Management (DDM) Files 

E.0           Appendix E.  System/38 Environment Option of the RPG Compiler 
E.1           Differences between System/38 RPG III and the System/38 Environment Option of the RPG Compiler 
E.2           Differences between the System/38 Environment Option of the RPG Compiler and RPG/400 Compiler 
E.3           File Types Supported by Each Compiler 

F.0           Appendix F.  Examples of Using Arrays 

G.0           Appendix G.  Glossary of Abbreviations 

BACK_1        Bibliography 

INDEX         Index 


Previous Topic Next Topic Copyright IBM Corp. 1994

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.