Page 1 of 1

COMP and USAGE COMP in COBOL.

Posted: Thu Sep 10, 2015 12:20 pm
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,

Re: COMP and USAGE COMP in COBOL.

Posted: Thu Sep 10, 2015 2:44 pm
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

Re: COMP and USAGE COMP in COBOL.

Posted: Thu Sep 10, 2015 3:25 pm
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.

Re: COMP and USAGE COMP in COBOL.

Posted: Thu Sep 10, 2015 3:56 pm
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.