David M. Uptmor

   Exit from preview



MC Press Online

 View book pages:
 About this Book
»   Cover
    Copyright
    Dedication
    Acknowledgments
 
+
Contents
    Page 
 

 Buy this book:
  MC Press Online
  




 Modern RPG IV Language, The
by Robert Cozzi Jr.
    Feedback  Available purchase options     AddThis Social Bookmark Button

Bibliographic information

TitleModern RPG IV Language, The
AuthorRobert Cozzi Jr.
PublisherMC Press Online
Publication DateAugust 2006
SubjectComputer: Programming & Software Engineering
Pages713


Description 

Cozzi on everything RPG! What more could you want?

In this fourth edition of The Modern RPG IV Language, internationally recognized RPG expert Bob Cozzi takes his classic bestseller to a whole new level. At over 700 pages, this edition covers all the new functions and facilities available in V5R4 RPG IV while keeping the straightforward, no-nonsense style that has kept this book on the bestseller list for almost 20 years. This new edition is guaranteed to keep Bob Cozzi as the leading expert on RPG, and his book the one turned to by countless developers worldwide.

This edition of The Modern RPG IV Language is packed with new information including new, never-before published information on coding free-format RPG IV. Chapter 12 delves into free-format in detail as Bob discusses MOVE alternatives, date and time conversions, data structures, and more. And to give you even more exposure to free-format, he has converted many of the examples throughout the book to free-format code. Add to that XML, CGI, and subprocedure information, and you have a book that no "modern" RPG programmer can be without.

Even with all the new material, the basic concept of the book remains the same. As with previous editions, The Modern RPG IV Language, 4th Edition takes you through RPG IV from its foundation to its most advanced techniques. At the core of this book are its chapters on built-in functions and opcodes. In these chapters, Bob details each built-in function and opcode with syntax tables that give you all the information you need at a glance, plus examples to help you as you code.

This is much more than just a book on rules, however. Bob includes more than 400 charts and tables to show how those rules apply, and he provides more than 500 real-life code examples of functions and operations. You'll turn to this book again and again as you program in RPG IV. It is the quintessential reference for every RPG programmer.

What's New in This Edition?
  • Free-format syntax, including an entire chapter on this highly popular subject, as well as examples throughout the book
  • Expanded information on subprocedures
  • XML support, including new BIFs and opcodes
  • Web programming with RPG, including CGI APIs and URL encoding
  • Updated and revised content throughout the book to cover i5/OS V5R4

Within the pages of this book, you will find:
  • The basics of RPG IV, including data types, indicators, constants, and directives
  • Detail on all of the specification types
  • A complete discussion of expressions and how they should be used
  • Every built-in function
  • Every opcode
  • Options for organizing your program with source files, modules, and storage
  • A discussion on modern operation code optimization
  • An explanation of structured programming and how to apply it effectively in RPG
  • Instructions on how to code inter-module communications
  • Everything you need to know about procedures
  • An entire chapter on the alternate syntax options now available--most notably free-format




About the Author 

Robert Cozzi Jr. ---

Robert Cozzi, Jr., has been an RPG programmer since 1978. He is the author of several books on RPG programming, including The Modern RPG IV Language. Bob is Webmaster for the popular RPGWorld.com Web site and produces several RPG training events each year, including the annual RPG World Conference. His production company, Crooked Jaw Productions, produces the i5 TV and Shoot'n iT podcasts.

Over the years, Bob has consistently helped System i5 and RPG IV programmers to be more productive by creating and publishing tools, tips, and techniques for their programming arsenal. Bob's original publication, Q38 Technical Journal, had the tag line Providing the Solutions, and with his latest writings he continues to excel in that mission. For more information, visit Bob's Web sites: RPGWorld.com, MidrangeNews.com, and BobCozzi.com.




Contents 

PREFACE

Chapter 1: INTRODUCTION
POSITION-ORIENTED PROGRAM SPECIFICATIONS
A BRIEF LANGUAGE
SPECIFICATION TYPES
RPG COMPONENTS
RPG LIMITATIONS
NAMING CONVENTIONS
DATA TYPES
INDICATORS
INDICATOR USAGE
FUNCTION KEY ATTENTION IDENTIFICATION BYTE
INDICATOR CLASSIFICATION
INDICATORS TO AVOID
CONSTANTS AND LITERAL VALUES
OPERATION CODE ARGUMENTS
OUTPUT CONTROL VALUES
SUBROUTINE RETURN POINTS
DIRECTIVES

Chapter 2: SPECIFICATION FORMATS
SPECIFICATION TYPES
HEADER (CONTROL) SPECIFICATION
FILE SPECIFICATION
DEFINITION SPECIFICATION
INPUT SPECIFICATION
INPUT SPECIFICATION SUMMARY
CALCULATION SPECIFICATION
OUTPUT SPECIFICATION
PROCEDURE SPECIFICATION
EDITING NUMERIC OUTPUT
DATE EDIT CODE CONTROL SUMMARY
TABLE AND ARRAY SPECIFICATION

Chapter 3: EXPRESSIONS
EXPRESSIONS in RPG
NATURAL EXPRESSIONS

Chapter 4: BUILT-IN FUNCTIONS
BUILT-IN FUNCTION SYNTAX
BUILT-IN FUNCTION SYNTAX SUMMARY
%ABS (ABSOLUTE VALUE)
%ADDR (GET ADDRESS)
%BITAND (BITWISE ANDING OF VALUES)
%BITNOT (BIT INVERSION)
%BITOR (BITWISE ORING OF VALUES)
%BITXOR (BITWISE EXLUSIVE ORING OF VALUES)
%CHAR (CONVERT TO CHARACTER)
%CHECK (VERIFY FIELD CONTENT LEFT-TO-RIGHT)
%CHECKR (VERIFY FIELD CONTENT RIGHT-TO-LEFT)
%DATE (CONVERT TO DATE VALUE)
%DEC and %DECH (CONVERT TO PACKED DECIMAL)
%DECPOS (RETRIEVE DECIMAL POSITIONS)
%DIFF (DIFFERENCE BETWEEN TWO DATE, TIME, OR TIMESTAMP VALUES)
%DIV (INTEGER DIVISION)
DURATION BUILT-IN FUNCTIONS
%EDITC (EDIT WITH EDIT CODE)
%EDITFLT (EDIT WITH FLOATING POINT)
%EDITW (EDIT WITH EDIT WORD)
%ELEM (GET NUMBER OF ELEMENTS)
%EOF (END OF FILE STATUS)
%EQUAL (EQUAL CONDITION STATUS)
%ERROR (ERROR CONDITION STATUS)
%FIELDS (IDENTIFY FIELDS TO UPDATE)
%FLOAT (CONVERT TO FLOATING POINT VALUE)
%FOUND (RECORD/STRING FOUND CONDITION)
%GRAPHIC (CONVERT TO DOUBLE-BYTE CHARACTER VALUE)
%HANDLER (HANDLE XML PARSE REQUEST)
%HANDLER with XML-SAX
%INT (CONVERT TO INTEGER VALUE)
%KDS (USE A DATA STRUCTURE AS A KEY LIST)
%LEN (SET/GET LENGTH)
%LOOKUPXX (ARRAY ELEMENT LOOKUP [SEARCH])
%NULLIND (SET/GET NULL INDICATOR PROPERTY)
%OCCUR (SET/GET THE OCCURRENCE OF A DATA STRUCTURE)
%OPEN (CHECK FOR FILE OPEN CONDITION)
%PADDR (GET PROCEDURE ADDRESS)
%PARMS (GET PARAMETER COUNT)
%REM (INTEGER DIVISION, RETURN REMAINDER)
%REPLACE (REPLACE/INSERT CHARACTER STRING)
%SCAN (SCAN CHARACTER STRING)
%SHTDN (CHECK FOR SYSTEM SHUT DOWN OR JOB END REQUEST)
%SIZE (GET SIZE IN BYTES USED)
%SQRT (COMPUTE SQUARE ROOT)
%STATUS (FILE OR PROGRAM STATUS CODE)
%STR (GET/STORE NULL-TERMINATED C-STRING)
%SUBARR (SUBSCRIPT AN ARRAY)
%SUBDT (SUBSTRING DATE EXTRACT A DATE OR TIME COMPONENT)
%SUBST (GET/SET A SUBSTRING OF A VALUE)
%TIME (CONVERT TO TIME VALUE)
%TIMESTAMP (CONVERT TO TIMESTAMP VALUE)
%TLOOKUPxx (TABLE ELEMENT LOOKUP [SEARCH])
%TRIM, %TRIML, %TRIMR (TRIM LEADING AND/OR TRAILING BLANKS)
%UCS2 (CONVERT TO UCS-2)
%UNS and %UNSH (CONVERT TO UNSIGNED INTEGER VALUE)
%XFOOT (CROSS FOOT ARRAY ELEMENTS)
%XLATE (TRANSLATE CHARACTERS)
%XML BUILT-IN FUNCTION

