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

Set Alternate wrote the wrong thing to the output file

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
0
0
US
In FPW26a, I am writing a program using SET ALTERNATE and ?/?? to write transactions to a text output file to send to a vendor (darn mainframe-y vendors). In the middle of one of these output lines, I had occasion to do a calculation with SUM hours TO mhrsworked ...
Then later on I did a ?? mhrsworked.
What was actually written to the file was the word "hours" from my SUM command. I changed it to hourfile.hours, and lo and behold, the text file got "hourfile.hours".
I fixed this by SET ALTERNATE OFF, then do the SUM, then SET ALTERNATE ON and continue with my ?/?? statements.
In essence, this is the portion of the program:
SET ALTERNATE ON
...
?? field1
?? field2
SUM hours TO mhrsworked...
?? mhrsworked
?? field3
...
SET ALTERNATE OFF

Why would Fox do this?

Regards,
Glenn Koproske
 
My first thought is why would you want to change the record pointer in the middle of outputting data from that record?
I think you should do all your calculations prior to doing any output.

But anyway, did you enclose mhrsworked or hourfile.hours in quotes when you tried to send them to the file?



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thank you for your response.
I certainly should move my calculations further up in the program, prior to when I start writing out the data transactions. With pages and pages of record layout I am trying to recreate, I suppose I was just doing what it took to do each record/field as it appeared on the specs, then move to the next one...

I am not enclosing anything in quotes in the program, if I read your intent correctly...my line of code was quite literally:
SUM hourfile.hours TO mhrsworked ... and hourfile.hours appeared in the output. I put it in quotes only in this post to Tek-Tips to make my explanation more readable.

Regards,
Glenn Koproske
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top