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

What is WHEN-COMPILED


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

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Fri May 05, 2006 12:30 pm
Reply with quote

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
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Fri May 05, 2006 12:52 pm
Reply with quote

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
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Fri May 05, 2006 1:02 pm
Reply with quote

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
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri May 05, 2006 11:22 pm
Reply with quote

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
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Mon May 08, 2006 11:42 am
Reply with quote

Thanks Dave.
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 Different result between normal rexx ... CLIST & REXX 2
No new posts Mantis Program Compiled? CICS 2
No new posts Finding the plan when code compiled u... DB2 2
No new posts LISTIDR compiled date/time IBM Tools 3
No new posts REXX compiled via RXTCOMP CLIST & REXX 7
Search our Forums:

Back to Top