Chapter 5: OPERATION CODES
ABBREVIATIONS USED THROUGHOUT THIS CHAPTER
OPERATION CODE SUMMARY
UNCONDITIONABLE OPERATION CODES
DATE AND TIME FORMAT CODES
DATE AND TIME DURATION CODES
OPERATION EXTENDER REFERENCE
RPG IV OPERATION CODE SUMMARY SYNTAX DIAGRAM LEGEND
OPERATION CODE SYNTAX DIAGRAMS
BOOLEAN OPERATION CODES
FREE FORMAT OPERATION CODES
NATURAL EXPRESSION OPERATION CODES
PROGRAM STATUS CODES
FILE-STATUS ERROR CODES
NESTED CODE ILLUSTRATION
FREE FORMAT NESTED CODE ILLUSTRATION
ACQ (ACQUIRE)
ADD (ADD NUMERIC)
ADDDUR (ADD DURATION)
ALLOC (ALLOCATE MEMORY)
ANDxx (AND CONDITION)
BEGSR (BEGIN SUBROUTINE)
BITOFF (SET BITS OFF)
BITON (SET BITS ON)
CABxx (COMPARE AND BRANCH)
CALL (DYNAMIC CALL TO ANOTHER PROGRAM)
CALLB (CALL A BOUND PROCEDURE/PROGRAM)
CALLP (CALL WITH PROTOTYPE)
CASxx (COMPARE AND PERFORM SUBROUTINE)
CAT (CONCATENATION)
CHAIN (RANDOM RECORD ACCESS/READ)
CHECK (VERIFY A CHARACTER STRING)
CHECKR (VERIFY RIGHT TO LEFT)
CLEAR (CLEAR DATA SET)
CLOSE (CLOSE A FILE)
COMMIT (COMMIT)
COMP (COMPARE)
DEALLOC (RELEASE ALLOCATED MEMORY)
DEFINE (DEFINE A FIELD OR DATA AREA)
DELETE (DELETE DATA FILE RECORD)
DIV (DIVIDE)
DO (BEGIN DO LOOP)
DOUxx (BEGIN DO UNTIL LOOP)
DOWxx (BEGIN DO WHILE LOOP)
DSPLY (DISPLAY WORKSTATION MESSAGE)
DUMP (PRINT FORMATTED DUMP)
ELSE (ELSE CLAUSE)
ELSEIF (ELSE IF CONDITIONAL COMPARISON)
ENDxx (END A GROUP)
ENDSR (END SUBROUTINE)
EVAL (EVALUATE AN EXPRESSION)
EVALR (EVAL, RIGHT-ADJUST)
EXCEPT (EXCEPTION OUTPUT)
EXFMT (WRITE/READ A WRKST FILE FORMAT)
EXSR (PERFORM SUBROUTINE)
EXTRCT (EXTRACT A PART OF A DATE)
FEOD (FORCE END OF DATA)
FOR (FOR LOOP)
FORCE (FORCE INPUT PRIORITY)
GOTO (GO TO)
IFxx (IF CONDITIONAL COMPARISON)
IN (READ IN A DATA AREA)
ITER (ITERATE A LOOP)
KFLD (KEY FIELD)
KLIST (KEY LIST)
LEAVE (LEAVE A DO GROUP)
LEAVESR (EXIT SUBROUTINE)
LOOKUP (LOOKUP ARRAY OR TABLE)
MONITOR (BEGIN A MONITOR GROUP)
MxxZO (MOVE ZONE TO ZONE)
MOVE AND MOVEL (COPY DATA)
MOVEA (MOVE WITH ARRAY)
MOVEL (COPY DATA LEFT JUSTIFIED)
MULT (MULTIPLY)
MVR (MOVE REMAINDER OF DIVISION)
NEXT (FORCE NEXT INPUT)
OCCUR (SET/RETRIEVE DS)
ON-ERROR (TEST ERROR STATUS CONDITION)
OPEN (OPEN A FILE)
ORxx (OR CONDITION)
OTHER (OTHERWISE)
OUT (OUTPUT AN EXTERNAL DATA AREA)
PARM (PARAMETER DECLARATION)
PLIST (PARAMETER LIST DECLARATION)
POST (POST DEVICE INFORMATION)
READ (READ FROM A FILE)
READC (READ NEXT CHNGD WRKSTN RCRD)
READE (READ NEXT RCRD WITH EQUAL KEY)
READP (READ PRIOR RCRD FROM DATA FILE)
READPE (READ PRIOR RCRD WITH EQ KEY)
REALLOC (REALLOCATE MEMORY)
REL (RELEASE AN ACQUIRED DEVICE FILE)
RESET (RESET VARIABLE TO INITIAL VALUE)
RETURN (RETURN TO CALLING PROGRAM)
ROLBK (ROLLBACK)
SCAN (SCAN STRING OR ARRAY)
SELECT (START IN-LINE CASE GROUP)
SETGT (SET GREATER THAN)
SETLL (SET LOWER LIMIT)
SETOFF (SET OFF AN INDICATOR)
SETON (SET ON AN INDICATOR)
SHTDN (TEST FOR SHUTDOWN REQUEST)
SORTA (SORT ARRAY)
SQRT (SQUARE ROOT)
SUB (SUBTRACT)
SUBDUR (SUBTRACT DURATION)
SUBST (SUBSTRING THEN MOVE LEFT)
TAG (LABEL)
TEST (TEST DATE/TIME/TIMESTAMP)
TESTB (TEST BIT PATTERN)
TESTN (TEST CHAR FIELD FOR NUM DATA)
TESTZ (TEST THE ZONE OF A FIELD)
TIME (RETRIEVE SYSTEM TIME AND DATE)
UNLOCK (UNLOCK DATA AREA)
UPDATE (UPDATE A FILE)
WHENxx (WHEN TRUE THEN SELECT)
WRITE (WRITE TO A FILE)
XFOOT (CROSS FOOT AN ARRAY)
XLATE (TRANSLATE A CHARACTER STRING)
XML-INTO (PARSE XML INTO RPG VARIABLE)
XML-SAX (CALL XML SAX PARSER)
Z-ADD (ZERO AND ADD)
Z-SUB (ZERO AND SUBTRACT)

