× 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: Question about VARYING fields in RPG IV
  • From: Ravi Viswanathan <ravi@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jun 1999 13:52:31 -0500

Hello,

Can someone explain how VARYING fields work? I have defined a VARYING field in
an RPG IV/embedded SQL program  as follows:

ITEM    S     25A      VARYING.

I execute the SQL statement and retrieve a value into variable ITEM. The length
of the value returned could vary from 5 to 25. I then use variable ITEM, in
another SQL select statement to retrieve data from Oracle using Oracle Access
Manager. The field that I am selecting against, is defined as VARCHAR in Oracle.
The problem is that field ITEM retains trailing blanks at the end when the the
value is shorter than 25. Consequently I don't find a hit in Oracle. So, I have
to %TRIM variable ITEM before using this variable to retrieve from Oracle. I
have the program working but - shouldn't a VARYING field by definition drop
trailing blanks. Otherwise what is the advantage in defining a field as VARYING.
Why not just go with a standard alpha field definition ?

Thanks



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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.