Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHEN COMPILED 4

Status
Not open for further replies.

Dan01

Programmer
Jun 14, 2001
439
US
Hi all, Hewlett Packard Cobol has the extension WHEN-COMPILED that can be use as such:

DISPLAY "PROGRAM COMPILED " WHEN-COMPILED

Is there a standard Cobol function that will do the equivalent, or does when compiled need to be built input dates. Thanks, Dan.
 
Most of the compilers have such an extension.
 
When using $CONTROL,STDWARN to check for standard Cobol, this is the message I receive during compile using WHEN-COMPILED:


TALLY, CURRENT-DATE, TIME-OF-DAY, WHEN-COMPILED is nonconforming nonstandard (HP extension).
 
Dan -

If you use the FUNCTION WHEN-COMPILED as I described previously, you will NOT get a non-conforming message. It IS a standard function found in any ANSI 85+intrinsic function-compliant compiler.

Glenn
 
3gm is right, but so is Dan01.

HP has Special Register Word called WHEN-COMPILED and a ANSI function called WHEN-COMPILED.

Here is the definition of Special Register Word:
"A special register is a storage area in main memory that contains information primarily used in connection with specific COBOL features. The content of this area is generated automatically by the compiler. In a COBOL program, such an area is referenced by a special register word."

The Special Register Word WHEN-COMPILED is not part of ANSI COBOL, just as Dan01 says.

But the function WHEN-COMPILED is ANSI COBOL, just as 3gm says.

This references the register:
MOVE WHEN-COMPILED TO ws-field

This references the function:
MOVE FUNCTION WHEN-COMPILED TO ws-field

The results could be different though, because the register reference obtains the date and time from the software clock. But, the function retrieves it from the hardware clock.

Dimandja
 
Thanks Glenn and Dimandja. I gave both of you stars for your expert postings. Glenn, I did as you stated and it was accepted as standard Cobol. Dimandja, thanks for clarifying that. I would never have guessed! Dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top