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



I love using SQL for stuff, but I think this is a lot more complicated than the EVALR opcode - not a BIF, right? An example from the manual - Name is a 20-character alpha variable.

    evalr Name = 'Johann Strauss';
    // Name is now '      Johann Strauss'

This has been around since at least 7.1, so far as I know.

Regards
Vern

On 3/26/2023 2:49 PM, Jonathan Ball wrote:
I tend to do all of this kind of activity in SQL whenever possible.

   dcl-s   char_15   char(15);
   dcl-s   char_30   char(30);
   dcl-s   char_7    char(7) inz('STUFF');   // char_7 = 'STUFF '

   exec sql
   set :char_15 = lpad(rtrim(:char_7), length(:char_15));  // char_15 = '          STUFF'

   exec sql
   set :char_30 = hex(:char_15);   // char_30 = '40404040404040404040E2E3E4C6C6'

In find SQL built-in functions intuitively easier to understand and simpler to use than equivalent RPGLE BIFs, and there aren't always equivalents.

On 2/14/2023 1:04 PM, dfreinkel@xxxxxxxxxxxxxxxxx wrote:
What is a good and simple way to right justify a character field?


I would not like to use a do loop to do this.


Thanks


Darryl Freinkel

A4G

Telephone: 770.321.8562 Mobile: 678.355.8562





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.