RPG TnT: 101 Dynamite Tips 'n Techniques with RPG IV - Softcover

Cozzi, Bob

 
9781583473641: RPG TnT: 101 Dynamite Tips 'n Techniques with RPG IV

Inhaltsangabe

Providing solutions to dozens of technical dilemmas, this guide features 101 tips for evaluating and circumventing RPG IV's shortcomings to help end users create extensions and program features that are not available through standard RPG IV—the primary programming language used for business application development on IBM's midrange computer systems. Using nearly 20 years of AS/400, iSeries, and System i experience, the author's insights into RPG IV extensions and System i MI instructions allow even the most inexperienced programmer to implement wrappers using code directly from the book.

Die Inhaltsangabe kann sich auf eine andere Ausgabe dieses Titels beziehen.

Über die Autorinnen und Autoren

Bob Cozzi has been an RPG programmer since 1978 and is the author of Introduction for RPG IV and The Modern RPG IV Language. He lives in North Aurora, Illinois.


Bob Cozzi has been an RPG programmer since 1978 and is the author of Introduction for RPG IV and The Modern RPG IV Language. He lives in North Aurora, Illinois.

Auszug. © Genehmigter Nachdruck. Alle Rechte vorbehalten.

RPG TnT

101 Dynamite Tips 'n Techniques with RPG IV

By Bob Cozzi

MC Press

Copyright © 2007 Robert Cozzi, Jr.
All rights reserved.
ISBN: 978-1-58347-364-1

Contents

Title Page,
Copyright Page,
Dedication,
Acknowledgments,
Conventions Used in this Book,
1 - Prototype Everything,
2 - Prototyping a Call to a Program,
3 - An Alternative to QCMDEXC,
4 - Subprocedure-style Entry Parameter List for Programs,
5 - Add NOMAIN to the Header Specification of Secondary Modules,
6 - Monitoring C Function Runtime Errors,
7 - Use PSDS to Retrieve Job Information,
8 - Use QUALIFIED Data Structures,
9 - Copy Subfields Between Qualified Data Structures,
10 - Nested Data Structures,
11 - *ALL and *ALLX 'xx' — The Repeating Constants,
12 - Embed Compiler Parameters into Source Members,
13 - Avoid "Surprise Initialize",
14 - Qualified Externally Described Files (1),
15 - Qualified Externally Described Files (2),
16 - Calculate the End-of-Month Date,
17 - Using Free-Format Comments in Fixed-Format Code,
18 - Get Day-of-Week Name,
19 - Run CL Commands from an FTP Client,
20 - Put Your Program to Sleep,
21 - Use VARYING to Improve Performance,
22 - Converting Numeric to Character with %CHAR,
23 - Converting Character to Numeric,
24 - Easier Text Concatenation,
25 - Create an Auto-Extend User Space,
26 - Declare Data Structures as Arrays,
27 - Initialize Fields to Job Date, System Date, or User Profile,
28 - Use C Runtime Functions in RPG,
29 - Compare and Ignore Case,
30 - Free Online Prototypes for APIs, C Functions, MI Instructions,
31 - Checking for Valid Dates with the TEST OpCode,
32 - Using the Secret 'X' Edit Code to Convert Numeric to Character,
33 - %ADDR — Address of a Variable,
34 - Understanding API Documentation — Bin(4) Parameters,
35 - Understanding API Documentation — Pointer Parameters,
36 - Better Performance when Accessing User Space Data,
37,
38 - Sending a Program Message in RPG,
39 - Retrieve the Function Key Used on a Display File,
40 - Copying More than 64k of Data,
41 - Use %XFOOT with %LEN,
42 - Use %SUBARR to Subscript Arrays,
43 - Use EXTFILE to Avoid Needless Overrides,
44 - Subprocedure Parameters Rule 1 — Default Behavior,
45 - Subprocedure Parameters Rule 2 — CONST Parameters,
46 - Subprocedure Parameters Rule 3 — VARYING,
47 - Subprocedure Parameters Rule 4 — Optional Parameters,
48 - Subprocedure Parameters Rule 5 — Skipping Parameters,
49 - Data Structure Templates,
50 - Boolean Assignment,
51 - Creating Even-Length Packed Fields,
52 - Sorting Arrays with SubArrays,
53 - Convert between Lower- and Uppercase Letters,
54 - Overlapping Data Structures,
55 - Dynamic Arrays — Dynamically Allocated Array Elements,
56 - Converting Date Formats with the QWCCVDT API,
57 - Converting Date Formats with the CEExxxx APIs,
58 - Calculated Day of Week — Zeller's Congruence,
59 - Calculated Day of Week — API Method,
60 - LIKE Keyword Misbehavior — Zoned to Packed,
61 - Default Data-type: Not So Consistent,
62 - Debugging Variables that Have Debugger Command Names,
63 - Viewing Field Contents in Hex in Debug,
64 - Display the First Few Bytes During Debug,
65 - Display Contents of Local Variables with %LOCALVAR,
66 - Convert Character to Numeric — Using MI,
67 - Converting To and From Hexadecimal,
68 - Using Decimal Fields as Real-Date Values,
69 - Check Object Existence,
70 - Supporting Qualified Object Syntax,
71 - Explained: Bytes Provided, Bytes Available, and Bytes Returned,
72 - Converting To or From ASCII and Other Character Sets,
73 - Register an Exit Routine for a Program or Service Program,
74 - Specifying IFS File Names Correctly,
75 - Checking if IFS Files Exist,
76 - RC4 Encryption Using Encryption APIs,
77 - Writing Text to the Joblog,
78 - Reading Save Files with RPG IV,
79 - Encrypting Save Files in RPG IV,
80 - Global and Local Variables,
81 - Create Source Members Used to Create Service Programs,
82 - Binder Source for a Service Program,
83 - Creating Binder Language the Easy Way,
84 - Linking to a Service Program from an RPG IV Program,
85 - Swap Bytes — Big Endian to Little Endian in RPG IV,
86 - Dumping the Call Stack with QpØzDumpStack,
87 - Using Subprocedure Return Values,
88 - How Does the %EDITC (Edit Code) Built-in Function Work?,
89 - Solid Parameter Testing,
90 - Create ASCII Text Files on the IFS,
91 - High-level Math in RPG IV,
92 - Program Described Print File with Dynamic Spacing,
93 - Aligning or Centering Text in a Character Field,
94 - Debug a Batch Job,
95 - Find and Replace with Regular Expressions,
96 - Use DLTOVR when Using OVRDBF OVRSCOPE(*JOB),
97 - Use a FOR Loop to Allow Multiple Exit Points,
98 - Source-level Debugger for Legacy RPG III,
99 - Set and Get Environment Variables from within RPG IV,
100 - Simple Scan with Ignore Upper/Lowercase,
101 - Set the CLASSPATH for Java within RPG IV,
Epilogue,
Appendix - Source Member RPGTnT in QCPYSRC,


