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



Dave:  The way "C" passes integer or unsigned values goes back to the
early days of "C" before you could write function prototypes.  To make
parameter passing work properly without prototypes, any integer or unsigned
value (including char and short) was widened to long.  Even though the
parameters can be defined more precisely using prototypes, "C" still uses
the same convention to maintain compatibility.

RPG and COBOL don't have the same rule.  Parameters are passed the
way they're defined in the prototype.

I know this is annoying, but perhaps the "C" prototype for QXXRTVDA
should specify long rather than short.

BTW, "C" has a way to stop the widening: for each "C" function that needs
to communicate with RPG, specify pragma argument:
   #pragma argument(fn1, nowiden)
   #pragma argument(fn2, nowiden)

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


---------------------- Forwarded by Hans Boldt/Toronto/IBM on 98-02-04 11:14
---------------------------


owner-midrange-l@midrange.com on 98-02-03 14:14:01
Please respond to MIDRANGE-L@midrange.com @ internet
To: midrange-l@midrange.com @ internet
cc:
Subject: short int in RPG


Folks:

I ran into a slightly annoyance in passing short int as 5I0   in RPG.  I
was trying to pass short int to QXXRTVDA.  I declared a variable 5I0 and
QXXRTVDA complained loudly with CPF1192 ( Message . . . . :   Substring
specified for data area &1 not valid.
Cause . . . . . :   The end of the substring, defined by the combination
of
  starting position and length, is not between the substring starting
position
  and the data area end. The data area was not changed or retrieved.
Recovery  . . . :   Use the (DSPDTAARA command) to find the length of
the data
  area. Either the starting position or length or both should be
changed.

When I passed it as 10I0 it took it and DID ITS job.  What does ILE RPG
do when it passes short int?  as 2 bytes binary or 4 bytes binary with
padding?

void QXXRTVDA(_DTAA_NAME_T dtaname, short int offset,
                short int len, char *dtaptr);
the above is from ILE C/400 Programmers guide.  As you see it needs
short int not long int!

and oh yes, I did try the ALIGN keyword which did diddly nothing.

--
Thank You.

Regards

Dave Mahadevan.. mailto:mahadevan@fuse.net


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@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
+---



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@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.