Another option (if you want to keep the CPYFRMSTMF in place and not write a pgm) is to create a translation table and specify that on the CPY. To do this use
CRTTBL TBL(yourlib/YOURTABLE) SRCFILE(*PROMPT) BASETBL(QEBCDIC). This will give you a prompt where you can specify which characters get mapped to what. You could make all non printables = blank x40.
Then on the CPYFRMSTMF use CVTDTA(*TBL) and specify your new table name.

On 3/2/2016 3:01 PM, Alan Shore wrote:
Hi Luis
Thanks for your reply

What is interesting is that I never received Robs reply - so Rob - appreciated - NOT ignoring you

We already have a procedure in place to handle this - and that would mean writing an RPG program for this file to use that procedure
I was just hoping that someone could see something I could use in an SQL statement, that I could insert into my clle program, but ity looks like I will need to bite the bullet on this

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 Luis Rodriguez
Sent: Wednesday, March 02, 2016 8:54 AM
To: Midrange Systems Technical Discussion
Subject: Re: Removing "BAD" characters from a file

Alan,

Besides Rob's excellent suggestion (processing stream files directly from RPG), assuming you have a BadChar-->GoodChar table already defined, Why not simply use RPG’s XLATE? It could be something like (not exact code):

//----------------------------
// Define "holders" for %Xlate
D FromChar S 064 Varying
D ToChar S 064 Varying
//
Clear FromChar;
Clear ToChar;

// Build your translation strings
DoU %Eof;
Read BADHEXCHR;
IF not %eof;
FromChar = FromChar + BHCCHAR;
ToChar = ToChar + BHCREPL;
ENDIF;
ENDDO;

DoU %Eof;
Read File-to-be-translated;
IF %not eof;
Field = %XLATE(FromChar : ToChar : Field ;
ENDIF;
ENDDO ;

Just an idea...

//----------------------------

Regards,

Luis


Luis Rodriguez



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.