|
Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxx
You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."
*** NOTE: When replying to this digest message, PLEASE remove all text
unrelated to your reply and change the subject line so it is meaningful.
Today's Topics:
1. Socket programming in RPG (C runtime) and IPv6 (DeLong, Eric)
2. Re: Socket programming in RPG (C runtime) and IPv6 (Scott Klement)
3. XML-INTO (just need a quick answer)... (dmosley@xxxxxxxxxx)
4. Initialisation of global variables between calls (David FOXWELL)
5. AW: Initialisation of global variables between calls
(Birgitta Hauser)
6. RE: Initialisation of global variables between calls
(Schmidt, Mihael)
7. Re: How to read and or statement (Charles Wilt)
8. RE: Initialisation of global variables between calls
(David FOXWELL)
9. RE: How to read and or statement (David FOXWELL)
----------------------------------------------------------------------
message: 1
date: Mon, 15 Nov 2010 17:45:35 -0600
from: "DeLong, Eric" <EDeLong@xxxxxxxxxxxxxxx>
subject: Socket programming in RPG (C runtime) and IPv6
I've been looking at documentation relating to IPv6, and realize that
any sockets applications that I've written will need to be modified to
work with IPv6 addressing. Has anyone gone through this, and could
offer any tips or sample code? I am just wanting to be prepared for
this for when we're forced to switch. I sometimes wonder if I'm
misunderstanding this whole IPv6 issue, since I don't see anyone here
who seem to be coding for it. Am I jumping to unwarranted conclusions,
or will this transition to IPv6 be another bloody mess?
Tia,
-Eric DeLong
------------------------------
message: 2
date: Mon, 15 Nov 2010 18:14:38 -0600
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: Re: Socket programming in RPG (C runtime) and IPv6
I assume you mean using the Unix-type APIs. (I'm not aware of any way
to do socket programming with the C run-time -- and I thought I was
pretty good at sockets!)
I've written the prototypes/constants/structures for IPv6 into my
SOCKET_H member. You can get them here:
http://www.scottklement.com/rpg/copybooks/socket_h.rpgle.txt
Unfortunately, at this point, they're all untested. I don't currently
have access to an IPv6 network, so I have no way to test my code.
Here are a few salient points:
1) You should replace inet_addr(), gethostbyname() and getservbyname(),
gethostbyaddr() with a calls to getaddrinfo() and getnameinfo(). (This
will work with IPv4 as well... but does require v5r2.
2) For IPv6, you'll want to use AF_INET6 and IPPROTO_IPV6 instead of
AF_INET and IPPROTO_IP when calling the socket() API.
3) Use structure sockaddr_in6 in place of sockaddr_in when calling
connect(), bind(), or accept().
4) recv(), send(), close() should work the same as before.
5) You must call freeaddrinfo() to free up memory used by getaddrinfo().
Good luck
On 11/15/2010 5:45 PM, DeLong, Eric wrote:
I've been looking at documentation relating to IPv6, and realize that
any sockets applications that I've written will need to be modified to
work with IPv6 addressing. Has anyone gone through this, and could
offer any tips or sample code? I am just wanting to be prepared for
this for when we're forced to switch. I sometimes wonder if I'm
misunderstanding this whole IPv6 issue, since I don't see anyone here
who seem to be coding for it. Am I jumping to unwarranted conclusions,
or will this transition to IPv6 be another bloody mess?
------------------------------
message: 3
date: Mon, 15 Nov 2010 23:00:10 -0500
from: dmosley@xxxxxxxxxx
subject: XML-INTO (just need a quick answer)...
Hey guys, just a yes or now will do..
Is it possible to specify an attribute value, in the path parameter, of
XML-INTO,
so that if I have multiple children tags , of a parent, but I only wanted
to return a specific child.
<config>
<permissions>
<permission id='test1' description='test_1'/>
<permission id='test2' description='test_2'/>
<permission id='test3' description='test_3'/>
<permission id='test4' description='test_4'/>
<permission id='test5' description='test_5'/>
</permissions>
Example usage would be something like this.
xml-into testPermission %XML( xmlFile
: 'path=config/permissions/permission[@id="test1"]'
+ ' doc=file'
+ ' case=any'
+ ' allowmissing=yes'
+ ' allowextra=yes');
I would LOVE for this to be able to work, but, if not, I can figure
something else out.
thanks
David
David L. Mosley, Jr.
Technical Solutions Architect
Dancik International, Ltd.
2000 CentreGreen Way, Suite 250
Cary, NC 27513
www.dancik.com
------------------------------
message: 4
date: Tue, 16 Nov 2010 11:21:09 +0100
from: David FOXWELL <David.FOXWELL@xxxxxxxxx>
subject: Initialisation of global variables between calls
Hi,
Just wondering what is a good/normal approach to this. Starting to use
linear main programs has made me stop and rethink.
Say I have a program that treats a client, ends, then treats another client.
Up until now, I've just relied on the program analysis to set the variables
at the right place. So at any given time, there could be global variables
containing information on the current client and others still containing
information on the previous client until they are used.
In a linear main program, wouldn't it be easiest to just initialise all
global variables in the main procedure? Would it work if they were all
declared as part of a data structure so that they could be reset by one
command?
I know, reducing the number of global variables would also help.
------------------------------
message: 5
date: Tue, 16 Nov 2010 12:15:41 +0100
from: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
subject: AW: Initialisation of global variables between calls
Why not simply adding an internal procedure where all global variables get
initialized (or reset)?
This procedure can be called by the main procedure (like any other
procedure).
Mit freundlichen Gr??en / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Urspr?ngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von David FOXWELL
Gesendet: Tuesday, 16. November 2010 11:21
An: RPG programming on the IBM i / System i
Betreff: Initialisation of global variables between calls
Hi,
Just wondering what is a good/normal approach to this. Starting to use
linear main programs has made me stop and rethink.
Say I have a program that treats a client, ends, then treats another client.
Up until now, I've just relied on the program analysis to set the variables
at the right place. So at any given time, there could be global variables
containing information on the current client and others still containing
information on the previous client until they are used.
In a linear main program, wouldn't it be easiest to just initialise all
global variables in the main procedure? Would it work if they were all
declared as part of a data structure so that they could be reset by one
command?
I know, reducing the number of global variables would also help.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 6
date: Tue, 16 Nov 2010 11:43:14 +0000
from: "Schmidt, Mihael" <Mihael.Schmidt@xxxxxxxxxxx>
subject: RE: Initialisation of global variables between calls
Why use global variables at all? If you need to keep data between calls you
can use the static keyword in most cases.
Mihael
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Birgitta Hauser
Sent: Tuesday, November 16, 2010 12:16 PM
To: 'RPG programming on the IBM i / System i'
Subject: AW: Initialisation of global variables between calls
Why not simply adding an internal procedure where all global variables get
initialized (or reset)?
This procedure can be called by the main procedure (like any other
procedure).
Mit freundlichen Gr??en / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Urspr?ngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von David FOXWELL
Gesendet: Tuesday, 16. November 2010 11:21
An: RPG programming on the IBM i / System i
Betreff: Initialisation of global variables between calls
Hi,
Just wondering what is a good/normal approach to this. Starting to use
linear main programs has made me stop and rethink.
Say I have a program that treats a client, ends, then treats another client.
Up until now, I've just relied on the program analysis to set the variables
at the right place. So at any given time, there could be global variables
containing information on the current client and others still containing
information on the previous client until they are used.
In a linear main program, wouldn't it be easiest to just initialise all
global variables in the main procedure? Would it work if they were all
declared as part of a data structure so that they could be reset by one
command?
I know, reducing the number of global variables would also help.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 7
date: Tue, 16 Nov 2010 08:29:24 -0500
from: Charles Wilt <charles.wilt@xxxxxxxxx>
subject: Re: How to read and or statement
David,
With good long names and proper usage of constants, I don't see it as
being harder to read.
I've worked in languages that just had the c-switch style formats;
that just allow you to test one thing. I've always run into a spot
where it'd be nice to check a couple of things.
Consider
SELECT;
WHEN Customer.Type = 'A';
...
WHEN (Customer.Type = 'B'
or Customer.Type = 'C'
or Customer.type = 'D')
and Customer.isTaxable = 'Y'
...
OTHER;
...
ENDSL;
You can't do the above with the other form.
Charles
On Mon, Nov 15, 2010 at 4:18 AM, David FOXWELL <David.FOXWELL@xxxxxxxxx>
wrote:
On Fri, Nov 12, 2010 at 8:21 AM, David FOXWELL
<David.FOXWELL@xxxxxxxxx> wrote:
And MUCH nicer than :
SELECT;
?WHEN Customer.Type = 'A';
? ?...
?WHEN Customer.Type = 'B' or
? ? ? Customer.Type = 'C' or
? ? ? Customer.type = 'D';
? ?...
?WHEN SomethingThatHasNothingToDoWithCustomer.Slipper = 'E';
? ?...
?OTHER;
? ?...
ENDSL;
Which would no longer compile :-)
Charles, I am surprised as you are such an advocate for self-documenting
code. Such a SELECT group would be difficult to follow without comments.
Dare I say impossible, looking at the above example.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 8
date: Tue, 16 Nov 2010 14:28:55 +0100
from: David FOXWELL <David.FOXWELL@xxxxxxxxx>
subject: RE: Initialisation of global variables between calls
I admit I am probably using too many global variables. I work in an
environment where the norm seems to be copy and paste code rather than reuse
it. If I were to pass parameters instead, the procedures would remain
internal to that module so I'd then probably get my backside kicked for
taking too long setting up prototypes and the rest for subprocedures that
will never be reused. Most of my subprocedures just seem to be there make
the code readable and avoid coding monoliths.
I'd really like to see an example of a program that doesn't use global
variables.
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Schmidt, Mihael
Envoy? : mardi 16 novembre 2010 12:43
? : RPG programming on the IBM i / System i
Objet : RE: Initialisation of global variables between calls
Why use global variables at all? If you need to keep data
between calls you can use the static keyword in most cases.
Mihael
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Tuesday, November 16, 2010 12:16 PM
To: 'RPG programming on the IBM i / System i'
Subject: AW: Initialisation of global variables between calls
Why not simply adding an internal procedure where all global
variables get initialized (or reset)?
This procedure can be called by the main procedure (like any
other procedure).
------------------------------
message: 9
date: Tue, 16 Nov 2010 15:17:01 +0100
from: David FOXWELL <David.FOXWELL@xxxxxxxxx>
subject: RE: How to read and or statement
-----Message d'origine-----
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Charles Wilt
With good long names and proper usage of constants, I don't
see it as being harder to read.
Consider
SELECT;
WHEN Customer.Type = 'A';
...
WHEN (Customer.Type = 'B'
or Customer.Type = 'C'
or Customer.type = 'D')
and Customer.isTaxable = 'Y'
...
OTHER;
...
ENDSL;
Charles, I don't have a problem with your example. I've also done similar
things, but...
Consider
SELECT;
WHEN Customer.Type = 'A';
...
WHEN Customer.isTaxable = 'Y';
...
WHEN (Customer.Type = 'B'
or Customer.Type = 'C'
or Customer.type = 'D')
...
OTHER;
...
ENDSL;
coded this way, I find it misleading.
------------------------------
--
This is the RPG programming on the IBM i / System i (RPG400-L) digest list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
End of RPG400-L Digest, Vol 9, Issue 877
****************************************
As an Amazon Associate we earn from qualifying purchases.
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.