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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ECGateway script question

Status
Not open for further replies.

jvvolkman

Programmer
Mar 15, 2004
24
US
Is there a way in ECGateway scripts to include some sort of "if statement"? My script is to go out to a BBS and pick up files. I have a lot of "WAITFOR" commands based on files existing. However, if no files exist, a different string is displayed and the script times out because the expected string does not show. Upon exit, when checking "LastStatus", it comes up as failed because of the timeout. Does anyone know of a way to get around this? Thank you!
 
I was having the same problem so instead of scripting it in Gateway I used the scheduler that Sybase includes w/ the EDI Products CD.
Scheduler watches the directory for a new file
- If FileExists it kicks off the GW script
- Trigger-1 is copied & renamed as Trigger-2
The next scheduler task watches for the existence of Trigger-2 - this runs the same GW script.

In the beginning of the script add a line to delete Trigger-2 & at the end copy in Trigger-2 so the scheduler will kick off.

I know this doesn't directly answer your question but is an easy work around.

Good Luck,
~D
 
The only problem with using scheduler to watch for the file is that the directory is not visible to Gateway. The script is actually dialing out to retrieve the files. I did a workaround on it, although it's not the best solution. If there are no files to pick up, a different prompt is displayed. I'll WAITFOR the expected string (files exist). If I timeout on this part, I'll enter a prompt that I expect when files do not exist. If this part times out, then I have a problem. Otherwise, I'll continue on and check for FileExist. Thanks!
 
If your script dials out why couldn't you test for FileExists or GetNextFile

If LastStatus = Fail
Goto EXIT
If LastStatus = Successful
File is there - process it then delete or archive it.

You could loop back to the point of file checking until all files are processed.
 
My Gateway Process checks for FileExist and does a GetNextFile after the dialup to the vendor is complete. The script that I'm writing is a Com Channel script. Here's part of the script:
(dials out & sends user ID/password first...)
ON_TIMEOUT_GOTO :NOFILES
WAITFOR "<RETURN> to continue ->"
SEND "^M"
WAITFOR "Selection:"
SEND "D^M"
PAUSE 2
WAITFOR "Enter Protocol or Q to QUIT"
SEND "Z"
PAUSE 2
WAITFOR "Enter Y to continue or q to quit "
SEND "Y"
PAUSE 2
WAITFOR "00000000^M^J"
:NOFILES
ON_TIMEOUT_GOTO :TIMEOUT
SEND "Q^M"
WAITFOR "Selection:"
SEND "Q^M"
END
:TIMEOUT
END

If there are no files to receive, that last "WAITFOR" times out because the expected prompt does not appear and a different prompt is displayed. I solved the problem by doing the "ON_TIMEOUT_GOTO :NOFILES".
Once the script is done excuting, my Gateway process checks for files and processes them if available.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top