From: apocalipsis19 on
Hello Community!

I am working on some imports/exports to be able to satisfy the needs of a
client. The format of the output file must be fixed width. To be brutally
honest, this is the first time that I have to deal with fixed width so I am
stuck. I need to write an interface that extracts data in fixed width format.
Can somebody provide me with some feedback? Any ideas? Any example I can follow?

Thanks a lot!

From: Ian Skinner on
apocalipsis19 wrote:
> I need to write an interface that extracts data in fixed width format.
> Can somebody provide me with some feedback? Any ideas? Any example I can follow?
>
> Thanks a lot!
>


Fixed width is not that big a deal, once you have the map on where each
piece of data starts and stops.

You then just take one line of your data and use simple
mid(line,start,length) functions to grab each desired element from the line.

If you are writing out a fixed width or column delimitated data file,
you will want to make liberal use of the rJustify() and lJustify()
functions to ensure all the widths are placed properly.


From: apocalipsis19 on
Thanks Ian, I will start working on this and I will let you know what I come up with!
From: apocalipsis19 on
I am still stuck in this one. I'd appreciate any example or further ideas. Ian's ideas were great to get me started!
From: Ian Skinner on
apocalipsis19 wrote:
> I am still stuck in this one. I'd appreciate any example or further ideas. Ian's ideas were great to get me started!


Well how are you stuck? It is rather challenging to help, when one does
not really know what to help with.


The basic concept is not much more then this.

<cfset simpleDataLine = '01012008'>
<!--- month is 1:2
day is 3:4
year is 5:8 --->

<cfset month = mid(simpleDataLine ,1,2)>
<cfset day = mid(simpleDataLine ,3,2)>
<cfset year = mid(simpleDataLine ,5,4)>