Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is it possible to get TIMESTAMP in cobol
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vinod71082

New User


Joined: 05 Jul 2007
Posts: 10
Location: chennai

PostPosted: Fri Aug 24, 2007 4:50 pm    Post subject: Is it possible to get TIMESTAMP in cobol
Reply with quote

Is it possible to get TIMESTAMP in cobol without using DB2.

Thanks & Regards
Vinod kumar
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 24, 2007 4:59 pm    Post subject:
Reply with quote

no
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri Aug 24, 2007 5:00 pm    Post subject: Reply to: Is it possible to get TIMESTAMP in cobol
Reply with quote

Hi,

If you wan to populate time stamp in a WS variable : look at this link
http://www.ibmmainframes.com/viewtopic.php?t=2402&highlight=currenttime
Back to top
View user's profile Send private message
vinod71082

New User


Joined: 05 Jul 2007
Posts: 10
Location: chennai

PostPosted: Fri Aug 24, 2007 5:06 pm    Post subject:
Reply with quote

hi,
shreevamsi ,i think u didn't understand my question.
timestamp consist of date-time with nano sec . tell me how to get the nano sec using cobol without using DB2.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2007 9:06 pm    Post subject:
Reply with quote

Hello,

If you look in the COBOL manual linked to via this site you may find something useful.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/7.1.9?SHELF=&DT=20020920180651&CASE=
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Sat Aug 25, 2007 12:07 am    Post subject: Reply to: Is it possible to get TIMESTAMP in cobol
Reply with quote

FYI.... You need to be using Enterprise cobol for function to work.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Tue Sep 04, 2007 11:46 pm    Post subject:
Reply with quote

The following Assembler macro can be used to generate a DB2-format timestamp.

TIME DEC,RATICKWA,LINKAGE=SYSTEM,
MF=(E,LIST1MAC),DATETYPE=YYYYMMDD

We call Assembler routines (one for batch, one for CICS) that issue this macro and return the DB2 style timestamp.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Wed Sep 26, 2007 2:59 pm    Post subject:
Reply with quote

Hi TG Murphy, Could you plz Elaborate your answer, how actually This can be used in cobol program?


Thanks....
Vasanth...... icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Sep 26, 2007 8:20 pm    Post subject:
Reply with quote

Hello,

An assembler subroutine is called from the COBOL program. The subroutine returns the date in db2 format.

The assembler routine is the macro definition TG posted plus the standard linkage - talk with someone in your organization with basic assembler skills to get the module(s) assembled.
Back to top
View user's profile Send private message
achittu

New User


Joined: 26 Feb 2007
Posts: 14
Location: chennai

PostPosted: Wed Nov 21, 2007 11:15 pm    Post subject:
Reply with quote

I have the same requirement now ... is it possible to do this without using ASSEMBLER ?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Nov 22, 2007 12:17 am    Post subject:
Reply with quote

achittu wrote:
I have the same requirement now ... is it possible to do this without using ASSEMBLER ?


The response you received at the other site uses a LE callable routine, isn't that good enought?
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Thu Nov 22, 2007 11:23 pm    Post subject:
Reply with quote

Craq,

Please tell me about the LE callable routine. What is the "other" site you are referring to?

If this LE routine lets us avoid the assembler then bonus...
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Thu Nov 22, 2007 11:34 pm    Post subject:
Reply with quote

Vasanth,

Do you have someone in your organization that knows Assembler? There are very few of these people left.

I can send you the source code but you'll need someone who knows what to do with it...

Send me a PM to let me know...
Back to top
View user's profile Send private message
dominickim

New User


Joined: 28 Feb 2007
Posts: 65
Location: NS, CA

PostPosted: Fri Nov 23, 2007 1:00 am    Post subject: Check MVS Control Block
Reply with quote

