Programming Languages on Power

 View Only

 SQLCODE -312 precompiler does not find the defined data structure

  • RPG
JAMES PANKRATZ's profile image
JAMES PANKRATZ posted Sun February 16, 2025 08:37 AM

Hello friends,

I'm not sure if I found a bug in the SQLRPGLE precompiler.  I'm in V7R4.

I'm using fixed format to define an external data structure. 

If the name of the DS ends in the last position of the Name field on the input spec, then the SQL precompiler doesn't find the name.

If I shorten the name so that at least 1 space is at the end of the name field or if I use the name extension format (...) to define the data structure, then the SQL precompiler will find it.

E.g. this fails (fullnametestbug is not found by the precompiler):

Dfullnametestbuge ds                  extname('BUGTABLE')

But this works:

Dshortertestbug e ds                  extname('BUGTABLE') 

And this works:

Dfullnametestbug...                                      
D               e ds                  extname('BUGTABLE')

Compiling a normal RPG (not SQL) with any above definition works, including the fullnametestbug definition.

Is this a bug? I spent hours on trying to solve why the definition wasn't found. Maybe it would help others who are still a little bit old-school like me if it were fixed.

Thanks for your time.


#RPG
Daniel Gross's profile image
Daniel Gross IBM Champion

Hi James,

in fact, this looks like a defect in the SQL pre-compiler.

I can confirm, that this also happens under V7.5 (testet on PUB400) - I cannot find out, which TR or PTF-level is installed on that machine, but Holger keeps PUB400 normally quite up-to-date.

I seems to be in fact that last position in front of the "E" for externally defined - but I can't find anything about such a limitation in the manuals.

I would recommend to report that defect to IBM as a ticket.

HTH and kind regards,

Daniel

P.S.: BTW - it doesn't happen with a free form DCL-DS definition - so my recommendation is of course:

dcl-ds fullnametestbug extname('BUGTABLE') inz end-ds;


#RPG