SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Array type parameter

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Array type parameter
Author Message
~Joe



Joined: 18 Dec 2003
Posts: 42

Post Array type parameter Reply with quote

I am reading in a set of values from a listoffiles.txt that I need to compare against a set of values I read in from another file.

Unfortunately this generates a bunch on unnecessary DISK i/o. The first loop reads in the file I want to process. The loop below reads in a 10 to 12 files. If there is a match I do not process the file. When I am processing 26,000 files from loop 1, I do not want to have to read the exclude file for 26000 times, once for each file.

Code Sample
.....
//This should be a good file. Lets process it.
FileOpen iExcludeFile, "LineMode", "READ", TRUE, iExcludeFileNum
EOF (iExcludeFileNum, iExcludeEOFTest)

LoopUntil (iExcludeEOFTEST, EndeLoop)

FileRead (iExcludeFileNum, iExcludeFileVar)

gettoken "," iExcludeFileVar, sFileExt

trim (sFileExt, sfileExt)

upper (sFileExt, sFileExt)

//POS (sFileExt, iFileVar, 1, iExcludeInstr)

ChooseCase (sfileExt, ExcludeProcessFile)

CASE ""

//Empty String

Goto ExcludeProcessFile

CASE " "

//Empty String

Goto ExcludeProcessFile

Case "REM"

//Comment

Goto ExcludeProcessFile

CaseElse

Match iFileVar, SfileExt, iExcludeInstr

IFthen (iExcludeInstr, OkKeepFile)
//a file extension we want to keep was identified in the string. Skip the File

ExcludeProcessFile:

EOF (iExcludeFileNum, iExcludeEOFTest)

EndeLoop:
.....

I tried to read the iexcludeFile's contents into a variable ".bat .exe .TXT" and use the MATCH command against iFileVar "C:\temp\deleteme.doc" with out any success.

In VB I would read the values into an array similar to Files2Var(i) and I would be increase "i" by one each time I read in a new line. The I would simply loop through the array each time jump into the loop.

I hope my question is clear. Do you have a suggestion to address this?

Thank you

~Joe

Wed Jun 09, 2004 6:33 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: Array type parameter Reply with quote

My suggestion is to apply the proper tool for the job. 24x7 supports both JAL and VbScript jobs why don't you use VBScript instead of JAL? File operations in VBScripts should be much faster.

By the way, in your JAL script you should use IsEqual insted of Match to compare 2 values. You can also read the entire file into memory using FileReadAll then simply do a search like InStr( FileVar_contents, "\r\nEXT\r\n", 1, iPosVar ). Then if iPosVar >0 process the file otherwise skip it.

: I am reading in a set of values from a listoffiles.txt that I need to compare
: against a set of values I read in from another file.

: Unfortunately this generates a bunch on unnecessary DISK i/o. The first loop
: reads in the file I want to process. The loop below reads in a 10 to 12
: files. If there is a match I do not process the file. When I am processing
: 26,000 files from loop 1, I do not want to have to read the exclude file
: for 26000 times, once for each file.

: Code Sample
: .....
: //This should be a good file. Lets process it.
: FileOpen iExcludeFile, "LineMode", "READ", TRUE,
: iExcludeFileNum
: EOF (iExcludeFileNum, iExcludeEOFTest)

: LoopUntil (iExcludeEOFTEST, EndeLoop)

: FileRead (iExcludeFileNum, iExcludeFileVar)

: gettoken "," iExcludeFileVar, sFileExt

: trim (sFileExt, sfileExt)

: upper (sFileExt, sFileExt)

: //POS (sFileExt, iFileVar, 1, iExcludeInstr)

: ChooseCase (sfileExt, ExcludeProcessFile)

: CASE ""

: //Empty String

: Goto ExcludeProcessFile

: CASE " "

: //Empty String

: Goto ExcludeProcessFile

: Case "REM"

: //Comment

: Goto ExcludeProcessFile

: CaseElse

: Match iFileVar, SfileExt, iExcludeInstr

: IFthen (iExcludeInstr, OkKeepFile)
: //a file extension we want to keep was identified in the string. Skip the
: File

: ExcludeProcessFile: EOF (iExcludeFileNum, iExcludeEOFTest)

: EndeLoop: .....

: I tried to read the iexcludeFile's contents into a variable ".bat .exe
: .TXT" and use the MATCH command against iFileVar
: "C:\temp\deleteme.doc" with out any success.

: In VB I would read the values into an array similar to Files2Var(i) and I
: would be increase "i" by one each time I read in a new line. The
: I would simply loop through the array each time jump into the loop.

: I hope my question is clear. Do you have a suggestion to address this?

: Thank you

: ~Joe

Wed Jun 09, 2004 9:47 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.