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



Thanks for your reply Manuel
Never used PASE before- so forgive me if I ask some questions that may seem that I should know better
In your example - you change the contents of the file that is being used within a service program procedure that translates characters from one value to another
I would like to continue using that file as a basis so that I can keep adding characters for translation
Its the file that is copied from the ifs that needs to be translated

Just re-read what I wrote
I am not explaining this very well

From your example - I believe that you list the translation from and translation to
What I would like to do is use the fields in the file itself
BHCCHAR (Bad Hex Character)
BHCREPL (Replacement Character)

Against the data in the file being copied from the ifs

Hope that makes some sense

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Manuel Chaviano
Sent: Wednesday, March 02, 2016 12:08 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Removing "BAD" characters from a file

While the file is still in the IFS, use PASE (call qp2term) to clean it.

You can use a sed "one-liner" to translate the bad characters.

Your original file:

[manny@x40 ~/qpgm/Viejo]$ cat data
90 Å A
91 Ç C
92 Ñ N
164 ¦
93 ø o
94 É E
95 Ê E
96 Ë E
97 È E
98 Í I
99 Î I
100 Ï I
101 Ì I
102 Ø O
103 « <

Translated using sed:

[manny@x40 ~/qpgm/Viejo]$ sed 'y/ÅÇѦøÉÊËÈÍÎÏÌØ«/ACN oEEEEIIIIO</' data
90 A A
91 C C
92 N N
164
93 o o
94 E E
95 E E
96 E E
97 E E
98 I I
99 I I
100 I I
101 I I
102 O O
103 < <

you can redirect the output to another file and use the result as your "good file".

sed is very old (1974), but very powerful, fast and compact.

On my computer (FreeBSD 10.2) it is only 31k!

[manny@x40 ~/qpgm/Viejo]$ ls -lh /usr/bin/sed
-r-xr-xr-x 1 root wheel 31K 25 dic 09:39 /usr/bin/sed

El Tue, 1 Mar 2016 17:42:09 +0000
Alan Shore <ashore@xxxxxxxx> escribió:
Hi everyone
Before I forget - we are on V5r4
Hopefully I can explain my predicament

We have a file on the AS/400, that has been created from a file on the
ifs using the following command CPYFRMSTMF FROMSTMF('/ifsdirectory/filename.xxx') +
TOMBR('/QSYS.LIB/LIBRARY.LIB/DATAFILE.FILE/+
filembr.MBR') MBROPT(*REPLACE) +
ENDLINFMT(*CRLF)

However - sometimes the data in the file contains line feed (X'25') in
numerous places and creates havoc further down the suite of programs

I have found the following sql script that works

update library/datafile
set field = translate(field, X'40', X'25') WHERE field like '%' ||
X'25' || '%'

This is good - but I want to go further We have a file called
BADHEXCHR that contains 2 fields
BHCCHAR (Bad Hex Character)
BHCREPL (Replacement Character)

This contains numerous records like
Record# BHCCHAR BHCREPL
90 Å A
91 Ç C
92 Ñ N
164 ¦
93 ø o
94 É E
95 Ê E
96 Ë E
97 È E
98 Í I
99 Î I
100 Ï I
101 Ì I
102 Ø O
103 « <
Including X'25' to X'40'
Its used in a procedure that is called in numerous RPG programs The
question I have is Is there anyway to change the SQL from update
library/datafile set field = translate(field, X'40', X'25') WHERE
field like '%' || X'25' || '%'

To use this file so that any character in the string that is equal to
BHCCHAR is replaced with BHCREPL

I am getting nowhere fast (actually not so fast) and any help/pointers
would be MUCH appreciated


Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill




--
Bye now...

We have penetrated far less deeply into the regularities obtaining within the realm of living things, but deeply enough nevertheless to sense at least the rule of fixed necessity ..... what is still lacking here is a grasp of the connections of profound generality, but not a knowledge of order itself.
-- Albert Einstein
__
/// Manuel Chaviano
__ ///
\\\///
\XX/ FreeBSD 10-STABLE


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

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.