JavaScript Editor js editor     Web development 

Main Page

Creates an array and populates it with information about the current state of the call stack.




Specifies the name of the array to store information about the call stack. The following table describes the information returned by the ASTACKINFO(В ) function:

Array Element Description


Call Stack Level


Current program filename


Module or Object name


Module or Object Source filename


Line number in the object source file


Source line contents

Return Value



ASTACKINFO(В ) populates an array with information about the entire calling stack. It combines functionality of SYS(16) and PROGRAM(В ) functions while adding new support for line numbers at each call stack level. The value returned is the number of program levels or rows of the returned array.

ASTACKINFO(В ) only populates the 6th array element if source line contents are available, otherwise it will be left empty.

ASTACKINFO(В ) provides, in the 2nd and 4th elements respectively, the name of the current file and, if the file is bound in an APP or other separate file, a full path name to the binding program.

The 4th element contains the original source file information. For objects, this is same information returned by SYS(16), even when bound inside of applications.

ASTACKINFO() might not be able to retrieve information about program (.prg) files. In this case, Visual FoxPro displays the 2nd element similar to the SYS(16) function. For more information, see SYS(16) - Executing Program File Name.


A modeless form bound in an APP file ( with a button from buttons.vcx class (also in the APP). The developer runs in Visual FoxPro to display the form (the form remains open because this is not run time Visual FoxPro). When the user clicks the button to run the report, the report (which exists outside of calls a query form in its BeforeOpenTables event.

This query form (getcusts.scx), which resides inside of, issues a call to ASTACKINFO(В ) [then displays the resulting array as in the following example].

В Copy Code
(1,1)   1                                    && Stack level = 1
(1,2)   c:\vfp\                        && Current program
(1,3) frmRerport.PrintReport.Click         && Object
(1,4) c:\vfp\myclasses\buttons.vct         && Object source file name
(1,5) 42                              && Line number in the source 
(1,6) THISFORM.DoReport()                  && in the source 
(2,1)   2                                    && Stack level = 2
(2,2) c:\vfp\
(2,3) frmRerport.DoReport
(2,4) c:\vfp\forms\frmRerport.sct         && Module source file name
(2,5) 31
(2,6) DO RunListReport                     && in the source 
(3,1)   3                                    && Stack level = 3
(3,2) c:\vfp\
(3,4) c:\vfp\programs\runlisterport.prg   && Module source file name
(3,5) 12
(3,6) REPORT FORM myreport1.frx            && in the source 
(4,1)   4                                    && Stack level = 4
(4,2) c:\vfp\reports\myreport1.frt
(4,3) myreport1.DataEnvironment.BeforeOpenTables
(4,4) c:\vfp\reports\myreport1.frt          && Module source file name
(4,5) 31
(4,6) DO FORM getcusts                     && in the source 
(5,1)   5                                    && Stack level = 5
(5,2) c:\vfp\
(5,3) getcusts.init
(5,4) c:\vfp\forms\getcusts.sct            && Module source file name
(5,5) 2
(5,6) ASTACKINFO(myarray)                  && in the source 

See Also

JavaScript Editor js editor     Web development