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



My mistake, I should have looked at it closer.

just remove the copy after the XLATE.
CPYBLA      PARM-STRING, NEWSTR;  

It's stepping on the result.   


Keith


----- Original Message ----- 
From: "Winchester Terry" <terry.winchester@xxxxxxxxxxxxxxx>
To: "'MI Programming on the AS400 / iSeries'" <mi400@xxxxxxxxxxxx>
Sent: Tuesday, August 31, 2004 7:55 AM
Subject: RE: [MI400] MI Newbie with XLATE instruction problem


> Keith,
> 
> That's what I first thought too, but don't these 2 
> instructions save the PARM-STRING value into NEWSTR 
> and then clear the PARM-STRING variable?
> 
> CPYBLA      NEWSTR, PARM-STRING;                        
> CPYBREP     PARM-STRING, " ";
> 
> If so, then my receiver will be PARM-STRING (now empty)
> and the XLATE instruction should work from my new source 
> NEWSTR - or that's what I assumed :(
> 
> Terry  
> 
> > -----Original Message-----
> > From: mi400-bounces@xxxxxxxxxxxx 
> > [mailto:mi400-bounces@xxxxxxxxxxxx] On Behalf Of Keith Carpenter
> > Sent: Tuesday, August 31, 2004 10:32 AM
> > To: MI Programming on the AS400 / iSeries
> > Subject: Re: [MI400] MI Newbie with XLATE instruction problem
> > 
> > 
> > Looks like you got the first 2 XLATE parms flipped.
> > The 1st is the receiver and the 2nd is source
> > Try:
> > 
> > XLATE       NEWSTR, PARM-STRING,  PARM-OLDCH, PARM-NEWCH;
> > 
> > 
> > ----- Original Message ----- 
> > From: "Winchester Terry"
> > 
> > > As the subject implies, I'm an MI newbie and having a 
> > > problem using the XLATE instruction. My goal is pretty 
> > > simple - create a program that accepts 3 parameters
> > > 
> > > Parm1= String   10 chars
> > > Parm2= OldChar   1 char
> > > Parm3= NewChar   1 char
> > > 
> > > and translate each character in "string" from OldChar
> > > to NewChar.  At least I *thought* this was simple :(
> > > My ultimate goal is to handle a string of 2000-3000
> > > characters callable from any HLL.
> > > 
> > > Here is my code, but it does not seem to translate
> > > the characters properly.  The SHOWMSG routine is
> > > straight from Leif's MI examples.  
> > > 
> > > DCL SPCPTR .P1 PARM;                         
> > > DCL DD PARM-STRING   CHAR(10) BAS(.P1);      
> > >                                              
> > > DCL SPCPTR .P2 PARM;                         
> > > DCL DD PARM-OLDCH    CHAR(1)  BAS(.P2);      
> > >                                              
> > > DCL SPCPTR .P3 PARM;                         
> > > DCL DD PARM-NEWCH    CHAR(1)  BAS(.P3);      
> > >                                              
> > > DCL OL PARMS(.P1, .P2, .P3) EXT PARM MIN(3); 
> > >                                              
> > > DCL SPCPTR .NEWSTR INIT(NEWSTR);             
> > > DCL DD      NEWSTR CHAR(10);                 
> > >                                                             
> > > ENTRY * (PARMS) EXT;                                        
> > >     CPYBLA      NEWSTR, PARM-STRING;                        
> > >     CPYBREP     PARM-STRING, " ";                           
> > >     XLATE       PARM-STRING, NEWSTR, PARM-OLDCH, PARM-NEWCH;
> > >     CPYBLA      PARM-STRING, NEWSTR;                        
> > >                                                             
> > >     CAT         MSG-TEXT, PARM-STRING, "|";                 
> > >     CALLI SHOW-MESSAGE, *, .SHOW-MESSAGE;                   
> > >     RTX          *;                                         
> > > %INCLUDE SHOWMSG                                            
> > >  
> > > When I call this program from a command line:
> > > 
> > > CALL PGM(MYPGM) PARM('1234567890' '4' 'A')
> > > 
> > > I see the results in my message queue but
> > > nothing has changed:
> > > 
> > > >From  . . . :   TWINCHES       08/31/04   09:47:43  
> > > 1234567890|                                         
> > > 
> > > Of course, I was expecting to see: 123A567890|
> > > 
> > > Originally, the XLATE code looked like this:
> > > 
> > > XLATE       PARM-STRING, PARM-STRING, PARM-OLDCH, PARM-NEWCH;
> > > 
> > > but since *that* didn't work I assumed that separate string 
> > > variables were needed, hence my new version above that uses 
> > > NEWSTR as a temporary variable to hold the inbound string 
> > > parameter.
> > > 
> > > I'm missing something simple here...but just can't see it...
> > > Any help would be appreciated :)
> > > 
> > > Terry
> > 
> > _______________________________________________
> > This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> > To post a message email: MI400@xxxxxxxxxxxx
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/mailman/listinfo/mi400
> > or email: MI400-request@xxxxxxxxxxxx
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/mi400.
> > 
> _______________________________________________
> This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> To post a message email: MI400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/mi400
> or email: MI400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/mi400.
> 

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.