Hi Filip,

The following code compiles well on my system:

**FREE
dcl-ds myTable ext extname('ADMINMAS') qualified alias;
end-ds;
dcl-ds myTable_X likeds(myTable);

EXEC SQL
SELECT * INTO :Mytable_x
FROM Administration_Master
WHERE Administration_Id = 1;
return;

Make sure that your filename is in uppercase when you use quotes, and
you will need the keyword EXT preceding to the EXTNAME keyword.

Hope that helps.

Regards,
-Arco

Op wo 29 aug. 2018 om 14:42 schreef Filip Drzewiecki <zaboleqqq@xxxxxxxxx>:

Hello,

I have an SQL table with long names. Based on below article I've tried
to declare Data Structure based on this table so I can select all
columns to my Data stucture in service program. Problem is that
I always get Error "XXX is not defined or no usable" during srvpgm
compilation where XXX is the name of DS which is based on another DS
with extname and alias. Even if I use main DS(the one with extname)
error is the same. I thought that adding alias will fix problem with
long names. When I declared the same DS but I've specified all fields
explicitly, compilation was successful.

http://www.rpgpgm.com/2018/05/how-to-sql-tables-long-names-in-rpg.html

Dcl-Ds myTable extname('tableName':*ALL) qualified alias;
End-Ds;

Dcl-ds myTable_X likeds myTable);

Exec SQL
select * into : myTable_X from tableName where ID= :UserId;

This on is failing. SQL always return one row of data. After I change
DS and declare all fields (70...) myself, it starts to compile. I
really don't know why. Any idea? Maybe this can't be done with srvpgm?
I handle nulls in table by using ALWNULL(*INPUTONLY).

Best Regards
Filip
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.