Cobol source from http://gsf-soft.com/Freeware/
Code:
       IDENTIFICATION DIVISION.                                       
       PROGRAM-ID. MVSCB.                                             
                                                                     
       DATA DIVISION.                                                 
       WORKING-STORAGE SECTION.                                       
       01  CURR-JDATE             PIC 9(7) COMP-3.                   
       01  FOUR-BYTES.                                               
           05 FULL-WORD           PIC S9(8) COMP.                     
           05 PTR4                REDEFINES FULL-WORD POINTER.       
           05 PL4                 REDEFINES FULL-WORD PIC 9(7) COMP-3.
                                                                     
       LINKAGE SECTION.                                               
       01  CB1. 05 PTR1           POINTER OCCURS 512.                 
       01  CVT. 05 CVT1           POINTER OCCURS 512.                 
                                                                     
       PROCEDURE DIVISION.                                           
           SET ADDRESS OF CVT TO PTR1(5)                             
           SET ADDRESS OF CB1 TO CVT1(50)                             
           MOVE CB1(29:4)     TO FOUR-BYTES                           
           COMPUTE CURR-JDATE = PL4 + 1900000                         
           DISPLAY 'CURRENT DATE=' CURR-JDATE                         
           STOP RUN.                                                 

Output - I could not find time in MCB yet.
Code:
    COMMAND INPUT ===>                                                  SCROLL ===>    CSR 
CURRENT DATE=2007326                                                           
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
dominickim

New User


Joined: 28 Feb 2007
Posts: 65
Location: NS, CA

PostPosted: Fri Nov 23, 2007 2:38 am    Post subject: Here is the CVT map - let me know if you found
Reply with quote

CVT map
http://publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.iead100/iea2d180569.htm
and example to access MVS Control Block
http://supportline.microfocus.com/documentation/books/mx25sp1/cocblk.htm
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Nov 23, 2007 7:36 am    Post subject:
Reply with quote

If you just want the date/time, with the time resolution as precise as the ACCEPT TIME verb:

ACCEPT DATE
ACCEPT TIME
ACCEPT DATE again into a different variable

If both dates are =, then you've got it.

Otherwise, ACCEPT TIME again, as midnight occurred between the first two ACCEPTs.

Rudimentary, but is this OK?
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Nov 23, 2007 7:44 am    Post subject:
Reply with quote

Correction: Midnight may have occurred between the first two ACCEPTs, but certainly occurred between the two ACCEPT DATEs.
Back to top
View user's profile Send private message
joepie meloenie

New User


Joined: 28 Nov 2007
Posts: 4
Location: amstelveen

PostPosted: Thu Nov 29, 2007 2:36 am    Post subject:
Reply with quote

far too difficult....

Here an example to build a db2-look alike timestamp without using sql:

Code:
       WORKING-STORAGE SECTION.
      * T I M E S T A M P   D B 2  X(26)     EEEE-MM-DD-UU.MM.SS.HH0000
       01  DB2-TIMESTAMP                 PIC 9999.99.99.99.99.99.990000.
       01  FILLER REDEFINES DB2-TIMESTAMP.
           06 FILLER                     PIC X(004).                      EEEE
           06 DB2-STREEP-1               PIC X.                           -
           06 FILLER                     PIC X(002).                      MM
           06 DB2-STREEP-2               PIC X.                           -
           06 FILLER                     PIC X(002).                      DD
           06 DB2-STREEP-3               PIC X.                           -
           06 FILLER                     PIC X(016).                      USH0
       PROCEDURE DIVISION.
       MAIN SECTION.
       MAIN-000.
           MOVE FUNCTION CURRENT-DATE (1:16) TO DB2-TIMESTAMP
           MOVE '-' TO DB2-STREEP-1 DB2-STREEP-2 DB2-STREEP-3
           DISPLAY 'DB2-TIMESTAMP = ' DB2-TIMESTAMP
           .
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Thu Nov 29, 2007 2:43 am    Post subject:
Reply with quote

But this won't work under COBOL's that do not have FUNCTION.
Back to top
View user's profile Send private message
joepie meloenie

New User


Joined: 28 Nov 2007
Posts: 4
Location: amstelveen

PostPosted: Thu Nov 29, 2007 4:33 am    Post subject:
Reply with quote

so I guess you don't work on the mainframe.....

Also all modern cobol's do have that.....

but.. if you don't have it, of course you can work with accept.... but take care about the ghosthour trouble.... so.... be sure that the date does not change between the moment you accept the date, after that the time and after that verify that the date has not changed.....



http://www.ghost-transaction.com/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us