|
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.