Hmm....

I assumed that the at-sign is encoded together with the CCSID of the source. And that %scan (and other operations) handles conversion when necessary. If this is not the case (meaning %scan simply scans a bit pattern) then why not?? i/OS has good support for different codepages (CCSID's). I assumed that anyway. Now i'm a bit disappointed to be honest because it *should* take different CCSID's into account. You shouldn't be bothered by manually converting to/from CCSID's for these "simple" operations. Technically there is no reason for this because the CCSID of the source is known, so why does %scan not do any automatic conversion?

Date: Fri, 17 Oct 2008 10:09:21 -0700
From: bvining@xxxxxxxxxxxxxxx
Subject: Re: Validate Email address in RPGLE
To: rpg400-l@xxxxxxxxxxxx

If ALL you need is the commercial at sign encoded within the CCSID (explicit or defaulted) of the job then this will do the trick:

dAt_Sign s 1
/free
At_Sign = u'0040';
*inlr = *on;
return;
/end-free

The code is defining a 1-byte character field named At_Sign and then moving the Unicode value for the commercial at sign to the character field At_Sign. If you are on a current release (V5R3 or higher) and current on PTFs within the last year or so, then you will end up with At_Sign holding the commercial at sign in the CCSID of the job.

Your original note doesn't say where $1SeMail is coming from (keyboard, database file, etc) so I'm assuming that you are making sure that the field is indeed encoded in the job (explicit or default) CCSID.

You can retrieve your jobs dafault CCSID with the QUSRJOBI API (format JOBI0400) and then use other APIs (like the iconv family) to convert a hardcoded CCSID 37 literal in your program to the job default CCSID. But if all you need is one character converted then the above code example is much easier.

Bruce Vining
http://www.brucevining.com/

Ashish Kulkarni <ashish.kulkarni13@xxxxxxxxx> wrote:
Hi

Would you let me know how to get the code page of job, and convert '@'

or any link where i can get this information

Regards

Ash

On Fri, Oct 17, 2008 at 8:40 AM, Bradley V. Stone wrote:

What I do is retrieve the Code page of the job, then convert the literal
'@'
from the code page I developed on to the job's, then scan for that.

Bradley V. Stone
BVSTools - www.bvstools.com
eRPG SDK - www.erpgsdk.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Takken, Cor
Sent: Friday, October 17, 2008 6:53 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Validate Email address in RPGLE


You don't want to check an email address only by the presence of the
@-sign. A much better idea is to check it using regular expressions.
This will not remove the limitation of the CCSID, however there must be
a way to represent the string to check in unicode or the likes.

Just my incomplete 2 cents,

Cor

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Ashish Kulkarni
Sent: vrijdag 17 oktober 2008 13:25
To: RPG programming on the AS400 / iSeries
Subject: Validate Email address in RPGLE

HiDoes anyone have sample of validating email address in RPGLE
program,
For example in RPGLE i can write
'@':1 Scan $1SeMail @Pos
If @Pos = 0
//process error here
endif

But this code will only work if CCSID is 37, as @ will be valid only
for
CCSID 37, but what is CCSID is different.
How do i check for the character,
Does anyone have any idea or sample code to do so

Ash
--
This is the RPG programming on the AS400 / iSeries (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 e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary material,
confidential information and/or be subject to legal privilege. It
should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please
promptly delete this e-mail and any attachment and all copies and
inform the sender. Thank you.


--
This is the RPG programming on the AS400 / iSeries (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 AS400 / iSeries (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 AS400 / iSeries (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.




Bruce
Bruce Vining Services
507-206-4178
--
This is the RPG programming on the AS400 / iSeries (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.


_________________________________________________________________
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.