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


  • Subject: Formatting an unformatted file
  • From: Jeff Crosby <jlcrosby@xxxxxxx>
  • Date: Mon, 16 Nov 1998 15:17:01 -0500
  • Newsgroups: as400.general,comp.sys.ibm.as400.misc
  • Organization: Dilgard Frozen Foods

To all,

I am going to be doing an application whereby I must read a file from a
PC that looks like this:

ROUTE "0541"

INVOICE "1234567890"
DELIVER_DATE "19981116"
DELIVER_TIME "121500"
# comment lines start with #
TERMS 01
ADJ_QUANT 1 5 2
ADJ_PRICE 1 5.1295 12.25
ADJ_ALLOW 1 295 "FSPI" $ 2.5051 02

INVOICE "987650"
DELIVER_DATE "19981116"
DELIVER_TIME "131500"
TERMS 01
ADJ_QUANT 1 4 3
ADJ_PRICE 1 4.12 6.25
ADJ_ALLOW 1 295 "FSPI" $ 2.51 02
ADJ_QUANT 1 1 2
ADJ_PRICE 1 4.00 4.10

ROUTE "0545"
INVOICE "1267890"
DELIVER_DATE "19981116"
DELIVER_TIME "121500"
# this is a comment line
TERMS 01
ADJ_QUANT 1 5 2
ADJ_PRICE 1 5.1295 12.25
ADJ_ALLOW 1 295 "FSPI" $ 2.5051 02

INVOICE "987650"
DELIVER_DATE "19981116"
DELIVER_TIME "131500"
TERMS 01
ADJ_QUANT 1 4 3
ADJ_PRICE 1 4.12 6.25
ADJ_ALLOW 1 295 "FSPI" $ 2.51 02
ADJ_QUANT 1 1 2
ADJ_PRICE 1 4.00 4.10

etc, etc, etc.

and put it into formatted OS/400 files.  Consecutive input records can
all relate to what will become a single OS/400 database record.

Blank records and comments are to be ignored.

I have done this on a smaller scale in the past via the Brute Force And
Ignorance Method(1), but I can't believe there isn't an easier way to do
it.  This is not the forte of RPG, though the RPGIV syntax makes it a
lot easier.  Has anyone got or seen a good way that you can point me in
the direction of?  Thanks.

-Jeff

(1) "Brute Force And Ignorance Method" is a registered trademark of Dave
Shaw.  Used here totally without his permission or knowledge.  I'll
probably hear about it too. <g>
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.