Openedge: Export Fixed Length Variables To File

Status
Not open for further replies.
S

SAFTK

Guest
I need to create data files from our OpenEdge database for import to another system. The files are required to have no formatting or delimiters but to use fixed length fields. For example, the importing system is looking for something like what is below, where each field always starts at same place in the file, regardless of the length of the data or even if there is data in that field.

For example, if I export the a temp-table called "contact" that contains first-name, last-name, city, state, spouse-name, and favorite-color, I need the first name to always start on position 1, the last name to always start on position 16, the city to always start on position 31, and so on. It should look like:

Jane Doe Acme NY John Blue
Joe Sixpack Spingfield IL Grey


I can use PUT UNFORMATTED to get rid of the double-quotes around CHAR fields and export without delimiters, but have not been able to force each field to start at the exact same position each time. It comes out looking like:

JaneDoeAcmeNYJohnBlue
JoeSixpackSpringfieldILGrey


Is there a way to do this?

What I've been doing is:

DEF TEMP-TABLE contact
FIELD first-name as CHAR FORMAT "x(15)"
FIELD last-name as CHAR FORMAT "x(15)"
FIELD city as CHAR FORMAT "x(12)"
......

FOR EACH CONTACT:
PUT UNFORMATTED first-name last-name city....
END.

Continue reading...
 
Status
Not open for further replies.
Top