View previous topic :: View next topic
|
Author |
Message |
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
HI,
HOW TO FIND THE UNWANTED WORKING STORAGE VARIABLES AND SWITCHES AFTER COMPILING THE COBOL CODE
wHETHER THERE IS ANY COMMAND TO FIND THIS ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
This has been asked before on this forum. There's no command to find unwanted variables, although you can use the variable cross reference listing to find variables that are not used in the program. Whether or not they are wanted, of course, is a philosophical question.... |
|
Back to top |
|
|
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
Hi Robert ,
Can u tell what is that Variable cross reference listing
Do u mean just manually verifying ?
There is no other way apart from this
In Sysout .. We cant find anything specified that the variables that r not used ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
If you specify XREF(FULL) as a COBOL compiler option, you will get a listing of every variable (among other things) in the program, where each is defined, and the PROCEDURE DIVISION lines that reference that variable. This is the compiler cross reference listing. If the variable is listed with no PROCEDURE DIVISION statements, then the variable is not used by that program. For example:
Code: |
1PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1 MF0094 Date 0
0An "M" preceding a data-name reference indicates that the data-name is modified
Defined Cross-reference of data names References
14 WS-COMP-1. . . . . . . . . . . 21
15 WS-COMP-2. . . . . . . . . . . 26
16 WS-COMP-3. . . . . . . . . . . 31
17 WS-DISP-1. . . . . . . . . . . 21 26 31
13 WS-VARIABLES |
shows WS-VARIABLES is not used but each of the other variables is used at least once.
And yes, I mean manually verifying -- there's tools that can tell you which variables aren't used but they are site specific and you would need to talk to your site support group, coworkers, or team leader to find out if such a tool is available at your site. |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Hi ,
My shop support the command
its gives the number of variable that is not been used in the program,
I am not sure that this command is shop specific or genric. |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
Yeah, It should be shop specific.
It would be really grateful if you can share the source code of that command so that all of us can use the same ;-) |
|
Back to top |
|
|
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
Hi Ketan ,
Ya can u share the source code of that command then it will be useful |
|
Back to top |
|
|
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
Hi Robert ,
Moreover even if I am not using the Xref(Full) in the compile parms .. Its displaying the Cross reference of the data names
How its possible ? |
|
Back to top |
|
|
arvind.m
Active User
Joined: 28 Aug 2008 Posts: 205 Location: Hyderabad
|
|
|
|
Hi Gay123456,
even in my shop i don't provide the above options but still i can see what Robert told while listing the program. Maybe the option by default is what Robert mentioned above.
In my shop
Code: |
PTIONS USED - SPECIFIED OR DEFAULTED
APOST
APOSTSQL
ATTACH(TSO)
CCSID(37)
NOPADNTSTR
CONNECT(2)
DEC(15)
FLAG(I)
HOST(IBMCOB)
LINECOUNT(60)
MARGINS(8,72)
NEWFUN(NO)
ONEPASS
OPTIONS
PERIOD
NOSOURCE
STDSQL(NO)
SQL(DB2)
NOXREF
|
please check your default options. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The compiler default is XREF(FULL) but it sometimes gets changed at sites concerned that the cross reference uses too much space. |
|
Back to top |
|
|
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
Hi Arvind,
Where you found out these default options
While compiling I couldnt find these options |
|
Back to top |
|
|
arvind.m
Active User
Joined: 28 Aug 2008 Posts: 205 Location: Hyderabad
|
|
|
|
even i never use these option when compiling the program. But on listing i could see the defaults options (as mentioned above). By the way, at my shop we use Alchemist.
Thanks, |
|
Back to top |
|
|
Gay251319
New User
Joined: 17 Jun 2009 Posts: 57 Location: Kochi
|
|
|
|
Hi Aravind,
Options in effect:
NOADATA
NOADV
APOST
ARITH(COMPAT)
AWO
BUFSIZE(27998)
NOCICS
CODEPAGE(37)
NOCOMPILE(S)
NOCURRENCY
DATA(31)
NODATEPROC
NODBCS
NODECK
DIAGTRUNC
NODLL
NODUMP
NODYNAM
NOEXIT
NOEXPORTALL
FASTSRT
FLAG(I,I)
NOFLAGSTD
INTDATE(ANSI)
LANGUAGE(EN)
LIB
LINECOUNT(60)
LIST
MAP
NOMDECK
NONAME
NSYMBOL(DBCS)
NONUMBER
NUMPROC(NOPFD)
OBJECT
NOOFFSET
OPTIMIZE(STD)
OUTDD(SYSOUT)
PGMNAME(COMPAT)
RENT
RMODE(ANY)
NOSEQUENCE
PP 5655-S71 IBM Enterprise COBOL for z/OS 4.1.0
SIZE(MAX)
SOURCE
SPACE(1)
NOSQL
SQLCCSID
NOSSRANGE
NOTERM
TEST(NOHOOK,NOSEPARATE,NOEJPD)
NOTHREAD
TRUNC(STD)
NOVBREF
NOWORD
XMLPARSE(COMPAT)
XREF(FULL)
YEARWINDOW(1900)
ZWB
The above is the compiler option for COBOl program ... The option u mentioned is for DB2 i think
Can anyone tell me whether my understanding is correct or not |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
Back to top |
|
|
|