Extracting data in AS/400

145 pts.
Tags:
AS/400
Data Extraction
I am reading data lines and the fields are 60 characters long. The first line has 1234567890 the second line has ABCDEFGHIJK and the third has 9876543210. I need to reach line and extract each fields data and put into one field where it would look like this '1234567890 ABCDEFGHIJK 9876543210'. The data can be varying lengths. Without using data structures whats the best solution.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Eval Result = %trim(Fld1) +’ ‘+ %trim(Fld2) +’ ‘+ %trim(Fld3)

etc. or
Eval Result = %trim(Result) +’ ‘+ %trim(NextLine)

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Splat
    Post what you've come up with & the problems you've encountered.
    10,890 pointsBadges:
    report
  • ToddN2000
    Concatenating the field is the way to go. The answer above shows the solution in RPG. Do you need to do this process in SQL?
    75,485 pointsBadges:
    report
  • ToddN2000
    You said the data is on three lines? If this is the case you would read line 1, move value to a work field1, Read line 2 move that to a work field2 and then read the third line and move it to a work field3. Then concatenate the three work fields. This will get more tricky if you do not have a full three lines for each. You would need to test to see how many work fields you need to save to make sure there is no wrapping of data.
    75,485 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: