Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set capture path Archive - on fail goes to anypath 1

Status
Not open for further replies.

waterfire

Programmer
Jul 26, 2006
4
US
Hello,
This forum has been helpful in keeping my sanity with code syntax. Especially when folks say code works sometimes. This is my first post. Thanks to all for your inputs.

I am monitoring product testing and archiving the results to local C drive path and archiving to a mapped shared drive path. The archive works great when all paths exist. Testing success is flaky though.

PROBLEM: When the mapped path is physically removed, ASPECT just writes to any previous working path and indicates the write was SUCCESS.

["set capture path Archive"] where string "Archive" contains the full shared pathname, was placed before each File command such as SBSAVE ISFILE FWRITE and FOPEN etc.

QUESTION 1.) How can ASPECT be forced to FAIL a command if the capture path desired is not found?

QUESTION 2.) Also, FWRITE and FPUTC are not working to write a "stamp of verification" string to the archived result file.


Below is a paste from the subject program (all indents are removed):

;;;;;;;;;;;;Code Paste, ProComm Ver 4.8 ;;;;;;;;;;;;;;

set capture path LogPath ;Set local LogPath just prior to saving.
sbsave FILE SerialNumStr APPEND ;GOLD line to save buffer to LogPath Path.
pause 1
set capture path LogPath
isfile SerialNumStr
pause 1 ;may need to be 4 secs for international delay
if success
termmsg "`r`n"
Fname = SerialNumStr ;File to check and stamp.
termmsg "RESULTS Captured at Log Path `"%s`r`n" LogPath
set capture path LogPath
if fopen 0 Fname READWRITE ;Open file for readwrite.
pause 1
fwrite 0 "**********************************************" 46
fwrite 0 "* PASSED POWER_UP SCREEN. Unit is shippable. *" 46 ;Write string to file.
fwrite 0 "**********************************************" 46 ;Write string to file.
fclose 0 ;Close the file.
termmsg "Local archive done.`r`n"
goto VPN_ARCHIVE
else
set Terminal Colors 2 ;set the terminal colors to index 2 red, fail
termmsg "TEST FAILED.`r`n" ;archive VERIFICATION FAILED so therefore TEST FAILED
termmsg "Local Archive Verification FAILED. "
termmsg "This workstation must have valid pathname.`r`n"
termmsg "Contact Test Engineering!`r`n"
goto VPN_ARCHIVE
endif
;;;;;;;;;;;;;;;;;;;;;;end paste;;;;;;;;;;;;;;;;;;;;;;


Thanks.
 
I fixed Question #1 by testing [set path] SUCCESS earlier at "set path" rather than testing after the file write with ISFILE. If [set path] fails, ProComm correctly just uses the last known good set path.

;;;;;;;;;;;;;;;;;;new test;;;;;;;;;;;;
set capture path LogPath ;Set local LogPath just prior to saving.
If FAILure
set Terminal Colors 2
termmsg "`r`nTEST FAILED.`r`n"
termmsg "Local Archive Path Failed: `"%s`r`n" LogPath
termmsg "Contact Test Engineering!`r`n"
goto XFER_FAIL
endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Any known issues using [FWRITE 0 "text" 4] would be appreciated. Index clarifications?

Thanks.
 
Fixed original QUESTION #2: Fwrite requires the full pathname to be in the filespec. I used strinsert to put pathname in front of variable containing the .txt file.

Does anyone know how to prevent Fwrite from overwriting the first few lines of text at the top of an existing .txt file?

My current workaround is to shrink charcter set on Fwrite from 46 to 33 characters, and add several new lines to original file at the top before stamping it.
 
use:
if fopen 0 file_name WRITE
fseek 0 0 2 ; Put pointer at end of file.

endif


To go where no programmer has gone before.
 
Thanks dbsquared,

Tried various versions: [fseek 0 0 2] [fseek 0 0 0] etc, but still did not fix overwrite issue. I will work issue later as time permits; have to finish rest of this project and release on 8/1/06.
 
try

string1="**********************************************"
string2="* PASSED POWER_UP SCREEN. Unit is shippable. *"
string3="**********************************************"

if fopen 0 file_name WRITE
fseek 0 0 2 ; Put pointer at end of file.
fstrfmt 0 "%s:" string1
fstrfmt 0 "%s:" string2
fstrfmt 0 "%s:" string3
fclose 0
endif


To go where no programmer has gone before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top