View previous topic :: View next topic
|
Author |
Message |
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
Hi friends,
In a cobol program I found this satement, this is used to move the program compiled date and time to a working storage variable.
it looks like WHEN-COMPILED is a reserved word(WHEN-COMPILED is not at all defined any where in the program). Can anyone tell me how this works.
MOVE WHEN-COMPILED TO WS-CMPL-DATE-TIME
defenition of WS var:
10 WS-CMPL-DATE-TIME
15 WS-CMPL-CCYYMMDD X(8).
15 WS-CMPL-TIME X(8).
Thanks in advance
Venkat |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Venkat,
This is what i got in one of the manuals.
x The WHEN-COMPILED special register contains the date at the start of the compilation. WHEN-COMPILED is an alphanumeric data item with the implicit definition:
01 WHEN-COMPILED GLOBAL PICTURE X(16) USAGE
DISPLAY
x The WHEN-COMPILED special register has the format:
MM/DD/YYhh.mm.ss (MONTH/DAY/YEARhour.minute.second)
x For example, if compilation began at 2:04 PM on 27 April 1995, WHEN-COMPILED would contain the value 04/27/9514.04.00.
x WHEN-COMPILED can only be used as the sending field in a MOVE statement.
x WHEN-COMPILED special register data cannot be reference-modified.
Regards,
Muthuvel. |
|
Back to top |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
Hi Muthuvel,
Thanks for the information.
I want to know two more things:
1. Is this register maintained separately for every COBOL program ?
2. If your answer is YES to first question, than for how long this information will be stored in that register?
Thanks
Venkat |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
venktv,
Quote: |
1. Is this register maintained separately for every COBOL program ?
2. If your answer is YES to first question, than for how long this information will be stored in that register?
|
This is not a hardware resister, but a COBOL software register. The date and time the program was compiled is stored in the OBJECT module and loaded into the WHEN_COMPILED register when the program is entered. The LOAD module may contain several OBJECT modules, each with it?s own WHEN-COMPILED date/time. When you call a subroutine the date/time the subroutine was compiled is in the WHEN-COMPILED register. Each program, in effect, has it?s own WHEN-COMPILED register that exists only while the program is being executed.
One of the things that can be done with this register is to print the date/time the program was compiled on reports as an indication of what version of the program was running.
One of the things I like to do, is the first time a subroutine is called (only once per program) display the date time the subroutine was compiled. Sometimes with a complex development/migration/implementation system it?s hard to know what version of subroutines really got executed with your program.
Code: |
01 WHEN-COMPILED-WORK.
03 COMPILE-DATE PIC X(8) VALUE 'MM/DD/YY'.
03 COMPILE-TIME PIC X(8) VALUE 'HH.MM.SS'.
MOVE WHEN-COMPILED TO WHEN-COMPILED-WORK.
MOVE COMPILE-DATE TO REPORT-DATE-PROGRAM-COMPILED.
MOVE COMPILE-TIME TO REPORT-TIME-PROGRAM-COMPILED.
|
Dave |
|
Back to top |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
Thanks Dave. |
|
Back to top |
|
|
|