Export Problem

Richard Kreiss rkreiss at gccconsulting.net
Tue May 7 07:07:30 PDT 2013



> -----Original Message-----
> From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
> [mailto:filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com] On
> Behalf Of Jerry Crespi
> Sent: Monday, May 06, 2013 6:59 PM
> To: filepro-list at lists.celestial.com
> Subject: Export Problem
> 
> Here is some sample code that should work, but doesn't.
> I want to export all the fields in a file, using an array and a looping counter.
> The result is a file that has one field per record, rather than 125 fields per
> record.
> Ideas anyone?  What am I doing wrong?
> 
>      ACTION             D E F I N E   P R O C E S S I N G
> -------------------------------------------------------------
>    1  -------   -   -   -   -   -   -   -   -   -   -   -   -
>         ? If:
>         Then: fn="/appl/fpmerge/exported.csv"
>    2  -------   -   -   -   -   -   -   -   -   -   -   -   -
>         ? If:
>         Then: ct(3,#)="1";dim fld(125):1
>    3  -------   -   -   -   -   -   -   -   -   -   -   -   -
>         ? If:
>         Then: export word fil=(fn)
>    4  -------   -   -   -   -   -   -   -   -   -   -   -   -
> again  ? If: ct le "125"
>         Then: fil[ct]=fld(ct);ct=ct+"1";goto again
>    5  -------   -   -   -   -   -   -   -   -   -   -   -   -
>         ? If: not fil
>         Then: end
>    6  -------   -   -   -   -   -   -   -   -   -   -   -   -
> 
> 
> 
> Jerry Crespi, Ph.D.
> President
> Allied Business Systems Inc.
> the people systems people
> V. (714) 963-5554 Ext 4

Why not create one temporary field to hold all of the value and the use your array to fill that field.

Declare HoldIt

again  ? If: ct le "125"
>         Then: HoldIt=HoldIt&fld(ct);ct=ct+"1";goto again
If:
Then: export word fil=(fn)
If:
Then: fil(1)=HoldIt{"";write fil;END

Note that I used & to maintain the field lengths.  This would allow you to use a mid statement to get and any of the field values.

You could substitute { (push left and leave no spaces) to reduce the size of the field being exported.  If you do this, you might want to use a field separator which would allow you to get at any information more easily.


Richard Kreiss
GCC Consulting

Office: 410-653-2813




More information about the Filepro-list mailing list