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



Now that I think about this, this might be the problem because I saw
information that didn't belong. Only difference is that I am going from RPG
-> RPG Subprocedure (where the problem is) -> RPG Program.

---------- Forwarded message ----------
From: Alan Shore <AlanShore@xxxxxxxx>
Date: Oct 13, 2006 10:33 AM
Subject: Re: %trim and %trimr Not Working on a 32767A Field
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>

Hi Mike - I think you have just come across the same thing that happened to
me yesterday. This issue is described in the CL Programming manual,
SC41-5721:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/sc415721.pdf

found in Chapter 3 on page 76 of the manual. It says:
Parameters can be passed and received as follows: v Character string
constants of 32 bytes or less are always passed with a length of 32 bytes
(padded on the right with blanks). If a character constant is longer than
32 bytes, the entire length of the constant is passed. If the parameter is
defined to contain more than 32 bytes, the CALL command must pass a
constant containing exactly that number of bytes. Constants longer than 32
characters are not padded to the length expected by the receiving program.
The receiving program can receive less than the number of bytes passed. For
example, if a program specifies that 4 characters are to be received and
ABCDEF is passed (padded with blanks in 26 positions), only ABCD are
accepted and used by the program. If the receiving program receives more
than the number of bytes passed, the results may be unexpected. Numeric
values passed as characters must be enclosed in apostrophes. v Decimal
constants are passed in packed form and with a length of LEN(15 5),

In other words:
When you use the CALL command, character string
constants of 32 bytes or less are always passed with a
length of 32 bytes. If the string is longer than 32, you
must specify the exact number of bytes, and pass exactly
that number. Actually it would be 1 more, so it would
be n + 1 in most cases.


Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx

rpg400-l-bounces@xxxxxxxxxxxx wrote on 10/13/2006 11:12:29 AM:

Just as the subject says. I am wring a subproceedure that can take in any
length of field. I am trying to trim down the field to the proper size,
but
it isn't. Here is the code:

     P SendBatchEmail  B                   EXPORT
     D SendBatchEmail  PI
     D  fromAddress                 100A   CONST
     D                                     OPTIONS(*VARSIZE)
     D  toAddress                 32767A   CONST
     D                                     OPTIONS(*VARSIZE)
     D  ccAddress                 32767A   CONST
     D                                     OPTIONS(*VARSIZE)
     D  bccAddress                32767A   CONST
     D                                     OPTIONS(*VARSIZE)
     D  subject                   32767A   CONST
     D                                     OPTIONS(*VARSIZE)
     D  body                      32767A   CONST
     D                                     OPTIONS(*VARSIZE)

      /free

        cmd = 'SBMJOB CMD(CALL PGM(BATCHEMAIL) ' +
              'PARM(''' + %trim(fromAddress) + ''' ''' +
                          %trim(toAddress) + ''' ''' +
                          %trim(ccAddress) + ''' ''' +
                          %trim(bccAddress) + ''' ''' +
                          %trim(subject) + ''' ''' +
                          %trim(body) + ''') JOB(SNDEMAIL)';

        ExecClCmd(cmd);

      /end-free
     P SendBatchEmail  E

After the assignment to cmd, it contains "SBMJOB CMD(CALL PGM(BATCHEMAIL)
PARM('me@xxxxxxxxxxxxxxxxxx' 'me@xxxxxxxxxxxxxxxxxx
..." A ton of spaces and no ending quote mark. Any ideas? I am sure I am
doing something stupid, I just can't see it.

--
Mike Wills
Blog - http://mikewills.name
Podcasts - http://theriverbendpodcast.com
--
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 ...

Follow-Ups:
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.