I am trying to write an SQLRPGLE program that can take a dynamic SQL string
(user selected fields) and extract the data from a file. I am using
descriptors because the fields selected will be variable. For example,
may do "select firstname, lastname, age from people" or they may do "select
lastname, firstname, gender from people. I have a lot of this working but
have found that the field I am loading in my program has to be the exact
size of the field in the database.
In the case of firstname (20 chars) and lastname (30 chars) I am using the
get descriptor :descName VALUE :i
:type = TYPE,
:length = LENGTH,
:result_ind = INDICATOR;
if result_ind >= 0;
when type = '1'; // character
get descriptor :descName value:i
:charResult = DATA;
.more data types.
What I am finding is charResult has to be 20A to extract the firstname
but has to be 30A to extract the lastname field. If either field does not
match, I receive an SQL0076 error.
I am having the same problem with my numeric fields. Since age is a 3,0
field, my numericResult has to be a 3,0. If numericResult is anything
then 3,0, I get the SQL0076 which means it won't work for another field
Can someone tell me what I am missing?
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
Please contact support@xxxxxxxxxxxx for any subscription related
Help support midrange.com by shopping at amazon.com with our affiliate