SQLCODE 12 is not an error but a warning and means correlation names for the
same columns within the same tables should be used.
Just try to modify your UPDATE statement as follows:
Exec SQL
update LIb/file1 a set var =
(select var1 from lib/file2 b
where a.field1 = b.field2)
where exists(select * Lib/file2 c where a.field1=c.field2);

In former releases sometimes warnings were not sent out.
That's why you never should check for SQLCODE <> *ZEROS (or SQLCODE =
*Zeros) but always SQLCODE < *Zeros (=Error) andr SQLCODE = 100 (Last
Record/Not found)

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Billy Waters
Gesendet: Saturday, 29.3 2014 14:27
An: midrange-l@xxxxxxxxxxxx
Betreff: SQLCOD 12

RPG Code
Exec SQL
update LIb/file1 set var =
(select var1 from lib/file2
where field1 = field2)
where exists(select * Lib/file2 where field1=field2);

Write R001;
If SQLCOD <> 0;
*INU1 = *on;

Take necessary actions in CL if INU1 is off or on.

If I call from command line:
Zero Records: 0
Off (State of INU1) check doe SQLCOD <> 0

If I start from MSSQL stored procedure
Zero Records: 0
update is successful

Different user ids when calling from command line vs from MSSQL.
Please help..

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page