Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Varying results from Routine
Message
 
 
To
08/08/2007 06:38:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP3
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01246723
Message ID:
01246726
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
Hi Andy,

Can you post content of ,"C:\f_getconid2.txt" in case when result is emptry?
BTW, SET EXACT has no affect on your routine. See http://www.berezniker.com/display/VFP/String+comparison+in+VFP for details.

>
>I have a standard routine that I call from a number of places within our application. I have spent the afternoon trying to determine why it is returning the correct value when called from one module and why it returns an empty value when called from within a particular class. In both cases it is being called with identical parameters. I have confirmed that the parameters are identical by writing them out to a text file and examining the file in a hex editor.
>
>I suspect that the behaviour is related to the environment when the routine is called and have compared the results of the "list status to file". Besides there being a lot of other tables open when call that fails runs the SET values are the same.
>
>The code is compiled in VFP6 and has to be in order for our application to be run frm within a third party VFP6 application.
>
>The code is as below:
>
>
>LPARAMETERS tccustid, tcshipid, tcpn
>LOCAL lcConid, lnSelect, lcKey1, lcKey2, lnStart, lcExact, lcError, lcString
>
>lcError = ON("ERROR")
>ON ERROR
>lcExact = SET("EXACT")
>SET EXACT OFF
>
>lnSelect = SELECT()
>lcConid = SPACE(0)
>lnStart = SECONDS()
>
>IF TYPE("GLDEV") = "L" AND GLDEV
>	SET STEP ON
>ENDIF
>
>USE edisd SHARED AGAIN IN 0 ALIAS q_edisd
>USE edish SHARED AGAIN IN 0 ALIAS q_edish
>
>lcKey1 = PADR(ALLTRIM(tccustid),FSIZE("SH_CCODE","Q_EDISH"));
>	+PADR(ALLTRIM(tcshipid),FSIZE("SH_CSHIPID","Q_EDISH"));
>	+PADR(ALLTRIM(tcpn),FSIZE("SH_CPN","Q_EDISH"))
>
>
>lcKey2 = PADR(ALLTRIM(tccustid),FSIZE("SD_CCODE","Q_EDISD"));
>	+PADR(ALLTRIM(tcshipid),FSIZE("SD_CSHIPID","Q_EDISD"));
>	+PADR(ALLTRIM(tcpn),FSIZE("SD_CPN","Q_EDISD"))
>
>lcStatusfile = "c:\status.txt"
>IF !FILE(lcStatusfile)
>	LIST STATUS TO FILE &lcStatusfile
>ENDIF
>
>SELECT MAX(sH_dissue), sH_cPON FROM q_edish;
>	WHERE sh_ccode + sh_cshipid + sh_cpn + DTOS(sH_dissue) = lcKey1;
>	INTO CURSOR q_conid
>lcString = lcKey1 + ":" + lcKey2 + ":"
>
>IF _TALLY = 0 OR EMPTY(sH_cPON)
>	lcKey2 = PADR(ALLTRIM(tccustid),FSIZE("SD_CCODE","Q_EDISD"));
>		+PADR(ALLTRIM(tcshipid),FSIZE("SD_CSHIPID","Q_EDISD"));
>		+PADR(ALLTRIM(tcpn),FSIZE("SD_CPN","Q_EDISD"))
>	SELECT MAX(sd_dissue), sd_cran FROM q_edisd;
>		WHERE sd_ccode + sd_cshipid + sd_cpn + DTOS(sd_dissue) = lcKey2;
>		INTO CURSOR q_conid
>	IF _TALLY > 0
>		lcConid = q_conid.sd_cran
>		lcString = lcString + "by Key2" + ":"
>	ENDIF
>ELSE
>	lcString = lcString + "by Key1" + ":"
>	lcConid = q_conid.sH_cPON
>ENDIF
>
>lcString = lcString + lcConid + ":" + ALLTRIM(DBF("q_edish")) + ":" + ALLTRIM(DBF("q_edisd")) +  CHR(13)
>
>USE IN q_conid
>USE IN q_edisd
>USE IN q_edish
>
>
>=STRTOFILE(lcString,"C:\f_getconid2.txt",.T.)
>
>SET EXACT &lcExact
>ON ERROR &lcError
>
>SELECT(lnSelect)
>RETURN lcConid
>
>
>
>Any thoughts or suggestions most gratefully accepted.
>
>TIA,
>
>Andy
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform