× 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.



Hi Paul,

Yeah, I did (sorta).  Here was my kludgy way of getting around the
issue:

         SACNT = 1;
         DoW SACNT < 30;
           SACODE = %char(SACNT);
           If  %len(%trim(SACODE)) = 1;
             SACODE = '0' + %trim(SACODE);
           Endif;
           SQLStmt = 'INSERT INTO sswdpsa (SAPLCD, SATLCD, SAKDL)';
           SQLStmt = SQLStmt + ' (SELECT ocplcd, octl'+SACODE;
           SQLStmt = SQLStmt + ' , OCLA' + SACODE + ' FROM ssc01';
           SQLStmt = SQLStmt + ' WHERE ocplcd=' + apos + plcd + apos;
           SQLStmt = SQLStmt + ' AND OCTL'+ SACODE + '<>' + apos + apos
+ ')';
      /end-free
     C*
     C/Exec SQL
     C+ EXECUTE IMMEDIATE :SQLStmt
     C/End-exec
     C*
      /free
           SACNT = SACNT + 1;
         enddo;

It's not pretty, but it did the trick. :)

Brian.

-----Original Message-----
From: Paul Morgan [mailto:pmorgan@xxxxxxxxxxxxxx] 
Sent: Friday, August 05, 2005 4:02 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Multiple Field Manipulation Ideas?

Brian,

Even though you've posted this to an RPG list have you considered a
brute
force solution using SQL?

INSERT INTO ANOTHERTABLE SELECT RECORDTYPE, CODEA001, CODEB001 FROM
PHYSICALFILE
INSERT INTO ANOTHERTABLE SELECT RECORDTYPE, CODEA002, CODEB002 FROM
PHYSICALFILE
.... repeat the insert statement for all the other fields
INSERT INTO ANOTHERTABLE SELECT RECORDTYPE, CODEA030, CODEB030 FROM
PHYSICALFILE

Simple and direct but not very efficient as you're reading through the
physical file 30 times.

You could do a brute force solution in RPG with one READ followed by 30
WRITEs.  Why risk coding problems with nested loops or arrays when the
brute
force method will get the job done.

KISS,
Paul


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.