ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Read a flat file and aggregate the value and write to another file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read a flat file and aggregate the value and write to another file

    Hi,

    I have a flat file. I need to aggregate the value of a particular field and then write this record into another flat file. Please share some sample codes.

  • #2
    Re: Read a flat file and aggregate the value and write to another file

    Do you know SQL?
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Read a flat file and aggregate the value and write to another file

      Originally posted by iris.west2015
      I have a flat file. I need to aggregate the value of a particular field...
      A "flat file" normally wouldn't have a "particular field". Each line (or each 'record') would be a single 'field'.

      Can you clarify just what you actually have to work with?
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: Read a flat file and aggregate the value and write to another file

        Here's one way. Change the specifics of course.


        Code:
             FFILEA   IP  F      32            DISK
             FFILEB   O   F      32            DISK
             IFILEA    
             I                                       10  150AMOUNT
             C                     ADD  AMOUNT    TOTAL  150
             OFILEB   T        LR
             O                         TOTAL     15

        Comment


        • #5
          Re: Read a flat file and aggregate the value and write to another file

          Why even bother to summarize a table to stuff into another table. I bet you are then using this table to put into another table. Skip this altogether and just use SQL.
          Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

          Comment


          • #6
            Re: Read a flat file and aggregate the value and write to another file

            Homework seems pretty simple - is this an RPG II class?

            Comment

            Working...
            X