View Single Post
  #11  
Old 4th June 2008, 09:47
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,051
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
loveneesh,

Few things I noticed is the use of shell() commands. You are hard-coding the OS commands into Baan code, instead of using the available tools functions. Refer to the Programmer's manual - Directory and file operations synopsis
You can replace all the cp, mv, rm commands by file.cp(), file.mv() and file.rm() which are platform independent.
Quote:
ls.path.name = "ls " & strip$(path.input.o) &" > " & strip$(path.log.o) & "/CSCN_ASN_files"
ret = shell(ls.path.name, 0)
Refer to the thread for the sample code to read the files in the directory - reading Ascii file
The script does need some code clean up to use arrays, coding standards etc.
Code:
if not valid.asn.file.new() then
	err.hap = tcyesno.yes
	return
else
	seq.close(fp)
	return
endif
...
        db.insert(ttdwms608,db.retry)
        commit.transaction()
The file pointer should be closed before the 1st return. The other statement will fail in case of duplicate records, missing db.skip.dupl option.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao

Last edited by NPRao : 5th June 2008 at 22:24.
Reply With Quote