Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running code from memo fields and ExecScript
Message
From
25/02/2008 12:31:49
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01296122
Message ID:
01296126
Views:
14
>>And please, don't tell me that it's not a good idea, I know that - but I've inherited this application and can't do anything about it besides make it work.
>>
>>This is an EDI 270/271 processing application. The application takes a .dbf and converts it into a 270 (request for coverage information) file which is then sent (by modem) to an insurance carrier.
>>
>>Here's the scenario:
>>
>>the 270 creation process for North Dakota refuses to run from the memo file.
>>
>>Code leading up to call is:
>>
>>From carr_up.prg (uploading program)
>>
>>ExecMemo("carrier.carr_270", InputTableName)
>> This is a UDF which takes the parameters passed and builds a params list
>> to pass to ExecScript Fox function
>>
>>FUNCTION execMemo(memoString, p1, p2, p3, p4, p5)
>>	* execMemo can be used to execute any string.
>>	* the function has been programmed to be called from the queue function which
>>	* sets the record location in the queue as well as the carrier
>>	* error processing in the catch block requires the correct
>>	
>>	* set variables to restore program to it's original state
>>	LOCAL cDir, cAlias, pList, retVal, cError, cMsg, mField
>>	cDir = FULLPATH("")
>>	cAlias = ALIAS()
>>	pList = ""
>>	mField = STRTRAN(memoString, 'carrier.', '')
>>	*create a paramater list to do macro substitution when calling prog
>>	FOR i = 2 TO 6
>>		IF PCOUNT() >= i THEN
>>			pList = pList + ", p"+ALLTRIM(STR(i-1))
>>		ENDIF
>>	ENDFOR
>>	
>>	TRY
>>		retVal = EXECSCRIPT(&memoString. &pList.)
>>	CATCH TO oError
>>
>>
>>Running any other carrier's memo field works fine. Running North Dakota's memo field produces a "Syntax Error" (Error #10) at the ExecScript line.
>>
>>I have deleted the record in the Carrier table and created a new record. Same results.
>>
>>If I run the 270 process from the .prg file it comes from, it works just fine. I'm vexed...seriously vexed.
>>
>>Any suggestions?
>
>You missed a comma in EXECSCRIPT:
>retVal = EXECSCRIPT(&memoString. [,] &pList.)

That's true. Then only those that had an empty pList would work.
Previous
Reply
Map
View

Click here to load this message in the networking platform