× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: New Opcodes - %SETCELL
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 09 Sep 1999 18:13:26 -0500

John,

Please rest assured that I agree with you.  I wasn't disagreeing with
you, I explained where those numbers come from just in case you,
or someone else reading this list, wasn't aware of how it worked.

John P Carr <jpcarr@tredegar.com> wrote:
>
> What manual did you find the following in Scott??
>
> > If you look at a binary representation of this parameter, as its
> > stored in memory, you'll see that each time you add another one of
> > the O_xxx flags, you're turning on a bit.
> > i.e.,               100000000000000000000000 (8388608 in binary)

Manual?   Who reads manuals?  These things are just intuitive! :)
Actually, doing these things is a common practice in C programming,
and since I do some C programming, I recognized the same approach
in RPG.

Remember, the documentation for the Unix-type APIs says that you NEED
to work with them in C.  It doesnt even say that its possible in RPG,
probably because at the time, IBM didn't plan to support using RPG.

If IBM is not going to make BIFs for RPG to handle IFS functions,
they should create members in QSYSINC that has all of this defined
for the RPG programmer as well, and update the documentation to make
it RPG-friendly.  In this I am in total agreement with you.




> Here's what's in the  FCNTL member in the H source file in QSYSINC
>
> #define O_CODEPAGE   040000000  /* code page flag           */
> #define O_TEXTDATA  0100000000  /* text data flag                */
>
> How'd you make the magic leap of knowing the above is
> 8388608 ?    BTW,  are the above Octal by chance ?   Why
> yes they are !!  Now it's very intuitive to everyone to convert
> from Octal to Dec to make it work in RPG.
>
> << Makes perfect sense to me... >>   Feel lucky.

Well, you can't code things in octal (at least not directly) in RPG,
so you make it decimal, after all octal and decimal are just two
different ways to represent the same number.  Doesn't that seem
logical?

The big trick is just KNOWING that they are in octal!  Again, you
need RPG-friendly /copy members and documentation.   If there was
an FCNTL member in QSYSINC/QRPGLESRC (or perhaps a more appropriate
member name to RPG) this wouldn't be a problem, would it?

In fact, now that I'm on the subject, it frequently irritates me
that you can't assign a hexidecimal literal to a numeric variable.
Hex is a numeric representation!  It represents a NUMBER!  but you
can't assign it to a number, only a character :)

The Unix-Type API's were created, of course, to help people
migrate from UNIX to AS/400.   The primary programming language on
UNIX systems is C!   The documentation and /copy members is therefore
aimed at a C programmer.

IBM had to make this stuff available to C programmers, because they
wanted to advertise their C compiler as ANSI C compliant, and POSIX
compliant as well, I believe.

Its almost SCARY how much LESS functionality RPG has in its native
enviornment (without using APIs) than just the basic, STANDARD, C
enviornment!   Look at how many things you can do by calling stuff
out of the ILE C service programs that you couldn't previously do
in RPG!  And, of course, each PC or UNIX compiler has extensions to
the standards that give it even more functionality.

Of course, I've been saying this since 1993 when I first started
programming in C as well as RPG :)   At that time, I was stuck in
RPG III on V2R2.  That was really pathetic :)



> Having everyone say  "look into QSYSINC,  The layouts are in there"
> really help RPG programmers.
>
> And yes I knew what they meant.   Of course I did alot of research.
>
> BTW This timely question was just asked yesterday by Uwe Koch
>
> >Hi all,
> > i want to use the API's in QSYSINC but I don't have much
> > information to go on. I'm missing an Example in RPG or ILERPG
>
> He is obviously just beginning his search for understanding.
> His situation is exactly what I was talking about.
>
> "I don't have much information to go on"
>
> I think that said it all.

Agreed.  Of course, I could argue that Uwe also didn't bother to
give us enough information that we could attempt to help him. :)

Saying "I want to use APIs" without give us more information is
kind of like walking into a library and saying to a librarian
"I want to read a book."  How much can the librarian help you,
if you don't give more information than that?

Sorry, I know thats off-topic, but I've seen waaaayyy too many
of these vague questions, and its getting to be a pet peeve of
mine.

Back to the topic, tho...  if you want a "worst case scenario" to
help you make your point, John, look at the select() function in
the Sockets API.   Try to figure out how to use FD_SET, FD_ISSET,
FD_CLR in RPG!

Yes, I did figure out how to do these things.  In fact, I posted
my code for it here awhile back.  (Please don't send me examples.)

But is your average programmer going to EVER figure out how to do
that?  Much less understand what it does?

Hopefully this new Redbook will make it all clear :)

Scott
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.