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



So just to clarify...

This is the actual prototype:

dcl-pr Eml_Stmf int(10) ExtProc('Eml_Stmf');
pcom# char(6) const options(*varsize);
psubject char(100) const options(*varsize);
pstmf char(1024) const options(*varsize);
ptoaddr char(50) const options(*varsize);
pccaddr char(50) const options(*nopass:*varsize);
pmessage char(1024) const options(*nopass:*varsize);
pbdyct char(80) const options(*nopass:*varsize);
end-pr;

What I observed:
I passed in a CHAR(3) variable for PCOM# when I called EML_STMF from another program. The calling program passed (as the first two positions)
COM_NBR='070'
SUBJECT='Invoice #40064611'

Inside EML_STMF, the PCOM# variable contained '070 I '. It looks like the "I" from "Invoice"

Based on your last sentence below, PCOM# should have contained blanks for the 3 trailing positions. Or am I still misunderstanding?

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Friday, April 29, 2022 11:58 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: *varying vs varchar

Correct - but the assumption is that you will detect the actual length and process accordingly.

Remember - when you pass a parm (other that by value) you are only passing a pointer. So unless your called routine restricts itself to the length passed you will "see" whatever data is in the 6 bytes addressed by the pointer. That extra stuff could be blanks or just rubbish left around by a previous user of that storage.

The important thing is NOT to use the combination you used - it has no value. CONST was enough by itself and will always supply blanks for the training positions.


Jon P

On Apr 29, 2022, at 11:18 AM, Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

Sorry... my fault, Charles is right. It was not real code, and the option is *varsize

So back to my example... if I call this procedure, where the first parameter is CHAR(6) *VARSIZE passing only '123', why does it contain "other" data?

My understanding is that I can pass it something smaller?


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Friday, April 29, 2022 11:12 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: *varying vs varchar

Thanks Charles - I knew there was something wrong with Options(*varchar) but since it _appeared_ to be from real code ...


Jon P.

On Apr 29, 2022, at 11:05 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

There is no options(*varchar)

I assume from the title you mean options(*varsize)

options(*varsize) and varchar()/varying are two very different things

...and Jon beat me to the details... :)

Charles

On Fri, Apr 29, 2022 at 8:37 AM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

I have an older procedure interface defined like this:

dcl-pr myProc;
myfield char(6) const options(*varchar);
myfield2 char(100) const options(*varchar);
end-pr;

If I call this procedure like this:

Callp myProc('123':'This is myfield2');

The value of myfield in the procedure is not just "123"...

What am I missing?
Should I change the Procedure Interface to be VARCHAR instead? And what
are the ramifications of that?

I apologize for asking as I have a strange sense of déjà vu.

[Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<http://www.totalbizfulfillment.com>
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.