chilloutdude
15th May 2002, 19:37
Hi
I am selecting some data from baan and sending to a flat file. is there a utility where I can sort the data of the flat file and read the through seq.read() and send it again based on my requirements.

we are on BaanERP running on windows NT.

thanks in advance.

steveauckly
15th May 2002, 21:26
I'm not sure if this works in ERP, but it does in IVc:

e = run.baan.prog("sort",input.filename & " -o " & output.filename,RP_WAIT)

Good luck!

steveauckly
15th May 2002, 21:31
I forgot to mention the sort starts in the first position of each line, so you will have to write the fields in the order you want them sorted.

chilloutdude
15th May 2002, 21:36
can you give sample program for sort????

~Vamsi
15th May 2002, 21:39
The Baan sort I believe has the same options as its *ix cousin. Here is a link to a man page of sort if you don't have access to an unix box:

http://www.nevis.columbia.edu/cgi-bin/man.sh?man=sort

NPRao
15th May 2002, 22:12
I also found baan execute-able on our unix installation,

$BSE/bin/sort6.2

I think it works the same as the unix sort, I never used it yet.

>sort6.2 ---
Usage: sort [-qe error-file] [-funbirdcmt'x'] [+beg_pos[-fnbird]] [-end_pos]] [-
{o|qo} outfile] [file] ...


those are the baan specific sort options, I think it might be available and work in the baan windows installation too.

mark_h
15th May 2002, 23:18
Just in case you did not see this post. Here is another example of coding where run.baan.prog and sort is used. Follow this link (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=1908).

Mark

evesely
11th June 2002, 18:15
I tried to just do a simple example of sort on a IVc3 unix system. Here is the code I used:


prn.cntr = run.baan.prog("sort", "/usr2/baan/ivc/bse/tmp/test.in -o /usr2/baan/ivc/bse/tmp/test.out", RP_WAIT)


Each time I run this, the return value is 1 and no file is created. Am I specifying something wrong, or are there settings I need to check? Sort works fine in the shell, so I'm a bit perplexed.

mark_h
11th June 2002, 19:09
Is the sort.in file being created in the script? Could it still be open? Make sure the sort.in file is closed. The format looks correct and when I run the baan sort6.1 with a format like yours it works.

Mark

evesely
11th June 2002, 20:01
It wasn't an issue with the file being open -- good idea. I think it may be a permission issue. I was running this using BW with a "-- -set USER=" option. The id in the USER option is not a valid unix user, although the user listed in the "connect as" section is. Anyway, when I removed the USER option, it worked.

On another related note, I also tried running sort through Baan using the -k construct, since my man pages indicate the + and - constructs are obsolete. Well, -k works in the unix sort, but not in the version (sort6.1) activated by run.baan.prog.

Fun, fun, fun...:)

NPRao
11th June 2002, 20:11
Hi Ed,

If you like to use the Unix sort program instead of the BaaN Sort program...

you have to use the command, shell() instead of run.baan.prog()

mark_h
11th June 2002, 20:38
Ed,

I thought about permissions but blew it off because it looked like it was in the BSE$/tmp directory. But I based this on our system and that was a bad assumption on my part.

Glad you got it working - but I would not have expected the -- -set USER to cause a problem. We use the same UNIX logon for both test and production, but different Baan logons for all companies other the production. So when I logon to the test company I have to use the -- -set USER option. I would actually expect the problem to be at the UNIX level, possibly how the file was created. When we create files (using Baan) in the $BSE/tmp directory they have rw for both user and group - so in theory I can sort other users files.
But I have been wrong before and I guess it would really depend on how a system was setup(umasks,user groups, etc.).

Mark

~Vamsi
11th June 2002, 22:07
shell() is deprecated. Please use run.prog() instead.

Anshu_Jain
16th June 2008, 15:06
I'm not sure if this works in ERP, but it does in IVc:

e = run.baan.prog("sort",input.filename & " -o " & output.filename,RP_WAIT)

Good luck!
cheers Steve,

very useful info...
made my day..solved my sort issue.

thanks
Anshu