Results 1 to 1 of 1

Thread: %xlate

  1. #1
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12604

    %xlate

    uppercase to lowercase
    PHP Code:
    FQATMSMTPA IP   E           K DISK                                                        
    F
    @EMAILP   UF A E           K DISK                                                        
     
    *                                                                                        
    d Up              c                   CONST('ABCDEFGHIJKLMNOPQRSTUVWXYZ')                 
    d Lo              c                   CONST('abcdefghijklmnopqrstuvwxyz')                 
     *                                                                                        
    c                   if        %subst(DOMROUTE:1:5) = 'MAIL.'                              
    c                   eval      DOMROUTE = %trim(%subst(DOMROUTE:6:16))                     
    c                   endif                                                                 
     *                                                                                        
    c                   eval      EMAIL = %trim(%xlate(up:lo:SMTPUID)) +                      
    c                                     %trim('@') +                                        
    c                                     %trim(%xlate(up:lo:DOMROUTE))                       
    c                   write     EMAILR 
    convert single quote to double quote
    PHP Code:
    d DQ              s              1    inz('"')       
    d SQ              s              1    inz('''')    

           
    chain count sub03;                                               
           if %
    found(arc19ad) and s3note <> *blanks;                        
            
    s3note = %xlate(SQ:DQ:s3note);                                  
            
    longmessage = %trim(longmessage) + %trim(s3note) + CRLF;        
           endif; 
    remove some"*" with %xlate
    PHP Code:
         *                                                                             
         * 
    Definitions                                                                 
         
    *                                                                             
        
    d somefield       s             15    inz('**********12.35')                   
        
    d dec152          s             15  2                                          
         
    *                                                                             
         /
    free                                                                         
                                                                                       
              dec152  
    =  %dec(%xlate('*':'0':somefield):15:2);                         
                                                                                       
               *
    INLR = *on;                                                            
         /
    end-free 
    use it within an if statement
    PHP Code:
     If  %Xlate'y':'Y'MsgRpy ) = 'Y';                              
                                                                       
      
    ZLSS0200.NbrSvrUsr  1;                                         
      
    ZLSS0200.NetSvrUsr(1) = NetSvrUsr;                               
                                                                       
      
    ChgSvrInfZLSS0200: %SizeZLSS0200 ): 'ZLSS0200'ERRC0100 ); 
    This is LAME but here it is anyway -- you can use %xlate to increment either Alpha or numberic

    PHP Code:
    d count           s              2  0                                                
    d passedin        s             10    inz
    ('AR12567807')                              
    d passedout       s             10    varying                                        
     
    *                                                                                   
    d Incd1           c                   CONST('0123456789')                            
    d Incd2           c                   CONST('1234567890')                            
    d Incc1           c                   CONST('ABCDEFGHIJKLMNOPQRSTUVWXYZ')            
    d Incc2           c                   CONST('BCDEFGHIJKLMNOPQRSTUVWXYZA')            
     *                                                                                   
     /
    free                                                                               
          
    // when completed passedout would be: PASSEDOUT = 'BS23678918  '               
           
    for count 1 to 10;                                                          
            
    select;                                                                      
             
    when  %check('0123456789':%subst(passedin:count:1)) > *zeros;               
              
    passedout += %xlate(Incc1:Incc2:%subst(passedin:count:1));                 
             
    other;                                                                      
              
    passedout += %xlate(Incd1:Incd2:%subst(passedin:count:1));                 
            
    endsl;                                                                       
           endfor;                                                                       
                                       
           *
    inlr = *on;                
                                       
     /
    end-free 
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  2. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. XLATE opcode in RPG
    By swarup in forum RPG/RPGLE
    Replies: 12
    Last Post: July 18th, 2011, 08:22 AM
  2. How to XLATE in CLLE?
    By Nil in forum CLP/CLLE
    Replies: 4
    Last Post: July 12th, 2010, 12:51 AM
  3. Reg : %XLATE
    By kmkmagesh in forum RPG/RPGLE
    Replies: 2
    Last Post: July 6th, 2006, 05:26 AM
  4. %xlate - example
    By jamief in forum /Free format
    Replies: 0
    Last Post: December 28th, 2005, 12:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •