IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Finding unwanted variables


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Tue Sep 08, 2009 4:46 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 4:51 pm
Reply with quote

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
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Tue Sep 08, 2009 5:19 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 5:28 pm
Reply with quote

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
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Tue Sep 08, 2009 5:32 pm
Reply with quote

Hi ,
My shop support the command
Code:
UNUSED

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
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Tue Sep 08, 2009 6:15 pm
Reply with quote

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
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Tue Sep 08, 2009 7:27 pm
Reply with quote

Hi Ketan ,

Ya can u share the source code of that command then it will be useful
Back to top
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Tue Sep 08, 2009 7:38 pm
Reply with quote

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
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Sep 08, 2009 8:36 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 9:27 pm
Reply with quote

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
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Wed Sep 09, 2009 11:22 am
Reply with quote

Hi Arvind,

Where you found out these default options


While compiling I couldnt find these options
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Wed Sep 09, 2009 2:48 pm
Reply with quote

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
View user's profile Send private message
Gay251319

New User


Joined: 17 Jun 2009
Posts: 57
Location: Kochi

PostPosted: Wed Sep 09, 2009 6:22 pm
Reply with quote

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
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Sep 09, 2009 7:19 pm
Reply with quote

google ispf edit macro unused

gives you :

www.leighweb.com/mucodclr/UNUSED.HTM

there are some prerequisites for using it
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Finding and researching jobs All Other Mainframe Topics 0
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
No new posts JCL with variables JCL & VSAM 1
Search our Forums:

Back to Top