COMP and USAGE COMP in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
RMaria
New Member
Posts: 4
Joined: Wed Sep 09, 2015 10:26 am

COMP and USAGE COMP in COBOL.

Post by RMaria »

Hi,

I have seen these two declaration of COMP. What is the difference between the following two codes :

Code: Select all

05 WS-VAR-A     PIC S9(9) USAGE COMP
05 WS-VAR-B     PIC S9(9) USAGE COMP 
Will they behave differently. If they behave differently what kind of can I use in my COBOL program to check it.


Thanks,
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: COMP and USAGE COMP in COBOL.

Post by enrico-sorichetti »

just a few days ago I went to the ophthalmologist for a checkup

Code: Select all

05 WS-VAR-A     PIC S9(9) USAGE COMP
05 WS-VAR-B     PIC S9(9) USAGE COMP
so I am pretty sure that the only difference between the two declarations is just the variable name
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: COMP and USAGE COMP in COBOL.

Post by nicc »

But...assuming a typo (which can be avoided by: a) cutting and pasting, b) proof-reading) the answer can be found using the old-fashioned method of...reading the manual.
Regards
Nic
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: COMP and USAGE COMP in COBOL.

Post by William Collins »

Guessing, there is no difference between a field defined with USAGE COMP and with just COMP. The word USAGE is entirely optional.

Personally, I don't use it for data defined COMPUTATIONAL of some type, or with PICture clauses, but do use it for INDEX, POINTER etc.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”