HP3000-L Archives

March 1998, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Davidson, Brian, Mr., SARDA" <[log in to unmask]>
Reply To:
Davidson, Brian, Mr., SARDA
Date:
Wed, 4 Mar 1998 13:45:08 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (232 lines)
COBOL statements like   MOVE CURRENT-DATE TO SOME-VARIABLE   do not
change.
SOME-VARIABLE needs to be defined as 8 characters PIC X(08).  They are
special register words in COBOL.  You get data with slashes in the
variable.

<<from HPLaserROM>>
| CURRENT-DATE         | An 8-digit alphanumeric item used only as the
|
|                      | sending field in a MOVE or DISPLAY statement in
|
|                      | the PROCEDURE DIVISION. These statements send
data |
|                      | to another field or to an output device,
|
|                      | respectively.  This item is always stored in
this  |
|                      | format:
|
|                      |
|
|                      |      mm/dd/yy
|
|                      |
|
|                      | Here, mm indicates the month, dd indicates the
day |
|                      | of the month, and yy indicates the last two
digits |
|                      | of the year.  The slash marks are automatically
|
|                      | included in the data; you need not insert them.
|
|                      | [REV BEG]
|
|                      |
|
|                      | The date and time are obtained from the
software   |
|                      | clock.  The date and time obtained by the COBOL
|
|                      | function CURRENT-DATE are obtained from the
|
|                      | hardware clock.  See Chapter 10  for more
|
|                      | information about the COBOL function
|
|                      | CURRENT-DATE.[REV END]
|
<<END LaserROM>>

You have to change your COBOL code to get YYYYMMDD.  The first line of
the program should be a $CONTROL statement.  At a minimum it needs to be
$CONTROL POST85.  Then in COBOL you can write MOVE FUNCTION CURRENT-DATE
TO SOME-VARIABLE.
SOME-VARIABLE needs to be defined as 21 characters PIC X(21).
I use a WORKING-STORAGE data structure like:

01  TIME-INFO.
   05 TODAYS-DATE.
      10 TODAYS-YEAR   PIC X(04).
      10 TODAYS-YYYY   REDEFINES TODAYS-YEAR  PIC 9(04).
      10 TODAYS-MONTH  PIC X(02).
      10 TODAYS-DAY    PIC X(02).
   05 TIME-NOW         PIC X(08).
   05 NUM-TIME-NOW     REDEFINES TIME-NOW   PIC 9(06)V99.
   05 GMT-INFO         PIC X(05).


You get an all digit string like 1998030412243600... in the variable.
You can re-format it and print as 1998/03/04 and a time of 12:24
36.00sec

<<begin HPLaserROM>>
CURRENT-DATE Function


The CURRENT-DATE function returns the calendar date, time of day, and
the
difference between the local time and Universal Coordinated Time (UTC),
or Greenwich Mean Time.  To get the correct time differential, you need
to set the environment variable TZ to your local time zone.  See below
for more information.  The function type is alphanumeric.

This function is different from the CURRENT-DATE special register word
(described in Chapter 3 ).  One difference is that the CURRENT-DATE
function provides a four-digit year.



Syntax

     FUNCTION CURRENT-DATE



Return Values

This function returns a 21-character alphanumeric string with each
character position defined as follows:



 Character                            Contents
 Positions

    1-4      Four numeric digits of the year in the Gregorian calendar.

    5-6      Two numeric digits of the month of the year, in the range
             01 through 12.

    7-8      Two numeric digits of the day of the month, in the range 01
             through 31.

    9-10     Two numeric digits of the hours past midnight, in the range
             00 through 23.

   11-12     Two numeric digits of the minutes past the hour, in the
             range 00 through 59.

   13-14     Two numeric digits of the seconds past the minute, in the
             range 00 through 59.

   15-16     Two numeric digits of the hundredths of a second past the
             second, in the range 00 through 99.  The value 00 is
             returned because your system cannot provide the fractional
             part of a second.

     17      One of the following:


             Value    When Returned

               -      Returned if the local time in the previous
                      character positions is behind Greenwich Mean Time.


              +       Returned if the local time indicated is the same
                      or is ahead of Greenwich Mean Time.

              0       Returned on non-MPE XL systems that do not have
                      the facility to provide the local time
                      differential factor.



          Table 10-6.  (cont.)

 Character                            Contents
 Positions

   18-19     Depending on the value of character position 17, one of the
             following:


             Position 17 Contents

                 -       Two numeric digits in the range 00 through 12
                         indicating the number of hours that the
                         reported time is behind Greenwich Mean Time.

                +        Two numeric digits in the range 00 through 13
                         indicating the number of hours that the
                         reported time is ahead of Greenwich Mean Time.


                0        The value 00 is returned.

   20-21     Depending on the value of character position 17, one of the
             following:


             Position 17 Contents

                 -       Two numeric digits in the range 00 through 59
                         indicating the number of additional minutes
                         that the reported time is behind of Greenwich
                         Mean Time.

                +        Two numeric digits in the range 00 through 59
                         indicating the number of additional minutes
                         that the reported time is ahead of Greenwich
                         Mean Time.

                0        The value 00 is returned.
<<END LaserROM>>

Hope this helps.


Brian Davidson
U.S. Army, Falls Church, VA
Tel:   (703) 681-9781
Fax:   (703) 681-9304
Email: [log in to unmask]







> ----------
> From:         Curt Brimacomb[SMTP:[log in to unmask]]
> Reply To:     Curt Brimacomb
> Sent:         Wednesday, March 04, 1998 11:43 AM
> To:   [log in to unmask]
> Subject:      Cobol
>
> Hello,
>
> I think I saw some discussion about this last week, but never paid
> attention
> to it.  Now I have to supply an answer to a programmer.
>
> In Cobol, the accept date command, does that change to YYYYMMDD after
> a
> certain MPE/iX powerpatch version.  Or does it always stay YYMMDD and
> you
> have to use a different command in Cobol to get YYYYMMDD?
>
> TIA
>
> Curt Brimacomb
> System Manager
> Idaho Computer Services, Inc.
> www.magiclink.com
> Voice: 1-208-734-2245
> [log in to unmask]
> Fax: 1-208-733-9663
>

ATOM RSS1 RSS2