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

Regarding the Variables


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

New User


Joined: 12 Sep 2007
Posts: 4
Location: chennai

PostPosted: Fri May 16, 2008 10:20 am
Reply with quote

I have few questions regarding declaration variables in COBOL Programs.

1. Why 77 level variables are not preferred in COBOL programs.
2. Which is preferred? Comp or Comp-3 variables. Why?

Regards,
Seshagiri
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 16, 2008 12:00 pm
Reply with quote

Hello,

Quote:
1. Why 77 level variables are not preferred in COBOL programs.
Who/what says they are not preferred? They can be used with no problems. . .

Quote:
2. Which is preferred? Comp or Comp-3 variables. Why?
Eash has uses. Neither is necessarily preferred. The choice is dependent on the need at the time. If you post a requirement, soneome will reply wioth a suggestion as to which would be the better choice.
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Fri May 16, 2008 12:16 pm
Reply with quote

Hi seshagir,
From my knowledge, i have seen that 77 level is only preferred for single items.as we know 01 can also be used with group items ,but 77 not.but in case of comp and comp3 we are using it depends upon the amount of storage spaces we can use or we can say it as a situation depended also.So i feel what 'Dick' told is right.
thanks
hari
Back to top
View user's profile Send private message
yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Fri May 16, 2008 12:26 pm
Reply with quote

These topics are discussed many times on this forum. Please make search on this.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri May 16, 2008 12:45 pm
Reply with quote

Hi,


77 level variables is used as independent variable and these variables doesnot involves elementary variables, that is the speciality of this variable,

Who says it is not prefferred? it is preffered for the cause and requirement.

COMP or COMP-3 usage depends on your requirement, that is for fast addressability and for storing the values or data in packed formatt.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri May 16, 2008 5:59 pm
Reply with quote

Some programmers follow a style whereby they group similar variables, e.g., flags or switches, under a 01 level, e.g.:

Code:
01  FLAGS.
    05  FLAG-1     PIC X.
    05  FLAG-2     PIC X.


If you do this, you would have few 77's.
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 JCL with variables JCL & VSAM 1
No new posts JCL Variables JCL & VSAM 1
No new posts reset/clear ALL application profile v... TSO/ISPF 3
No new posts REXX - Adding variables CLIST & REXX 8
No new posts using based or defined variables PL/I & Assembler 2
Search our Forums:

Back to Top