Die Inhaltsangabe kann sich auf eine andere Ausgabe dieses Titels beziehen.
Title Page,
Copyright Page,
Dedication,
ACKNOWLEDGMENTS,
PREFACE TO THE FOURTH EDITION,
Chapter 1 - INTRODUCTION,
Chapter 2 - SPECIFICATION FORMATS,
Chapter 3 - EXPRESSIONS,
Chapter 4 - BUILT-IN FUNCTIONS,
Chapter 5 - OPERATION CODES,
Chapter 6 - PROGRAM ORGANIZATION,
Chapter 7 - MODERN OPERATION CODE USAGE,
Chapter 8 - STRUCTURED PROGRAMMING,
Chapter 9 - INTER-MODULE COMMUNICATION,
Chapter 10 - PROCEDURES,
Chapter 11 - FILE PROCESSING,
Chapter 12 - ALTERNATE SYNTAX OPTIONS,
Chapter 13 - WEB PROGRAMMING INTERFACES,
Appendix A - COMPILER OPTIONS,
Appendix B - DECIMAL DATA ERRORS,
Appendix C - DDS DATE AND TIME FORMAT CONSIDERATIONS,
Appendix D - SOURCE CODE LISTINGS,
INTRODUCTION
RPG is both a position-oriented and free-format language. This means that certain information, such as control codes and field names, must be placed into specific positions of the RPG program statements. Failure to fulfill this obligation results in an error message. The free-format component of RPG IV is supported in the procedure area (known as the calculation specifications) and to a lesser extent in a keyword area of the data definition.
In a free-form procedure language such as COBOL, the value of one variable (or "field") can be copied to another by specifying the following statement:
MOVE FIELDA TO FIELDB
Most high-level languages use the MOVE instruction to copy data. There is no documentation as to how this tradition started, but it's taken for granted now. The preceding COBOL statement copies each character from the memory location of the first field, FIELDA, to the memory location of the second field, FIELDB.
The same program statement written in C or C++ might look like this:
strcpy(fieldbm fielda);
In traditional RPG programs, the same program statement looks like this:
[PROGRAM LISTING NOT REPRODUCIBLE IN ASCII]
Using free-format RPG IV commands, the same program statement could look like this:
[PROGRAM LISTING NOT REPRODUCIBLE IN ASCII]
Or like this:
[PROGRAM LISTING NOT REPRODUCIBLE IN ASCII]
The three forms of RPG IV statements shown above are referred to as fixed format, columnar expression format (sometimes called "hybrid free -format"), and free format. The first two styles of coding are referred to as "Traditional RPG IV" and the third style is often referred to as "/free" or "free -format." This is because the free-format style was added much later in the life of RPG IV. The field being copied (FIELDA) is referred to as the source field. The field that receives the data is referred to as the target or result field.
The MOVE and EVAL instructions appear in positions 26 through 35. These positions contain the program instruction or operation code. The operation code is commonly referred to as operation or opcode.
The letter "C" must appear in position 6 of RPG "Calculation" statements, except when using free-format; in that case position 6 must be blank. Different letters are used to identify the various types of program statements (or specifications). The available specifications are:
* Header specification. * File specifications. * Definition specifications. * Input specifications. * Calculation specifications. * Output specifications. * Procedure specifications.
Ordinarily, an editor is available that provides prompting for "fill-in-the-blank" coding of the different RPG specifications. Consequently, programmers need not be concerned with remembering specific positions. However, a thorough knowledge of the various specification types and their layout will greatly improve programmer efficiency.
Another example of the position-oriented structure of RPG follows. Suppose three account totals need to be accumulated. In a free-format procedure language such as PL/I, the program statements look like the source code shown in Figure 1.1.
In traditional RPG, the equivalent program looks like the code shown in Figure 1.2.
In this example, the IF operation is used to compare the field ACCT to three numbers, and then the value of the field AMOUNT is added to one of three total fields.
RPG requires an associated ENDIF operation for each IF operation. This is because IF operations are treated as an IF-THEN-DO structure. This allows several statements to be conditioned and performed for each IF operation. As a by-product, the program's complexity is reduced. However, when IF statements are nested too deeply (usually more than three levels deep) the program's readability is reduced. Readability can be improved greatly, however, through the use of an in-line case structure. RPG support two forms of in-line case. The first is the SELECT-WHEN operations. The source code shown in Figure 1.2 — rewritten using the SELECT-WHEN operations — is illustrated in Figure 1.3a.
The second form of in-line case is the IF statement itself. However, later versions of RPG include a new ELSEIF operation that eliminates the need for multiple ENDIF statements. The source code shown in Figure 1.2 — rewritten using the SELECT-WHEN operations — is illustrated in Figure 1.3b.
The primary difference between these three examples is readability. The SELECT-WHEN requires only one ENDSL statement for the entire case group. The IF/ELSEIF style also requires only one ENDxx statement. The SELECT-WHEN operations are available on all versions of RPG, whereas the IF/ELSEIF option (Figure 1.3b) is only available on later releases of RPG.
POSITION-ORIENTED PROGRAM SPECIFICATIONS
To simplify writing RPG programs, various preprinted specification forms are available. These forms allow an application program to be written while making certain the correct positions are used. The source statements that make up an application program are transferred to the computer for compilation. This process,known as desk coding, was very popular before the onslaught of desktop personal computers, with their full-screen editors, as well as the full-screen editor available with the OS/400 operating system.
Very little desk coding is done any longer. Programmers usually write pseudocode (a free-format, English-like, logic-based language that is not compiled). The pseudocode is translated, by hand, into a high-level language. Pseudocode strongly resembles PL/I. When translating pseudocode into a high-level language, such as RPG, a full-screen editor or integrated development environment (IDE) is used to provide a more productive environment with fewer typing errors. This can result in fewer errors being placed into the source program.
Several full-screen editors are available to the RPG programmer, including CodeStudio, a GUI Microsoft Windows-based IDE for RPG and DDS; SEU, the source editor that comes with OS/400; and the GUI-based IDE offered by IBM. These source-code editors provide prompts that allow RPG program statements to be written easily. The editors correctly format the program statement to match the RPG specification.
A programmer with experience writing RPG programs using 80-position cards on an IBM 029 or 129 keypunch machine will appreciate using an online, full-screen editor or IDE that checks the syntax of...
„Über diesen Titel“ kann sich auf eine andere Ausgabe dieses Titels beziehen.
Anbieter: HPB-Red, Dallas, TX, USA
Paperback. Zustand: Good. Connecting readers with great books since 1972! Used textbooks may not include companion materials such as access codes, etc. May have some wear or writing/highlighting. We ship orders daily and Customer Service is our top priority! Bestandsnummer des Verkäufers S_452808300
Anzahl: 1 verfügbar
Anbieter: ThriftBooks-Dallas, Dallas, TX, USA
Paperback. Zustand: Fair. No Jacket. Readable copy. Pages may have considerable notes/highlighting. ~ ThriftBooks: Read More, Spend Less. Bestandsnummer des Verkäufers G1583470646I5N00
Anzahl: 1 verfügbar
Anbieter: Toscana Books, AUSTIN, TX, USA
Paperback. Zustand: new. Excellent Condition.Excels in customer satisfaction, prompt replies, and quality checks. Bestandsnummer des Verkäufers Scanned1583470646
Anzahl: 1 verfügbar
Anbieter: Lucky's Textbooks, Dallas, TX, USA
Zustand: New. Bestandsnummer des Verkäufers ABLIING23Mar2811580071578
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPrices, Columbia, MD, USA
Zustand: New. Bestandsnummer des Verkäufers 4389624-n
Anzahl: Mehr als 20 verfügbar
Anbieter: California Books, Miami, FL, USA
Zustand: New. Bestandsnummer des Verkäufers I-9781583470640
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPrices, Columbia, MD, USA
Zustand: As New. Unread book in perfect condition. Bestandsnummer des Verkäufers 4389624
Anzahl: Mehr als 20 verfügbar
Anbieter: BennettBooksLtd, San Diego, NV, USA
paperback. Zustand: New. In shrink wrap. Looks like an interesting title! Bestandsnummer des Verkäufers Q-1583470646
Anzahl: 1 verfügbar
Anbieter: GreatBookPricesUK, Woodford Green, Vereinigtes Königreich
Zustand: New. Bestandsnummer des Verkäufers 4389624-n
Anzahl: Mehr als 20 verfügbar
Anbieter: GreatBookPricesUK, Woodford Green, Vereinigtes Königreich
Zustand: As New. Unread book in perfect condition. Bestandsnummer des Verkäufers 4389624
Anzahl: Mehr als 20 verfügbar