Chapter 6: PROGRAM ORGANIZATION
SOURCE FILE LOCATION
SOURCE FILE MEMBER CONTENTS
MODULE DEFINITION
SCOPE
STATIC AND AUTOMATIC STORAGE
IMPORT AND EXPORT

Chapter 7: MODERN OPERATION CODE USAGE
OPTIMIZING
INDICATOR-CONTROLLED LOGIC
INDICATORLESS CONTROLLED LOGIC
DO LOOPS
DO WHILE and DO UNTIL Operations
COMPARE AND BRANCH
COMPARE OPERATION
RANGES, LISTS, AND SELECT/OMIT
RPG IV STYLE

Chapter 8: STRUCTURED PROGRAMMING
THE STRUCTURED APPROACH
THE IF-THEN-ELSE STRUCTURE
THE CASE STRUCTURE

Chapter 9: INTER-MODULE COMMUNICATION
BENEFITS OF MODULAR PROGRAMMING
COMMON TECHNIQUES FOR INTER-MODULE COMMUNICATION
PROTOTYPED CALL
DATA STRUCTURES AND PROTOTYPED PROCEDURES
DATA AREAS

Chapter 10: PROCEDURES
USER-WRITTEN PROCEDURES
CALLING A PROCEDURE
PROCEDURE DEFINITION
PROTOTYPED PROCEDURE KEYWORDS
PROGRAM ENTRY POINT
A SYSTEM INTERFACE FOR PROCEDURES

