|
Rob,
The big difference is that in RPG, it you do not specify you are
willing to handle exceptions, the system will do it for you. You
might not like how they are handled, but at least your program will
not continue to run in ignorent bliss.
In C, if you don't check your return codes, the stuff gets swallowed.
Experience in C (Both AS400 and Windows) has taught me to ALWAYS check
the return codes. Religiously.
As a result, C programs tend to devote a lot of code to this task.
Stuff the RPG pgmr takes for granted.
No what I really HATE is the programer who in RPG or CLP puts the
error indicator or monmsg in, but then does NOTHING with it! I no one
shop where every CL program had a program level MONMSG CPF0000. This
was because they didn't want programs to blow up. Instead, they would
just keep on booking. You know, copy master file to temp file, delete
orignial, copy temp back to original. Opps, the first copy
failed....so sorry, no master file anymore!
Bob
-----Original Message-----
From: Rob Berendt [SMTP:rob@dekko.com]
Sent: Wednesday, May 12, 1999 10:24 AM
To: MIDRANGE-L@midrange.com
Subject: RE: X-Spec (was: "RPG isn't cool")
I don't know C from shinola but some of the stuff you have in here is
stuff that many RPG programmers leave out. For example if they OPEN
the files themselves instead of using the cycle how many actually
evaluate the %error, (or indicator)? Me, I do something like
FRCML01......... usropn infds(rcmstatus)
...
D RCMstatus E DS extname(fileds) prefix(rcm)
...
C open(e) rcml01
C if %error
C eval filestatus=%status(rcml01)
C* write line to printer saying 'Error opening file Customer master,
rcml01, with a status code of xxxxx.
C write ErrRpt10
C endif
bob@cstoneindy.com on 05/12/99 09:33:14 AM
Please respond to MIDRANGE-L@midrange.com@Internet
To: MIDRANGE-L@midrange.com@Internet
cc:
Subject: RE: X-Spec (was: "RPG isn't cool")
I am not looking for "low level" file IO, but high level! Eg: Declare
the file, use the file. Like in RPG. To do Native database IO in
ILE/C this is what you have to do:
// Below "Declares the file". Equivilent to an "F" spec in RPG
#pragma mapinc("xfimghp", "*libl/xfimghp(*all)", \
"both key lvlchk", "d")
#include "xfimghp"
_RFILE *imghpf; /* XFIMGHP */
_RIOFB_T *imghpfbk;
// The below "Opens the file". Equivilent to "OPEN XFIMGHP" in RPG
imghpf = _Ropen("*libl/xfimghp", "rr, arrseq=N, blkrcd=Y");
if (imghpf == NULL)
{
printf("Error opening XFIMGHP - %s\n", XlateErrorNo(tBuf, errno));
return;
}
// Below are the actual record buffers. RPG "I" spec
FAXLIB_XFIMGHP_XFIMGHR_both_t imghp;
FAXLIB_XFIMGHP_XFIMGHR_key_t imghpKey;
// Below does a "Chain"
// cpystrchar converts "C" style string (null terminated) to
AS/400
fixed length char buffer
cpystrchar(imghpKey.IMNAME, hgi->ImageName, sizeof(imghpKey.IMNAME));
imghpfbk = _Rreadk(imghpf, &imghp, sizeof(imghp), __KEY_EQ |
__NO_LOCK,
&imghpKey, sizeof(imghpKey));
if (imghpfbk->num_bytes != sizeof(imghp))
ImgNotFoundFlag = TRUE; // Record not found (probably)
None of the above is rocket science, but it sure is a pain where the
sun don't shine!
Bob
-----Original Message-----
From: Joel Fritz [SMTP:JFritz@sharperimage.com]
Sent: Tuesday, May 11, 1999 5:20 PM
To: 'MIDRANGE-L@midrange.com'
Subject: RE: X-Spec (was: "RPG isn't cool")
Not a bad idea. How many out there think that low level file io in C
is as
easy as RPG? How about stream file io?
-----Original Message-----
From: Bob Crothers [mailto:bob@cstoneindy.com]
Sent: Tuesday, May 11, 1999 9:45 AM
To: 'MIDRANGE-L@midrange.com'
Subject: RE: X-Spec (was: "RPG isn't cool")
Instead of making RPG more like C, how about making C more like RPG?
Before everybody starts throwing flaming emails, stop and think about
it.
What is the best part of RPG? The Database IO. In RPG, it So easy to
use and very effective.
What is the bad part of RPG? The fixed form and highly structured
stuff. Short names. Etc.
What is the good part of "C"? Highly flexible, free form, multiple
data types, and stuff like that. What RPG is bad at.
What is the bad part of "C"? Database! The database support, well it
sucks. Hard to use...hard to manage...and harder to figure out!
But, the rest of "C" is very good. And, it is not hard for an RPG
programmer to learn C.
Then you don't have to worry about "breaking" RPG. And to give
descent Database to C, you only have to add some functions.
Just a thought...I'll go back into lurk mode.
Bob
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midr
ange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.