SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
LineCount.exe usage help needed

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
LineCount.exe usage help needed
Author Message
mgiusto



Joined: 01 Mar 2007
Posts: 3
Country: United States

Post LineCount.exe usage help needed Reply with quote
I have a 24x7 Scheduler job that runs each morning, the job just kicks off a batch file (.bat) at the command prompt. This batch file runs some processes and creates some files for my users.

After the files are created, they are copied to the production environment for my users replacing what was there from the day before.

Sometimes the file creation process fails on SOME of the files it is creating and the file sizes are very small but are unusable. These unuseable files affect the working ones, so I would like to not copy the error files to the production environment if the linecount of the file is <= 10.

How can I use the linecount.exe program to check the file size, then have my scheduled job determine whether to copy the file to production or not?

Do I have to re-create what is in my batch file into a 24x7 JAL script? If so, what is the code for the linecount.exe section to determine the file size and then copy or not copy the file to Production if it is less that 10 lines?

A BIG Thank you to anyone who can help!!!!

mgiusto
Thu Mar 01, 2007 9:43 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Reply with quote
You can do it both in JAL and in batch files. . If you decide to stick with a batch file I can suggest the following menthod.

Split your batch file in two. Use one file just to run line count and copy operations, use another file to do file serach and call the first batch in a loop, something like the following

Code:
FOR %%f in (C:\path\to\source\files\*.*) DO call copy_file.bat %%f



The copy_file.bat would run the LineCount and analyze the exit code. If the value is 10 or greater the copy file, otherwise print error message and do nothing. Note that the exit code matches number of found lines in the file specified on the command line.

Code:
LineCount C:\path\to\source\files\%1
if %ERRORLEVEL% < 11 goto SKIP
copy C:\path\to\source\files\%1 C:\path\to\destination\files\%1
goto DONE

:SKIP
echo *** ERROR: File %1 is too small

:DONE

Thu Mar 01, 2007 11:07 am View user's profile Send private message
mgiusto



Joined: 01 Mar 2007
Posts: 3
Country: United States

Post Reply with quote
Thank you for all the help! I will stick with batch files since you provided the exact code needed, THANKS AGAIN!

I think I am close, but I do get an error when the linecount.exe is called,
It seems as though the %1 is including the file path, so it outputs it twice.

This is a problem because I do need the filepath for where the files are located
and I need a separate file path for where I need to copy them to if files are good.
with %1 including the path of the originating files, this won't work.

Do you know the workaround?

---------------------------------------------------------------------------------
S:\> s:\diver\dsc\LineCount.exe S:\diver\dsc\test\S:\diver\dsc\test\0612ex_m.mdl


LineCount version 1.00
Copyright (c) 2006 SoftTree Technologies, Inc.

---------------------------------
Total files found: 0
Total lines in found file: 0

< was unexpected at this time
if 0 < 50 goto SKIP

---------------------------------------------------------------------------------
Also notice the error in bold above. I removed the path from the copy_file.bat file which should work fine, but I still receive this error.
Fri Mar 02, 2007 9:36 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Reply with quote
Try "help for" from the DOS command line, in the printed options see syntax for %~nxI modifier. Using this modifier will provide you with the file name without path
Fri Mar 02, 2007 10:18 am View user's profile Send private message
mgiusto



Joined: 01 Mar 2007
Posts: 3
Country: United States

Post Reply with quote
sysOp,

I was able to clean up the path doubling, but still get the error on checking that the length is less than 50:

< was unexpected at this time
if 0 < 50 goto SKIP
Fri Mar 02, 2007 2:37 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Reply with quote
Please try this
Code:
if %ERRORLEVEL% LEQ 50 goto SKIP



For more info please run "help if" from DOS prompt
Fri Mar 02, 2007 11:54 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.