Chapter 11: FILE PROCESSING
FULL-PROCEDURAL FILE PROCESSING
PHYSICAL FILES
LOGICAL FILES
FILE ACCESS
ACCESS PATH PROCESSING
CHAIN (RANDOM FILE ACCESS)
OPEN AND CLOSE (OPEN AND CLOSE A FILE)
EXFMT (WRITE THEN READ WORKSTATION DEVICE)
POST (POST DEVICE SPECIFIC INFORMATION)
READ (READ A RECORD FROM A FILE)
READC (READ NEXT CHANGED SUBFILE RECORD)
UPDATE (UPDATE A RECORD)
WRITE (WRITE A RECORD)

Chapter 12: ALTERNATE SYNTAX OPTIONS
FIXED-FORMAT CALCULATION SPECIFICATIONS
ENHANCED-SPECIFICATIONS
FREE-FORMAT CALCULATION SPECIFICATIONS
FREE-FORMAT MOVE/MOVEL ALTERNATIVES
FREE-FORMAT SUBROUTINE DECLARATION

Chapter 13: WEB PROGRAMMING INTERFACES
CGI APPLICATION PROGRAMMING INTERFACE (API)
URL ENCODING

Appendix A COMPILER OPTIONS
Appendix B: DECIMAL DATA ERRORS
Appendix C: DDS DATE AND TIME FORMAT CONSIDERATIONS
Appendix D: SOURCE CODE LISTINGS



Other related titles: MC Press Online

Advanced, Integrated RPGAdvanced, Integrated RPG
Free-Format RPG IVFree-Format RPG IV
Functions in Free-Format RPG IVFunctions in Free-Format RPG IV
Functions in Free-Format RPG IVFunctions in Free-Format RPG IV
IBM System i APIs at WorkIBM System i APIs at Work
Mastering IBM iMastering IBM i
Programmer's Guide to iSeries NavigatorProgrammer's Guide to iSeries Navigator
Programming in RPG IVProgramming in RPG IV
Remote System Explorer, TheRemote System Explorer, The
RPG TnTRPG TnT
SQL for eServer i5 and iSeriesSQL for eServer i5 and iSeries
WDSC: Step by StepWDSC: Step by Step


 Other related titles:
Advanced, Integrated RPGAdvanced, Integrated RPG
Free-Format RPG IVFree-Format RPG IV
Functions in Free-Format RPG IVFunctions in Free-Format RPG IV
Functions in Free-Format RPG IVFunctions in Free-Format RPG IV
IBM System i APIs at WorkIBM System i APIs at Work
Mastering IBM iMastering IBM i
Programmer's Guide to iSeries NavigatorProgrammer's Guide to iSeries Navigator
Programming in RPG IVProgramming in RPG IV
Remote System Explorer, TheRemote System Explorer, The
RPG TnTRPG TnT
SQL for eServer i5 and iSeriesSQL for eServer i5 and iSeries
WDSC: Step by StepWDSC: Step by Step

 Already viewed books:
Modern RPG IV Language, TheModern RPG IV Language, The