Chapter Contents

Previous

Next
TRACEBACK

TRACEBACK



Displays traceback information for an SCL execution stack

Category: Utility


Syntax
Details
Examples
Example 1: Tracing Program Execution
Example 2: Saving Traceback Information in an SCL List
Example 3: Tracing the Execution Stack and Program Links
Example 4: Comparing Tracebacks With and Without _ALL_
See Also

Syntax

CALL TRACEBACK(<list-id><,'_ALL_'>;

list-id
contains the identifier of the SCL list to store traceback information in. You must create the list before passing it to TRACEBACK. An invalid list-id produces an error condition.

Type: Numeric or List

_ALL_
is the instruction to display the link stack in addition to the SCL execution stack.

Type: Character


Details

The execution stack consists of the program that is currently being executed, plus all programs that were called to display the current program. TRACEBACK displays the execution stack as a list of entry names and associated line numbers. The _ALL_ argument displays the link stack, which lists the labeled sections that are called within the program. The link stack does not include labeled sections that are called with a GOTO statement. The line number for an entry indicates where the entry transferred control to the next entry in the list.


Examples

The following examples use three SCL entries, START.SCL, ANALYZE.SCL, and REPORT.SCL. START.SCL contains a link at line 5 and calls ANALYZE.SCL at line 9. ANALYZE.SCL contains links at line 5, 11, and 16 and calls REPORT.FRAME at line 21.

Example 1: Tracing Program Execution

The TRACEBACK routine is executed at line 6 of REPORT.SCL.

call traceback();
The following traceback list is printed in the LOG window:
In routine: LIB.TEST.REPORT.SCL line 6
Called from LIB.TEST.ANALYZE.SCL line 21
Arguments passed to DISPLAY:
  1 (Character Literal) = 'report.scl'
Called from LIB.TEST.START.SCL line 9
Arguments passed to DISPLAY:
  1 (Character Literal) = 'analyze.scl'

Example 2: Saving Traceback Information in an SCL List

Change REPORT.SCL to save traceback information in an SCL list, and then display the traceback list:

tb = makelist();
call traceback(tb);    /* line 7 */
call putlist(tb, 'Traceback:', 0);
tb = dellist(tb);
This program produces the following output:
Traceback:(LIB.TEST.REPORT.SCL=7
           LIB.TEST.ANALYZE.SCL=21
           LIB.TEST.START.SCL=9
           )[1905]
 

Example 3: Tracing the Execution Stack and Program Links

Change REPORT.SCL to execute a traceback, using the _ALL_ argument on line 6:

call traceback(0,'_all_');
The following traceback list is printed in the LOG window:
In routine: LIB.TEST.REPORT.SCL line 6
Called from LIB.TEST.ANALYZE.SCL line 21
Arguments passed to DISPLAY:
 (Character Literal) = 'report.scl'
Linked from LIB.TEST.ANALYZE.SCL line 16
Linked from LIB.TEST.ANALYZE.SCL line 11
Linked from LIB.TEST.ANALYZE.SCL line 5
Called from LIB.TEST.START.SCL line 9
Arguments passed to DISPLAY:
  1 (Character Literal) = 'analyze.scl'
 Linked from LIB.TEST.START.SCL line 5

Example 4: Comparing Tracebacks With and Without _ALL_

Change REPORT.SCL to execute the traceback without the _ALL_ option at line 8 and to execute the traceback with the _ALL_ option at line 9:

listid1=makelist();
listid2=makelist();
call traceback(listid1);
call traceback(listid2,'_ALL_');
call putlist(listid1,
   'Traceback without LINK stack=',0);
call putlist(listid2,
   'Traceback with LINK stack=',0);
listid1=dellist(listid1);
listid2=dellist(listid2);

This program produces the following output:

Traceback without LINK stack=(LIB.TEST.REPORT.SCL=8
LIB.TEST.ANALYZE.SCL=21
LIB.TEST.START.SCL=9
                             )[1905]
Traceback with LINK stack=(
 LIB.TEST.REPORT.SCL=9
 LIB.TEST.ANALYZE.SCL=21
 LIB.TEST.ANALYZE.SCL=16
 LIB.TEST.ANALYZE.SCL=11
 LIB.TEST.ANALYZE.SCL=5
 LIB.TEST.START.SCL=9
 LIB.TEST.START.SCL=5
                          )[1907]

Note:   541, 1905, and 1907 are the list identifiers that were assigned when these examples were run and may be different each time the examples are run.  [cautionend]

See Also

MAKELIST

TRACEBACK


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.