MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIMESTAMP in COBOL Non DB2 program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
achittu
Beginner


Joined: 17 Oct 2006
Posts: 2
Topics: 1
Location: hartford

PostPosted: Tue Nov 20, 2007 1:04 pm    Post subject: TIMESTAMP in COBOL Non DB2 program Reply with quote

I need to get the timestamp in NON DB2 COBOL program?

I need to populate the output file with a field in this format : -- "YYYY-MM-DD-hh.mm.ss.nnnnnn" ... This format is DB2 format but our program is not DB2 program.. it is a normal batch COBOL program.

We have two types in COBOL - DATE and TIME but they dont give the exact TIMESTAMP like what is returned by DB2 ... Is there any way this can be achieved in COBOL program without using DB2 ?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Nov 20, 2007 2:12 pm    Post subject: Reply with quote

I do not know if TIME gives the full nnnnnn but if it does not then just use zeros. Otherwise it is a case of getting the values and formatting them as you require. I think there was a thread about this not so long ago - did you search?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Tue Nov 20, 2007 5:56 pm    Post subject: Reply with quote

I did this task years ago when my COBOL program needed to generate a DB2 timestamp as one of the fields of the file used to load a DB2 table. I used the date function provided by COBOL and generated a sequential number for the microseconds portion of the timestamp to insure no duplicate timestamps.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
nbdtrjk1
Beginner


Joined: 12 Apr 2007
Posts: 76
Topics: 41

PostPosted: Tue Nov 20, 2007 11:47 pm    Post subject: Reply with quote

using LE environment u can achieve your requirement

Code:
IDENTIFICATION DIVISION.                           
PROGRAM-ID.  NBDTRJK.                               
ENVIRONMENT DIVISION.                               
CONFIGURATION SECTION.                             
SOURCE-COMPUTER. IBM-AS400.                         
OBJECT-COMPUTER. IBM-AS400.                         
DATA DIVISION.                                     
WORKING-STORAGE SECTION.                           
01  F1 COMP-2.                                     
01  I1 PIC 9(5) BINARY.                             
01  S1 PIC X(23) VALUE ALL ' '.                     
01 ERROR-PARM PIC X(12).                           
PROCEDURE DIVISION.                                 
MAIN-PARA.                                         
     CALL 'CEELOCT' USING I1 F1 S1 ERROR-PARM.     
     DISPLAY S1.                                   
     GOBACK.                                       



Code:
you will get output: 20071120224508225
Back to top
View user's profile Send private message
achittu
Beginner


Joined: 17 Oct 2006
Posts: 2
Topics: 1
Location: hartford

PostPosted: Wed Nov 21, 2007 12:26 pm    Post subject: Reply with quote

I dont know what CEELOCT means ? Is this some in-built routine ?

Terry , I dont know if our clients would agree with generating sequence nos.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Nov 21, 2007 12:34 pm    Post subject: Reply with quote

achittu wrote:
I dont know what CEELOCT means ? Is this some in-built routine ?

Terry , I dont know if our clients would agree with generating sequence nos.


achittu,

CEELOCT is a language environment callable service. Check this link for all LE callable services.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA3180/2.2.5?

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Wed Nov 21, 2007 1:35 pm    Post subject: Reply with quote

"...I dont know if our clients would agree with generating sequence nos."
The sequence numbers were generated for the microseconds portion ONLY of the timestamp to insure unique values. Using CEELOCT looks easier.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group