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



This could also be done this way with not IF statements.

D PosUsed         S              4  0
D Filler          S            100    Varying

 /Free
    Size = %Len(String);
    PosUsed = %Len(%Trim(String));
    %Len(Filler) = (Size - PosUsed);
    Filler = *ALL'0';
    Return Filler + %Trim(String);
 /End-Free

I use something similar for center text in a field.

D Center          PI           250
D  String                      250    CONST
D  Size                          4  0 CONST

D A               S              4  0
D B               S              4  0
D Blanks          S            100    Varying

 /Free
    A = %Len(%Trim(String));
    Eval(H) B = (Size - A) / 2;
    %Len(Blanks) = B;
    Return Blanks + %Trim(String);
 /End-Free

Michael Schutte



                                                                           
             "Brian                                                        
             Piotrowski"                                                   
             <bpiotrowski@simc                                          To 
             oeparts.com>              "RPG programming on the AS400 /     
             Sent by:                  iSeries" <rpg400-l@xxxxxxxxxxxx>    
             rpg400-l-bounces@                                          cc 
             midrange.com                                                  
                                                                   Subject 
                                       RE: Concatenate two strings spacing 
             06/01/2006 03:06          issue                               
             PM                                                            
                                                                           
                                                                           
             Please respond to                                             
              RPG programming                                              
              on the AS400 /                                               
                  iSeries                                                  
             <rpg400-l@midrang                                             
                  e.com>                                                   
                                                                           
                                                                           




Just do a %len on the concatenated field to determine it's length.  I
had a similar issue when I had to pad a number with zeros for a query.
Doing something like this might help:

             if %len(%trim(arrPSUB(arrINDEX))) = 2;
               SSW94STMT = SSW94STMT + '0';
               SSW94STMT = SSW94STMT + %trim(arrPSUB(arrINDEX)) + apos;
             ENDIF;
             if %len(%trim(arrPSUB(arrINDEX))) = 3;
               SSW94STMT = SSW94STMT + %trim(arrPSUB(arrINDEX)) + apos;
             ENDIF;

Or you could either stick it in a few IF statements or SELECT.  Dealer's
choice:

         Select;
           When %len(%trim(arrPSUB(arrINDEX))) = 2;
             SSW94STMT = SSW94STMT + '0';
             SSW94STMT = SSW94STMT + %trim(arrPSUB(arrINDEX)) + apos;
When %len(%trim(arrPSUB(arrINDEX))) = 3;
             SSW94STMT = SSW94STMT + %trim(arrPSUB(arrINDEX)) + apos;
         ENDSL;

Brian.

-----Original Message-----
From: steema@xxxxxxxxxxxxx [mailto:steema@xxxxxxxxxxxxx]
Sent: Thursday, June 01, 2006 2:46 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Concatenate two strings spacing issue

I have a similar issue.

We have a model number that can be up to 7 positions. The format is
Character(s), number(s). Then there could be an appendage to it, that
would denote a color, that would always be a char.

So a radio for example, would be say, RA12
in a color of white it would be RA12W.

I am displaying info in a subfile for models, but now they want to see,
all the related records, i.e. the RA12W's.

OF course, I can move the field and find my pattern of Char, num, char.
But then I have to do this routine for RA12, RAB12, RABC12.

Instead I would like to know first, how many positions of the model
fiels
are inhabited, and use a simple logic to pursue locating the related
records.

Steve.

You want to do something Like this
Eval CATFIELD = %TRIM(FIELD1) + %TRIM(FIELD2)


Michael Ala
EDI Service Line Leader
BP Lubricants USA Inc.
****************************************

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




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.