Re: Trouble managing OVRDBF inside a program

Luca Giammattei <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Il 03/02/2026 10:14, [email protected] ha scritto:
> Hi Luca - good to hear about 24/7 πŸ™‚
> Likely the best approach here might be to use a create alias for every Library/file combo you need to update.
> You can create the alias in qtemp ( it will be a ddm-file object ).
> Then you will be able to keep your sql-logic almost intact.
> This is the same as making alcohol the main course but ..... 😱
> 
> 
> Best regards
> 
> 
> 
> Stefan
> 
You're the fourth person to mention alias creation.
Now I'd like to understand: said that in my application context, creating an 
alias doesn't make much sense. In terms of overall performance and code clarity 
and maintainability to me there's not much difference between a situation like this:

<code>
dcl-s sqlstring varchar(300) inz;

   sqlstring ='Insert into ';
   if company <> defaultCompany;
     sqlstring +=%trim(companyLib) + '.';
   endif;
   sqlstring +='MYFILE (FIELD01, FIELD02, FIELD03, FIELD04, FIELD05, FIELD06, ' +
               'FIELD07, FIELD08, FIELD09, FIELD10, FIELD11, FIELD12, ' +
               'FIELD13, FIELD14, FIELD15) ' +
               'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';

   Exec SQL Prepare I1 From :sqlstring;

   For i = 1 to MaxValue by 1;
     Reset MyDS;
     MyDS = MyArray.MyRec(i);

     EXEC SQL EXECUTE I1 USING :MyDS.F01, :MyDS.F02, :MyDS.F03, :MyDS.F04,
                               :MyDS.F05, :MyDS.F06, :MyDS.F07, :MyDS.F08,
                               :MyDS.F09, :MyDS.F10, :MyDS.F11, :MyDS.F12,
                               :MyDS.F13, :MyDS.F14, :MyDS.F15;

     if sqlcode <> 0;
       logError(yabadabadoo);
       retcode='1';
       leave;		
     elseIf sqlcode = 0;
       retcode='0';
     endif;
   Endfor;

   return retcode;
</endcode>

or create and alias in qtemp and manage it. Or am I missing something?

TIA
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.