The following is an extract from a .lst file for a simple program:
1 working-storage section. 2 01 a pic 9(2). 3 4 procedure division. 5 main section. 6 move 1 to a 7 if a = 1 display "HELLO" end-if 8 stop run. ... * A Numeric DISPLAY * 2# 6* 7? (X 3) * * 1 data-names * * MAIN Section * 5# (X 1) * * * 1 procedure-names * End of cross reference listing
The cross-referencing information shows that there is one data item, a, of type numeric display, which is defined on line 2, updated on line 6, and tested on line 7. The (X 3) at the end of the line refers to the number of times the data item appears in the cross-reference listing. The procedure-name main also appears in the listing, as a section which is referenced only once.
Comments:
This directive has no effect if the LIST directive is not specified.
To produce the cross-reference listing the Compiler needs extra work space on the disk. The space needed depends on the number of data items and procedure-names and the number of times they are referenced.
On UNIX, to produce the message "*End of cross reference listing" in the cross reference listing you must also specify the verbose compiler option, -v.
When the XREF directive is specified, extra information is added to the end of the .lst file produced: