Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rpg file output with delimiters

Status
Not open for further replies.

LUEBBKEVIN

Programmer
Apr 30, 2002
35
US
i've been assigned a project to pull data from various rpg files where the dds has around 200 bytes. they want the output in a delimited file where each line can be only 80 bytes long. each field begins with a prefix. the typical field is constructed in this manner

*customername=variable

where anything to the left of the = is a constant and the data to the right is the variable data pulled from the files.

i have a couple methods in mind one of which involves cat and substr but that would really be labor intensive. as a twist, they also state that if the variable value is blank (all fields are char) then don't send it.
 
If each line is the same data layout (or even multiple) you can put the record into a data structure (suggested) or an array.

Code:
D MyDS           DS
D  Field1              1     5
D  Field2              6    10
.
.
.
D  Fieldx            195   200

I hope this helps. Mike Wills
AS400 Programmer
[pc2]

Please, if you find my post useful, let me know. [thumbsup2]
 
I'm sort of debating on what way to do this right now. I'm thinking of an array, data structure or just parsing out one long string. Actually, given the latest caveat the string parse may be the best. I've been told that if a variable from the file has blanks (all char fields) then don't send anything (not even the prefix). so by loading it all into one long string all i'd have to do is parse it into 80 byte records based upon the space and astrick combination on each prefix. exactly how to go about determining the 80 limit is something i'm looking into now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top