RPG SQL embedded

25 pts.
Tags:
RPG
SQL
Hi guys, I have this problem, look at this RPG code:
dcl-s hostvar packed(8 : 0);
dcl-s outvar zoned(8 : 0);
...
EXEC SQL SELECT FIELDA INTO :HostVar FROM LIB1/FILE1 ;
outvar = hostvar;
EXEC SQL INSERT into LIB2/FILE2 (FIELDB) VALUES (HostVar);
I get into Hostvar FIELDA that is packed(8 : 0) and put it into FIELDB that is zoned(8 : 0) but I get error SQL with SQLSTATE 42703.
Why? How can I to convert from packed to zoned?
Thank you!
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Per IBM, SQLSTATE 42703 reads as “An undefined column or parameter name was detected.” 


With the undefined column name error, go back and check to make sure that the field names match those in the files File1 and File2. Then fix the issue with HostVar being used on the Select and Insert.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    In your code example, what are you doing with OUTVAR? Is that supposed to be the variable being used on the SQL insert?
    127,470 pointsBadges:
    report
  • Splat
    Per IBM, SQLSTATE 42703 reads as "An undefined column or parameter name was detected." 
    12,845 pointsBadges:
    report
  • BigKat
    EXEC SQL INSERT into LIB2/FILE2 (FIELDB) VALUES (:HostVar);
    9,410 pointsBadges:
    report
  • BigKat
    EXEC SQL INSERT into LIB2/FILE2 (FIELDB) VALUES (:HostVar);

    hard to see, but there needs to be a colon before HostVar
    9,410 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: