× 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 BIll,

The problem is that CL does not understand variable length character fields.  But %trim returns a variable length character field. When you use CHGVAR to set a character field to a variable length result, you get a plain old character field.  And when you subsequently concatenate that with other fields, all the trailing blanks are there.

Rob's solution works because internally CHGVAR recognizes that the result of %trim is variable length and concatenates it correctly.

The old way is

CHGVAR     VAR(&OUTPATH) VALUE('/HOME/XXXXXX/OUTBOUND/' *CAT +
              &BATCHNAME *TCAT '.TXT')

which has the added advantage of replacing the vertial bars ('||') with characters that are invariant, i.e. their displayed graphic character is the same across most EBCDIC code pages (https://www.ibm.com/docs/en/i/7.2?topic=sets-invariant-character-set-its-exceptions).

--
Peter Dow
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx




On 8/31/2021 1:45 PM, Howie, Bill wrote:
Hello all,

I'm having a bit of trouble using the %TRIM function in a CL statement. Here's what I have:


CHGVAR VAR(&BATCHOUT) VALUE(%TRIM(&BATCHNAME))

CHGVAR VAR(&OUTPATH) VALUE('/HOME/XXXXXX/OUTBOUND/' || +
&BATCHOUT || '.TXT')

Both the BATCHOUT and BATCHNAME variables are character fields, 20 positions long. I was originally trying to do this with just the BATCHNAME variable alone, but that wasn't working, so I thought I'd try moving the trimmed value to a new variable, and that didn't work either. I'm basically trying to format a file name for the IFS dynamically. The value of the &BATCHNAME variable at the beginning of this is 'HCC-354' followed by 13 spaces. So right now the result of this looks like this: /HOME/XXXXXX/OUTBOUND/HCC-354 .TXT

Is there a trick to using %TRIM in CL that I'm not aware of? All info is, as always, much appreciated.

[Related image]<https://www.hc-companies.com/>Bill Howie
Senior ERP Programmer/Analyst
Direct: 330.487.3739 | Cell: 330.888.8085 | Toll Free: 800.225.7712
2450 Edison Blvd, Suite 3, Twinsburg OH 44087
hc-companies.com<https://www.hc-companies.com/>
Leader in Horticultural Containers
[cid:image003.png@01D79E86.A330A740]<https://www.linkedin.com/company/the-hc-companies> [cid:image004.png@01D79E86.A330A740] <https://www.facebook.com/HCCompanies/> [cid:image005.png@01D79E86.A330A740] <https://www.instagram.com/hccompanies/> [cid:image006.png@01D79E86.A330A740] <https://twitter.com/hc_companies>

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website.


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.