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



Roy

No one has exactly told you why this happens. The system has to make some assumptions when you pass literal values as parameters. The program is expecting certain data types, but literals have no data type. The system assumes that numbers are 15 digit packed with 5 decimal places. For character literals, it will pad values out to 32 characters with blanks. So if you have a literal value of 'fred' - the system will pass a value of 'fred '. That causes a problem with parameters that are declared as longer than 32 characters - because things called have parameters passed by reference (pointers), you get whatever is in memory after position 32. Danger! Danger! Will Robinson!!!

The FAQ that Jerry pointed to is very good. It says very little about the numeric situation, however, so here is a link to a wiki article on our company website with links to the IBM documentation about all this - http://wiki.rjssoftware.com/wiki/index.php/Padding_a_character_parameter_when_calling_a_program

The article specifically deals with the character literals issue, but the links at IBM will say more about the numeric literals problem.

HTH
Vern

lwl wrote:
Okay, I have to ask.

But before I ask, a couple of definitions:
Bytes are 8 bits, nibbles are half a byte or 4 bits.
Packed fields use consecutive nibbles to store values
Unpacked fields use consecutive bytes to store values

So the question is: if the RPG program declares a parameter as 7,0 field
does that mean it is automatically a packed field and, by definition, using
consecutive nibbles to store the value?


Roy Luce
Systems Plus - Midwest

Direct: 847-540-9635
800-913-PLUS (7587)
Cell: 847-910-0884
Email: rluce@xxxxxxxxxxxxxxxxxxx

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Lloyd Bailey
Sent: Tuesday, September 01, 2009 10:22 AM
To: Midrange Systems Technical Discussion
Subject: Re: calling programs with parameters from the command line


You need to pass numeric parameters as hex. Your call will look like...

Call pgm1 (X'0000087F')

The rules with hex values is the last position must end in F. The amount of
positions between the single quotes (including the F) must be an even
amount. For instance, if your parameter was defined as 2,0 and you wanted to
pass the value of 99, the hex value will look like...
X'099F' = 99 for the 2,0 parameter value and an extra 0 to make the amount
of positions between the quotes an even amount.

Hope this helps
Lloyd Bailey
Office: (631) 244-2165
Cell: (631) 445-5344
Fax: (631) 200-6113


"lwl" <lwl@xxxxxxxxxxxx m> To Sent by: <midrange-l@xxxxxxxxxxxx> midrange-l-bounce cc s@xxxxxxxxxxxx Subject calling programs with parameters 09/01/2009 11:04 from the command line AM Please respond to Midrange Systems Technical Discussion <midrange-l@midra nge.com>



To all



As you cal tell from this question I'm new to the 400/iSeries environment.



I want to call a program (pgm1) with one parameter (PRM01) from the command
line.

The parameter is 7,0 in the program and the value I want to pass is 87



I think the command line entry is:



Call pgm1 (0000087)



Obviously this is wrong because the program abends on a data error when I
use the above instruction format.



What should the command line entry look like?





Roy Luce

Systems Plus - Midwest



Direct: 847-540-9635

800-913-PLUS (7587)

Cell: 847-910-0884

Email: rluce@xxxxxxxxxxxxxxxxxxx



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

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.