HP3000-L Archives

January 1999, Week 3

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:
"Michael P. Smith" <[log in to unmask]>
Reply To:
Michael P. Smith
Date:
Tue, 19 Jan 1999 14:32:13 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (104 lines)
Glenn J. Koster, Sr. wrote in message ...
>Brad wrote:
>
>> I'm trying to use the clock intrinsic (in Cobol) to generate a number
>> that I can use for unique file names but I can't figure out what the
>> clock intrinsic is giving me. The intrinsics manual says I should get
>> Hour, Minute, Seconds and Tenths of seconds.
>
>The problem here is not what the CLOCK intrinsic is returning, but the
>accessibility of bit-maps to COBOL.  The CLOCK intrinsic returns a
>bit-mapped timestamp.  Unfortunately, it is not easily accessible in
>COBOL.
>
>Personally, I would prefer to use the variables returned from the
>"CURRENT-DATE" function under COBOL '85 ($CONTROL POST85 option), but if
>you really need to do this under COBOL '74 try the following code...
>
>In working storage, add the following fields:
>   15.41   01  WS-CLOCK-RET.
>   15.42       05  WS-CLOCK-NUM        PIC S9(9) COMP VALUE ZERO.
>   15.43   01  WS-CLOCK-DSPLY          PIC -9(9).
>   15.44   01  WS-HOUR.
>   15.45       05  FILLER              PIC X         VALUE LOW-VALUES.
>   15.46       05  FILLER              PIC X.
>   15.47   01  FILLER REDEFINES WS-HOUR.
>   15.5        05  WS-HOUR-9           PIC S9(4) COMP.
>   15.55   01  WS-MIN.
>   15.6        05  FILLER              PIC X         VALUE LOW-VALUES.
>   15.65       05  FILLER              PIC X.
>   15.7    01  FILLER REDEFINES WS-MIN.
>   15.75       05  WS-MIN-9            PIC S9(4) COMP.
>   15.8    01  WS-SEC.
>   15.85       05  FILLER              PIC X         VALUE LOW-VALUES.
>   15.9        05  FILLER              PIC X.
>   15.95   01  FILLER REDEFINES WS-SEC.
>   16          05  WS-SEC-9            PIC S9(4) COMP.
>   16.001
>   16.002  01  WS-T-FILENAME.
>   16.003      05  FILLER              PIC X(01)     VALUE "F".
>   16.004      05  WS-T-HOUR           PIC 99.
>   16.005      05  WS-T-MIN            PIC 99.
>   16.006      05  WS-T-SEC            PIC 99.
>   16.05
>
>In the procedure division, add...
>
>   24          CALL INTRINSIC "CLOCK" GIVING WS-CLOCK-NUM.
>   24.1        MOVE WS-CLOCK-NUM TO WS-CLOCK-DSPLY.
>   24.2        MOVE WS-CLOCK-RET(1:1) TO WS-HOUR(2:1).
>   24.3        MOVE WS-CLOCK-RET(2:1) TO WS-MIN(2:1).
>   24.4        MOVE WS-CLOCK-RET(3:1) TO WS-SEC(2:1).
>   24.5        DISPLAY "Current time: " WS-HOUR-9
>                                    ":" WS-MIN-9
>                                    ":" WS-SEC-9.
>   24.6        MOVE WS-HOUR-9         TO WS-T-HOUR.
>   24.7        MOVE WS-MIN-9          TO WS-T-MIN.
>   24.8        MOVE WS-SEC-9          TO WS-T-SEC.
>   24.9        DISPLAY "Generated file name: " WS-T-FILENAME.
>   25
>
>Results:
>
>     BOI4C:RUN TSTDATEP.MMSPRG
>
>     Current date: MON, JAN 18, 1999,  1:39 PM
>     Current time: +0013:+0039:+0044
>     Generated file name: F133944
>     Conversion option?    >> //
>
>     END OF PROGRAM
>     BOI4C:
>
>Glenn
>
>--
> ______________
>|  Navigators  | Under contract to Hewlett-Packard ISG (Greeley, CO)
>|     |)       |
>|     | )      | Glenn J. Koster, Sr.             [log in to unmask]
>|     |  )     | Managed Business Solutions    http://www.mbsnav.com
>|     |   )    | 214 S. College, Suite 201              970 350-5337
>|     |----    | Fort Collins, CO  80524                970 224-1016
>| ============ |
>| \__________/ |
>|   of Change  | aka:  [log in to unmask]
>|______________| home: http://members.aol.com/MichiTex
>

Nice reply Glenn.

I was going to write a little COBOL example, but I see there is no need.
Always like seeing a call for a programming example get a programming
example

 ---------------------------------------------------------------
| Michael P. Smith                                              |
| Sr. Systems Programmer                                        |
| The Hertz Corporation    [log in to unmask] (work)          |
| Oklahoma City, OK        [log in to unmask] (personal)      |
 ---------------------------------------------------------------
The thoughts, views and expressions contained in this message are those
of Michael P. Smith, and do not necessarily reflect those of the Hertz
Corporation.  To reply via email, remove the .xx from email address.

ATOM RSS1 RSS2