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





So when I read the table, there are records in it that are 61 fields
wide.  I need to take the data from all 60 of these fields (based on the
value of RecordType) and match up CodeA001, CodeB001 to populate another
table.

I've read your message twice, and I still have a very fuzzy idea of how your files are laid out and what the RecordType field's purpose is. I'm not precisely sure how one file correlates to the other.

What's the easiest way to extract this data to migrate it to the new
table?  I mulled over a data area, throwing the files into an array,
throwing them into a temporary table, etc., but I'm not sure what's
best.  Fortunately, the tables used are static at 30 fields per code,
and are not expected to change, so I always know there are 30 fields for
CodeA and CodeB.

I think you probably want to do something like the following (I haven't tested this code so it's probably chock full of errors, but hopefully you get the idea):

     FINPUTFILE IF   E             DISK    BLOCK(*YES)
     F                                     prefix('INPUT.')
     FOUTPUTFILEO    E             DISK
     F                                     prefix('OUTPUT.')

     D Input         E DS                  extname(INPUTFILE)
     D                                     qualified
     D Output        E DS                  extname(OUTPUTFILE)
     D                                     qualified

     D p_inputCodeA    s               *
     D p_inputCodeB    s               *

     D CodeA           s                   like(Input.CodeA001) dim(30)
     D                                     based(p_InputCodeA)
     D CodeB           s                   like(Input.CodeB001) dim(30)
     D                                     based(p_InputCodeB)

     D f               s             10I 0

      /free

          p_InputCodeA = %addr(Input.CodeA001);
          p_InputCodeB = %addr(Input.CodeB001);

          setll *start InputFile;
          read  InputFile;

          dow not %eof(InputFile);

               for f = 1 to %elem(CodeA);
                    Output.RecordType = Input.RecordType;
                    Output.CodeA      = CodeA(f);
                    Output.CodeB      = CodeB(f);
                    write OutputRec;
               endif;

               read  InputFile;
          enddo;

          *inlr = *on;

      /end-free

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.