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



Hi Vern

Thanks for putting me right, for some reason I've always believed the *BCAT
to work on the second operand. I've rarely, if ever, used it as I can't
remember ever having a need to trim from the second operand - which is a
shame really because I might have learnt something sooner rather than later.

Thanks again

Jonathan

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: 14 August 2007 00:34
To: Midrange Systems Technical Discussion
Subject: RE: Convert Character to Decimal in CL: Trimming leading zeros

If someone else responded to this - my apologies. Am on vacation and
the brain is not in full gear

*TCAT means Truncate and conCATenate
*BCAT means truncate, add Blank and conCATenate

In both cases, the truncation is the operand on the left only -
nothing is done to the operand on the right.

Again, leading blanks are NOT truncated from the second operand.

HTH
Vern

At 04:41 PM 8/13/2007, you wrote:

Hi Peter

If you change your *TCAT in the last CHGVAR statement you'll get the
result
you want. *TCAT trims trailing blanks from the string before the *TCAT,
*BCAT trims preceding blanks from the string following the *BCAT.

All the best

Jonathan

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Vidal
Sent: 13 August 2007 18:45
To: Midrange Systems Technical Discussion
Subject: Re: Convert Character to Decimal in CL: Trimming leading zeros

I am doing this:
(&ATFILE (10/A) holds "FILE001 ")
======================================================
CHGVAR VAR(&SUFFIX) VALUE(%SST(&ATFILE 5 3))
CHGVAR VAR(&POS) VALUE(1)

DOWHILE COND(&POS *LE 3)
IF COND(%SST(&SUFFIX &POS 1) *EQ '0') +
THEN(CHGVAR VAR(%SST(&SUFFIX &POS 1)) +
VALUE(' '))
ELSE CMD(GOTO CMDLBL(PROCESS))
CHGVAR VAR(&POS) VALUE(&POS + 1)
ENDDO

CHGVAR VAR(&NXREF) VALUE('XREF' *TCAT &SUFFIX)

At this point,
&NXREF = "FILE 1 "

...instead of having this:

&NXREF = "FILE1 "


Peter Vidal
MAPICS IT Technical Support Team / SR System Analyst
10540 Ridge Rd., Ste 203, New Port Richey, FL 34654-5111
http://www.pall.com

"He who asks is a fool for five minutes, but he who does not ask remains a
fool forever."
Chinese Proverb




CRPence <crp@xxxxxxxxxxxxxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
08/13/2007 11:56 AM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
midrange-l@xxxxxxxxxxxx
cc

Subject
Re: Convert Character to Decimal in CL: Trimming leading zeros






Consider that such naming does not provide for "ordered" names. At
least not according to the numerical ascent. An example of such a list:

A1
A10
A100
A101
A102
A11
A110
A111
A12
A2

REXX is a much better choice for such string handling, but a CLP
subroutine can replace any '0' with ' ' in a loop starting from the
first position, and the result string can be *TCAT as the suffix.

stripzero: subr stripzero /* Input &sfx ; e.g. *char 10 */
chgvar &pos 1
dowhile (&pos *le &maxlen) /* &sfx max length; e.g. 10 */
if (%sst(&sfx &pos 1) *eq '0') then( +
chgvar (%sst(&sfx &pos 1)) ' ' )
else leave
chgvar &pos (&pos + 1)
enddo
endsubr

Regards, Chuck
--
All comments provided "as is" with no warranties of any kind
whatsoever and may not represent positions, strategies, nor views of my
employer

Peter Vidal wrote:
"CHGVAR VAR(&DECVAL) VALUE(&CHARVAL)"

Now that this is clear, I do not want to complicate this more but I have
a
similar issue with a little variant. I have file names which suffix is
a
number from 1 to 350 and I need to trim the leading zeros and then do
some
additional processing. For example:

BEFORE: &CHARVAL = 'FILE001 '
AFTER: &CHARVAL = 'FILE1 '

Again, I need to do this for files 1 to 350.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



---------------------------------------------------------------------------
-
----

Attention:

This communication may contain information that is confidential,
privileged and/or exempt from disclosure under applicable law.
If you are not the intended recipient, please notify the sender
immediately and delete the original, all attachments, and all
copies of this communication.


---------------------------------------------------------------------------
-
----



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.