|
This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] Frank, Jim's method is good. Some might argue that you could use a bunch of I specs to define your file, like: I A 1 5 ALPHA5 I P 6 7 0PACKED3 However if you truly have "funky" data in the file then you will need to evaluate each field prior to using either Jim's method, or the I spec method. For example, testing that a number is numeric, and that sort of rot. Granted there are some compiler options to ignore decimal data errors but you will need to process that accordingly. Maybe their definition of "funky" data is multiple record formats? A common practice years ago was the following sample data: H0000001CUST0123 DITEMXYZ000025 DPRODABC000040 H0000002CUST0456 DBUBBATY000500 Reading this the first H record is a header, with order number 0000001 to customer CUST0123. On this order they purchased 25 of ITEMXYZ and 40 of PRODABC. The next order, 0000002 to customer CUST0456... Are you getting the pattern? This is still done in EDI because you pay by the character to the Value Added Networks. If this is their concern then using internally defined files with the following might be the ticket: IMYFILE AA 01 1 CH I A 1 1 RECID I S 2 8 0ORDER# I A 9 16 CUST# I BB 02 1 CD I A 1 1 RECID I A 2 8 ITEM# I S 8 14 0QTYPUR Of course you could still use Jim's method, but just set up two data structures and set the pointer to the right data structure based on RECID. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Frank W. Kany IV" <frank.kany@burr-reid.org> Sent by: rpg400-l-admin@midrange.com 05/09/2002 02:15 PM Please respond to rpg400-l To: "RPG Mailing List" <rpg400-l@midrange.com> cc: Fax to: Subject: program defined Input file - examples please This is a multi-part message in MIME format. -- -- [ Picked text/plain from multipart/alternative ] ----- Original Message ----- From: Frank W. Kany IV To: rpg400-l-request@midrange.com Sent: Thursday, May 09, 2002 3:11 PM Subject: program defined Input file - examples please I have a physical file that has "funky" data in it. I was told I had to internally define the file in my RPGIV program because the program would "bomb" if I were to do a READ operation on the file. I've never done this. I've always used externally described files. Does anyone have an example of internally describing a file? When it's internally defined, can the program do operations such as SETLL and READE or do I have to read each record to find the record I want? I found the following code from Jim Langston in the midrange archives: ============================================ When you open the file in your program open it like this: FARFILE UF F 222 DISK D FileNM_DS E DS ExtName(ARFileNM) D Based(FileNM_DS@) D Prefix(NM_) D FileNM_DS@ S * IARFile NS I 1 222 ARBuffer C *InzSR BegSR C C Eval FileNM_DS@ = %Addr(ARBuffer) C C EndSr Where: ARFILE = Your existing file with data ARFileNM = Your new empty file with correct DDS =============================================== Is the above code the easiest way to internally define a file. If so what would the READ or SETLL operation look like. TIA, Frank Below is a query output I ran on the file. -- [ weird data.gif of type image/gif deleted ] -- _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.