Welcome to the RPG Development team blog |
Performance tip
Here is the tip: Beware of performance tips For me, the performance rule that never changes is this one: Always question any rule you hear about X performing badly, or Y performing better than Z. Was it ever true? Is it still true? Might it change in the future? Can I measure the difference? Does it apply to my current situation? Does the difference matter enough to code in a more complex or error-prone way? The trouble with performance rules is... [Continue Reading]
Tags:  rpgcafe |
What is Web 2.0?
If you are in the Toronto area, the Toronto User Group TEC 2009 conference starts next week Tue (Mar 24-26) For those curious about Web 2.0, latest trends, and how it can be consumed or produced on IBM i, George Papayiannis and myself will be presenting a session called "What is Web 2.0?" Tue @2:55.
Tags:  blogs social_networking wikis atom rpgcafe twitter web2.0 rss ajax mashups ibm_i |
Notes from RPG & DB2 Summit in Orlando
Orlando Summit is almost over. Except for the (not unexpected) lower attendance, it has been an excellent Summit. The Summit attendees are always very motivated to learn; almost all of them attend a session in every available time slot. Over 80% of them even attend the 8 am "early bird" sessions. That's dedication. But if possible, everyone here seemed even more motivated to learn than usual. People asked more questions (and more... [Continue Reading]
Tags:  rpgcafe rpg summit rtci |
Everyone should be coding the CCSID(*CHAR) keyword
The problem Strange but true: By default, RPG assumes that the CCSID of alphanumeric data is the mixed double-byte + single-byte CCSID that is related to the job CCSID. This matters when all of the following conditions are met (very common) the actual job CCSID is a single-byte CCSID such as 37 (quite common) conversions are done between alphanumeric data and UCS-2 data (rare) the alphanumeric data contains shift characters (x'0E' or x'0F')When... [Continue Reading]
Tags:  ccsid rpg rpgcafe |
From ENDDO to LIKEFILE - my 20th RPG anniversary
Today is the 20th anniversary of my arrival at IBM and also my arrival in the AS/400 RPG Compiler Development department. The day I arrived, almost everyone was on vacation - there were only 3 other people working. It was near the end of development for V1R3. My first couple of days were spent on an off-site RPG II self-study course, with no actual computer but only coding sheets to work with. Much of my time was spent scratching my head... [Continue Reading]
Tags:  rpg rpgcafe |
RPG's "Move fields" logic, and its cousin EVAL-CORR
One of the cool features of RPG is the "move fields" logic where data is moved from input buffers to program fields and from program fields to output buffers. Most RPG programmers don't think of this as cool - it is so fundamental to RPG that RPG programmers take it for granted. When the RPG programmer defines a file in the RPG source, the compiler implicitly generates an internal program field for each field in the file, and the compiler also... [Continue Reading]
Tags:  rpg rpgcafe |
Everyone knows what X'7D' means ... unfortunately
cmd = 'ADDPFM LIB/FILE MBR(' + mbr + ') ' + 'TEXT(' + X'7D' + text + X'7D' + ')'; Unfortunately, I think too many RPG programmers know what X'7D' means. I don't know how it happened that it's considered normal to code X'7D' when a single quote is wanted in an RPG program, but it's a very common coding technique. RPG already has syntax for a single quote character. Similar to 'A' being a single A character, you code '''' for a single quote... [Continue Reading]
Tags:  rpgcafe rpg quote |
An H spec keyword that you might be missing
CCSID(*CHAR : *JOBRUN) Do you have this keyword in your H spec copy file that gets copied into all your source? Or if you don't use a copy file, do you have this option in all your source? You should almost certainly have this keyword. It was introduced officially in V5R3, and through PTFs in V5R1 and V5R2. Why do you need this keyword? RPG has a very strange default way of dealing with the CCSID of alphanumeric data. It should be assuming that... [Continue Reading]
Tags:  rpgcafe rpg |
Is debug active? Here's a procedure that tells you
Do you ever want some code to run only when the debugger is active? Here's a procedure you can call to find out: Test program /copy indebug
/free
if inDebug();
dsply ('The debugger is active');
else;
dsply ('The debugger is not active');
endif;
return;
Member INDEBUG_PR containing the prototype /if not defined INDEBUG_INCLUDED
D inDebug pr n extproc('inDebug')
/define... [Continue Reading]
Tags:  rpgcafe debug |
PTFs to make it easier to use data structures for subfile I/O
During testing for Open Access, we were reminded of how awkward it is to use a data structure for I/O to subfiles. Subfiles always use the WRITE operation and at least one of either the CHAIN or READC operations, and possibly the UPDATE operation. This requires a *INPUT data structure and a *OUTPUT data structure. This isn't unique to subfiles; it's a problem for any record that is used for both input and output. But it's always a problem for... [Continue Reading]
Tags:  subfile rpgcafe |
PCML support for Date, Time, Timestamp and 8-byte unsigned
There is a thread in the JTOpen/Toolbox forum about PCML support for Date, Time, and Timestamp. Late in 2010, the toolbox itself announced support for these types, in version 6.0 of PCML. http://www-912.ibm.com/j_dir/JTOpen.nsf/%28$All%29/7589FDA21CB026B3862576170058B28A?OpenDocument Now there's some further progress on this. See my response to the thread, about RPG compiler support (and a general comment about upcoming IWS support). ... [Continue Reading]
Tags:  rpgcafe pcml |
New site for Rational Developer for Power demos, cool Screen and Report Designer vide
 Great news everybody, The development team for Rational
Developer for Power have been very busy producing videos and demos to
illustrate how to install configure, use projects, edit, navigate
source, validate, build, debug on our supported languages on IBM i, AIX,
and Linux. The IBM i demos are just getting started, but check out the very slick demos of Screen and Report Designer. You will learn trick and techniques in becoming even... [Continue Reading]
Tags:  videos rational-ac-em rational-ac rdpower ibmi enablement rational-ac-power-app-mod... rational-ac-power-dev demos dds resource em |
Which is better, a return code or an exception?
When writing a procedure that might want to indicate an error condition, you have three choices: You can use the return value to indicate success or failure, you can have a separate "return code" parameter, or you can send an exception to indicate failure. Using exceptions rather than return codes leads to the most robust applications, and an exception based application can also give the cleanest code, since return codes... [Continue Reading]
Tags:  rpg_cafe |
Negative variable names
I don't know whether it's my own mental defect, or if it's more universal, but I find it awkward to understand code using variables that mean something negative. I find I have to exercise my brain more to understand the first "IF" than the second in the following two snippets of code. My brain freezes up just a little bit when it tries to understand setting notValid to off. But it has no trouble understanding setting isValid... [Continue Reading]
Tags:  rpgcafe |
New keyword VALIDATE(*NODATETIME)
A new H spec keyword, VALIDATE(*NODATETIME), is added for 6.1 and 7.1 through RPG compiler PTFs. The keyword indicates that date/time/timestamp validation will not necessarily be performed. A side-effect of this (and the reason for it) is that if validation is not required, there are some cases where d/t/z data can be treated as though it were alphanumeric data, making assignments and comparisons much faster. See this page in the RPG Cafe wiki... [Continue Reading]
Tags:  rpgcafe |
V1R1M1 of Open Access allows try and buy
I was on vacation when IBM announced the V1R1M1 of the Open Access product 5733-OAR, so I'm a bit late mentioning it here in the Cafe. Â This is exciting for me because it allows try-and-buy, so RPG programmers will be able to try Open Access for up to 70 days without having to actually purchase the product. Other than the licensing change, there's nothing new in V1R1M1. Open Access behaves the same at compile-time and runtime whether you have... [Continue Reading]
Tags:  openaccess rpgcafe |
A couple of articles about using Open Access with database IO
I'm always pleased to see articles about Open Access, and especially articles that show how Open Access can be used for more than modernizing a user interface (WORKSTN files). Here are a couple of articles about Open Access being used for SQL database access (DISK files). Â Here's an article by Daniel Cruikshank of IBM about using Open Access to take advantage of programming techniques only available via SQL programming, using RPG I/O opcodes.... [Continue Reading]
Tags:  openaccess rpgcafe |
Open Access to be available to all RPG programmers!
This is a very exciting day for me. Today, IBM announced that PTFs will soon be available to make the function of Open Access available without needing a license for product 5733-OAR. Â For those of you who have not tried Open Access yet, I hope you will try it when the PTFs become available, and that you have as much fun as I have had exploring what you can do with it. Open Access is intended to be used for much more than modernize your WORKSTN... [Continue Reading]
Tags:  rpg open_access oar |
The Open Access PTFs are now available
The Open-Access PTFs are all available. The PTF details are here: RPG Cafe wiki: Open Access Announcement
Tags:  open_access rpg ptfs |
Why use the TEMPLATE keyword?
The TEMPLATE keyword was added to RPG in 6.1. When you use the TEMPLATE keyword on a standalone field or data structure, the compiler will only allow you to use that definition for other LIKE or LIKEDS definitions, and for a couple of built-in functions, %SIZE and %ELEM. Â Prior to 6.1, when people wanted to define a field or data structure to
be used as a template, they often defined it as BASED on a pointer,
where the pointer would never be... [Continue Reading]
Tags:  rpg_cafe |
Have you tried passing a file as a parameter yet?
If you haven't tried file parameters yet (new in 6.1 for RPG), check out this article Sharing In V6 ( http://www.itjungle.com/fhg/fhg032112-story01.html ), by Jon Paris, in the Four Hundred Guru ( http://www.itjungle.com/fhg/fhgindex.html ).
Tags:  rpgcafe |
New H spec keyword CCSIDCVT
A new H spec keyword, CCSIDCVT, is added through PTFs for 6.1 and 7.1. For full details, see http://ibm.biz/BdxXWJ . Â The main reason for this keyword is so that RPG programmers can be aware of data loss due to CCSID conversions. Data loss occurs when a character in the source data doesn't have a matching character in the target character set. This happens most commonly when converting from UCS-2 to alphanumeric or DBCS. Â You can use... [Continue Reading]
Tags:  ccsidcvt rpgcafe ccsid |
RPG tutorial for experienced programmers new to RPG |
Article by Scott Hanson: Debug those mysterious problems with your application's memory |
If you formerly followed the RPG Cafe forum, you have to re-follow the migrated forum
As you may know from seeing the notices posted on developerWorks in the past few months, the developerWorks forums were recently migrated to IBM Connections. Unfortunately, the "follow" information could not be migrated, so you have to re-follow the new version of the forums you were following. To follow a Connections forum, click on "Following actions" near the top right of the forum page, and then click on "Follow this... [Continue Reading]
|
Which is better? Divide by 2 or multiply by 0.5?
I recently got a note from Ted Holt of Four Hundred Guru asking whether the old rule about multiplication being faster than division still applies for RPG on IBM i. For example, if you want to divide by two, this rule suggests that you should instead multiply by 0.5. I have known of this rule for a long time, and I have been automatically following it, without wondering whether it was still necessary. I was reminded of of... [Continue Reading]
|
Did you ever get weird errors after you called an API?
Here are the top 3 mistakes I see people make that can cause storage corruption. Storage corruption can then cause strange and sometimes intermittent errors to occur. Mistake: Not passing the feedback parameter for CEE APIs When the API documentation says a parameter is "omissible", it means you can pass *OMIT as the parameter. It doesn't mean you can completely leave it out. On your RPG prototype, code OPTIONS(*OMIT). When you pass... [Continue Reading]
|
New version of the wiki article on converting C prototypes to RPG
The article on converting C prototypes to RPG has had a major overhaul. https://ibm.biz/BdxQbC The old version was written from a pre-V5R1 perspective, with some remarks about post V5R1 or 6.1 coding. The new version is written from a 6.1 perspective, using QUALIFIED and TEMPLATE as a matter of course, with some side remarks about how to handle TEMPLATE in pre-6.1 coding. All the discussion about pre-V5R1 coding has been removed. Also, the... [Continue Reading]
|
Coming soon to your 7.1 system: An entire program in free-form RPG!
Yes, I really mean that you will be able to write an entire program in free-form RPG! Yes, I really mean that it is coming soon! Yes, I really mean that it is for 7.1! As part of Technology Refresh 7, the ILE RPG compiler will be updated with support for free-form H, F, D, and P specs. Read more about this enhancement here, in the RPG Cafe wiki:... [Continue Reading]
Tags:  rpgcafe rpg_cafe rpgfree rpg |