Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling Procedure in a Program (.PRG)
Message
From
23/10/2018 14:00:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Calling Procedure in a Program (.PRG)
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01662746
Message ID:
01662746
Views:
71
Respected all,

I have a .prg File , in which I have sequence of procedures I have to carry on one by one to get my desired results. Till Now I have kept all procedures in sequence of one another, but since there are many such procedure (Steps) involved and my .prg has become big and less understandable easily.

I am thinking to put procedures at the end of .prg and Call that procedure step by step so that it may be easily comprehended.

For this I have kept one of such Procedure under PROCEDURE LEFTBOX at the end of my .prg file and calling that procedure using DO Leftbox.

The procedure is generating value for it but when it comes back to the main routine it gives error as variable Boxstartrow not found.

If I declare Boxstartrow as PUBLIC, it works fine.

Will I have to declare all such variables as Public, which I am intending to use in procedure or there is some other way also ?

Here is my Code
Do Leftbox

Do abc

Do xyz

*Some Other Code

PROCEDURE Leftbox
Locate For Left(Alltrim(PS),4)='1 w1' AND Right(Alltrim(PS),1)='k'
Replace PS With ;
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1))-15))) ;
PS With ;
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4))-4)))	;
PS With ;		
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2))+4)))
cNEWBOTTOMLINE=Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1)
BOXSTARTCOLUMN=Val(Getwordnum(PS, Getwordcount(PS)-4))
BOXENDCOLUMN=385
BOXSTARTROW=Val(Getwordnum(PS, Getwordcount(PS)-3))
BOXENDROW=BOXSTARTROW+Val(Getwordnum(PS, Getwordcount(PS)-1))
BOXCOLUMNRANGE=385-m.BOXSTARTCOLUMN					
RETURN
Thanks as Always.
Harsh
Next
Reply
Map
View

Click here to load this message in the networking platform