× 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.



There are many methods to do this, none are automatic or anything like that.
Here are two ways to do it.

      **  More complicated method    
     D Chars           DS
     D   Char                         1A
     D   Digit                        3U 0 Overlay(Char)

     D Hex40           S              3U 0 Inz(64)                          

     D MyGarb          S             20A   
     D NoGarb          S                   Like(MyGarb)

     D x               S             10I 0
     D y               S             10I 0


     C                   for       x = 1 to %len(MyGarb)
     C                   eval      Char = %subst(MyGarb:x:1)
     C                   if        Char >= Hex40
     C                   eval      Y = Y + 1
     C                   eval      %subst(NoGarb:Y:1) = Char
     C                   endif
     C                   endfor


      **  Much Simpler method
     D MyGarb          S             20A   
     D NoGarb          S                   Like(MyGarb)

     D x               S             10I 0
     D y               S             10I 0
     C                   for       x = 1 to %len(MyGarb)
     C                   if        %subst(MyGarb:x:1) >= X'40'
     C                   eval      Y = Y + 1
     C                   eval      %subst(NoGarb:Y:1) = %subst(MyGarb:x:1)
     C                   endif
     C                   endfor

-Bob Cozzi
www.RPGxTools.com
Use xTools and Enjoy programming... again!

-----Original Message-----
From: rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx] On Behalf Of Gauri
Kulkarni
Sent: Monday, August 22, 2005 8:46 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Checking for field with Garbage Value in RPG.

Hi Subhash,

I tried the method suggested by you and finally could succeed in getting it
done. 
Thanks.

The major problem I faced was comparing the "Hexadecimal Value of a
character" with X'40. I had to use my own conversion logic to get the things
done.
Is there any simple way by which I can convert the Char to Hex and will be
able to do the comparison operation as well?


Regards,
- Gauri.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Dubey, Subhash
(Cognizant)
Sent: Wednesday, August 17, 2005 4:03 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Checking for field with Garbage Value in RPG.



Hi Gauri,

The Garbage value has Hex Value less than X'40. You may like to :

Gets the length of the field using %Len opcode

Use a Do loop to Read each character of field. (You can use substring
with a variable to read the next character of the field).
If the Hex value of the read byte is less than X'40, replace it with
blank.

This is an easy option and I have tested the same. Please let me know if
you need

Regards

Subhash



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Gauri Kulkarni
Sent: Wednesday, August 17, 2005 2:57 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Checking for field with Garbage Value in RPG.

XLATE might work in case if I know what exactly the <garbage> is. So
that
BLANKS can be replaced with those invalid characters.
Is there any way to define garbage as well ?
Please let me know ..


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
Peter.Colpaert@xxxxxxxxxx
Sent: Friday, August 12, 2005 6:11 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Checking for field with Garbage Value in RPG.


Gauri,

I believe the %xlate(<garbage>:<blanks>:field) built-in function would
do
what you need.

HTH,

Peter Colpaert
Application Developer
Massive - Kontich, Belgium
-----
Yoda of Borg are we.  Futile is resistance, assimilated will you be.
-----




"Gauri Kulkarni" <gauri.kulkarni@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
12/08/2005 14:28
Please respond to RPG programming on the AS400 / iSeries


        To:     "'RPG programming on the AS400 / iSeries'"
<rpg400-l@xxxxxxxxxxxx>
        cc:
        Subject:        Checking for field with Garbage Value in RPG.


Hi,

I am reading a physical file in my RPG program. One of the character
fields
in file contains a garbage value. The program reads the input file and
writes into some output file.
I didn't find any OPCODE as such in RPG which will be helpful to detect
the
garbage value in a field so that data after that character can be
truncated
to populate the output file with good data.
Does anybody know how can I check whether the field contains garbage and
at
what position ?
( For e.g. .. If the field has value 'ABCHFGSYGJ^&%&&' , I want to check
that it has a garbage value and from position 11 in this example. So
that
i
can truncate the data after position 10 to get the good data).


Thanks,
Gauri Kulkarni.



http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@xxxxxxxxx and delete this mail.
_____________________________________________________________________
--
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.



http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@xxxxxxxxx and delete this mail.
_____________________________________________________________________


This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on this
e-mail is strictly
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.