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


  • Subject: Re: Numeric parameters between RPG programs
  • From: Hans Boldt <boldt@xxxxxxxxxx>
  • Date: Wed, 27 May 1998 11:10:30 -0400

Elena Vázquez wrote:
>Good morning,
>I have a problem in an RPG program, and I would like to know whether
>exists a PTF to solve it or it is the correct behaviour.
>
>In program 1 I have defined  a list of parameters to call to program 2,
>one of these parameters in program 1 corresponds to a field from a
>external described file, and its type is zoned (5S 0).
>When I call the second program, it receives this parameter into a
>program variable defined in D specs with the same type (5S 0), but the
>contents of this variable is always garbage, and I receive a run-time
>error in the first line that uses the variable.
>
>I've noticed that including the field into a data structure in the first
>program (without redefine it), or moving the field to a program defined
>variable, the second program receives the value correctly.
>
>So, I don't know if RPG doesn't support numeric fields as parameters
>(although it seems that numeric program defined variables does), or a
>type of 5S 0 in DDS is different to a 5S 0 in RPG, or I need to load a
>PTF, or what. So, please I would appreciate any help to solve this
>problem (of course, I don't want to move this field to a variable, or
>create data structures just to avoid the problem)
>
>I'm in V4R1, and it is an ILE program.

RPG certainly supports numeric fields as parameters!
However, for reference parameters, your types must match
exactly.  Unless you are using procedure prototypes (in
ILE RPG), the compiler can't tell you if there is a
mismatch.

OK, now on to your situation.  You have a numeric field
defined in an externally described file.  Unless the
field is defined elsewhere in the RPG program, it gets
defined in the program as a packed numeric field.  The
format specified in DDS defines the format of the field
in the file, but when RPG allocates the field in the
program, packed format is the default.

Probably, you should define the parameter in the called
program as packed.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.