× 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 true. There is always more than one way to solve a problem: It could also be solved by writing a test program you call from the command line which in turn calls the program in question.

Is the command approach more efficient than a test program? Depends. :)

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Thursday, February 12, 2015 3:31 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Parameter lengths and calling from command line

This can also be taken care of using a command, where you can define a parameter as varying.

On 2/11/2015 4:43 PM, Monnier, Gary wrote:
Pete,

You are trying to call an RPGLE program with a varying length variable. This is not impossible from the command line but it is challenging. Your first two bytes in the string have to be the integer value for following string's length. So, you have to pass in the hex representation of string length + the string.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Pete Helgren
Sent: Wednesday, February 11, 2015 2:20 PM
To: RPG Midrange Discussion
Subject: Parameter lengths and calling from command line

I have spent too much time in the Java/JavaScript world apparently because I have been attempting to write what I thought was a simple RPGLE program which I can call from a command line. The problem is that the parameter, which is a character type, 256 in length, gets padded with "unexpected" contents beyond what I am submitting on the command line. If I submit it like so:

CALL PGM(MYPGM) PARM(This is a test') I see something like this when I
view the contents in either debug or the receiving program:

This is a testRPGLESRC MYLIBRAY MYPGM ??*SRCMBRTXT ‑ 1? *HEX *JOBRUN1
0 *NEW 0*LIBCRTAUT1 *CURRENT0*NONE

I understand, from reading numerous posts, that this is normal behavior but my attempts to follow the directions to eliminate the issue seems for naught. I couldn't find an example program in all of MY libraries that does something similar without the side effects (I could have sworn I have written RPG programs like this before).

The program has these Prototypes/Procedure interfaces:

D mypgm pr extpgm('MYPGM')
D text 256A varying const options(*trim)

D mypgm pi
D text 256A varying const options(*trim)

I originally defined 'text' as 256A but saw the spurious characters.
So I tried options(*varsize), same result. So I tried varying const
options(*trim). No joy ( get a variable out of range error). It is a little early in the week to be going brain dead but apparently I have.
I can't seem to sort this out.

I want to pass a character string of up to 256 characters into this program and only get the characters typed as the parameter value. What am I missing?

--
Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java

--
This is the RPG programming on the IBM i (AS/400 and 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 IBM i (AS/400 and 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 ...

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.