suhas-mahajan
23rd July 2008, 14:24
Hi Friends,

I would like to make a session for generating flat files having fixed length columns/records for last three months data.

I could use ttaad4226m000 but you know I cant specify date there.

I have created a session which uses concat$ but the problem is it cant create fixed length columns per record.

Can you put some light?

regards,

-Suhas

george7a
23rd July 2008, 14:54
Hi,

This link might help:
http://www.baanboard.com/baanboard/showthread.php?t=42287

You can generate the Excel file then save the file as you wish.

- George

mark_h
23rd July 2008, 15:29
Or use sprintf$. You might have to convert some strings (or declare them) as fixed.

suhas-mahajan
24th July 2008, 08:15
Hi George,

Thanks for the link. But unfortunately, there is no functionality to extract fixed length columns. You can see my comments there.

Hi Mark,

I dont think sprintf will work correctly. Because if you see seq. dump with fixed length of tdsls045, you will see BaaN coverts 0 into big exponential format.

Is there any clue/logic, how ttaad4226m000 works with fixed length column?

regards,

-Suhas

norwim
24th July 2008, 09:02
Hi suhas,

first suggestion: use bdbpre and then pipe to a 3 line awk script to "swallow" records which are too old.
second thought: for some old fashioned data exchange formats we do produce fixed length records without difficulty. Here is a sniplet of code how I do this:
----snip-----
zeil=string.set$(" ",129)
zeil(1;4)="01D1"
zeil(5;3)=sprintf$("%03d",lfd)
zeil(8;10)=mycuno
zeil(18;35)=nama
zeil(53;35)=namb
if tcmcs080.cfrw="S25" then
zeil(100;3)="OHL"
endif
zeil(129;1)=chr$(13)
seq.puts(zeil,filpo)
----snap---------
Notice how displacement 88 to 99 are neglected without any effect .... the variable "namb" is declared as string(30), not (35) nor fixed.

hth

Norbert
Norbert

mark_h
24th July 2008, 14:51
Hi Mark,

I dont think sprintf will work correctly. Because if you see seq. dump with fixed length of tdsls045, you will see BaaN coverts 0 into big exponential format.

Is there any clue/logic, how ttaad4226m000 works with fixed length column?

regards,

-Suhas

Sprintf will work - you are doing the conversion with the formating. Here is an example - you can remove the fixed from buff1 and see what I am talking about. With buff1 fixed you get 132 characters in the line, with it unfixed you get a total of 40 characters in the line.


function testfile()
{
domain tcmcs.str132 buff1 fixed
error.file.name = "testit"
errfile = seq.open(error.file.name,"w")
select tiitm001.*
from tiitm001
where tiitm001.item like "MS28775.*"
as set with 10 rows
selectdo
buff1 = sprintf$("%32s %08.4f", tiitm001.item, tiitm001.avpr)
rc = seq.puts(buff1,errfile)
endselect
seq.close(errfile)
}

suhas-mahajan
28th July 2008, 11:54
Hi Norbert and Mark,

I already applied suggested solutions and seem its working perfectly.

Thanks.

regards,

-Suhas