CHAPTER 1

Prototype Everything


Prototypes are the basis for call operations in RPG IV. Without prototypes you cannot call a program, subprocedure, or API using either free format or hybrid fixed format. The old call/parm opcodes have been deprecated in RPG IV and should no longer be used.

A prototype is simply a declaration of "stuff" used by the compiler. At compile-time, the compiler uses the prototype to check the syntax in your call to a program, subprocedure, or API. It does this to ensure that the data for the parameters of the call are specified correctly.

A prototype begins with the so-called PR statement. This is a Definition specification that identifies the name of the prototype and optionally, the name of the program or subprocedure being called, as follows:

D GetBalDue PR 7P 2

As illustrated, the prototype name in positions 7 to 21 of the Definition specification indicates the name of the prototype and not the name of the subprocedure that is evoked when the prototype is called. Without additional coding, a prototype defaults to a subprocedure with the same name as the prototype. Therefore, the prototype in the example above is used to call a subprocedure named GETBALDUE.

But what about when a different subprocedure should be evoked when GETBALDUE is called?

The EXTPROC keyword must be included in the prototype when a subprocedure whose name is different from the prototype is being called. For example, if the subprocedure to be evoked is named RTVCSTBAL, the following prototype statement could be used:

D GetBalDue PR 7P 2 EXTPROC('RTVCSTBAL')

Subprocedures and programs may be prototyped. To control whether a program or subprocedure is evoked when the prototyped is called, specify the EXTPGM for program calls and EXTPROC for subprocedure calls.

If the EXTPROC and EXTPGM keywords are not specified, EXTPROC is implied, and the name of the prototype is used as the name of the subprocedure to evoke. The EXTPGM keyword indicates...

„Über diesen Titel“ kann sich auf eine andere Ausgabe dieses Titels beziehen.

Weitere beliebte Ausgaben desselben Titels

9781583041215: RPG TNT: 100 Dynamite, Tips 'n Techniques With Rpg IV

Vorgestellte Ausgabe

ISBN 10:  1583041214 ISBN 13:  9781583041215
Verlag: 29th Street Pr, 2007
Softcover