× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Eftimios,

Here is the sed statement that I run interactively, and which substitutes EVEDEV for &LIB:
sed 's/&LIB/EVEDEV/' /qsys.lib/qgpl.lib/qtxtsrc.file/runsql.mbr
When I redirect the output to a non-existent member:
sed 's/&LIB/EVEDEV/' /qsys.lib/qgpl.lib/qtxtsrc.file/runsql.mbr > /qsys.lib/qgpl.lib/qtxtsrc.file/runsqlout.mbr

The problem is that runsql.mbr is a fixed-length source file. Why does that matter, you ask? Because it doesn't really say
external name '&LIB/$ENCRYPT(HIDE)' as you think it does. It actually says something like:

external name '&LIB/$ENCRYPT(HIDE)'bbbbbbbbbbbbbbbbbbbbbbbbb

where "bbbbbbbbb" represents trailing blanks that go all the way to the length of the source record. So the total length of the record is exactly at the maximum that will fit in a source member.

Now you replace '&LIB' with 'EVEDEV'. Notice that EVEDEV is 2 characters longer than &LIB is. That means the record is now LONGER than will fit in a source member... and therefore it causes an error.

It's not an error when you display it interactively because there's no record length associated with the screen. And since the blanks are invisible, you don't notice that the one record's blanks extend out further than the previous record's blanks... so it all looks normal on the screen.

But in the file, it doesn't fit, and therefore fails.

Try doing the following, instead... it will issue a warning message since the record gets truncated, but it SHOULD work, you'll just lose some trailing blanks (this is all one command -- if the e-mail client wraps it, be aware that it should all be one line.)

sed 's/&LIB/EVEDEV/g' /qsys.lib/qgpl.lib/qtxtsrc.file/runsql.mbr | Rfile -wQ "qgpl/qtxtsrc(runsqlout)"

Or, alternately, use QShell to run your create function command instead of RUNSQLSTM, which would make it simpler to insert data. (or use SQLRPGLE, or use QMQRY or any of a half dozen other methods....)

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.