View previous topic :: View next topic |
Author |
Message |
achittu Beginner
Joined: 17 Oct 2006 Posts: 2 Topics: 1 Location: hartford
|
Posted: Tue Nov 20, 2007 1:04 pm Post subject: TIMESTAMP in COBOL Non DB2 program |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue Nov 20, 2007 2:12 pm Post subject: |
|
|
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 |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Tue Nov 20, 2007 5:56 pm Post subject: |
|
|
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 |
|
 |
nbdtrjk1 Beginner
Joined: 12 Apr 2007 Posts: 76 Topics: 41
|
Posted: Tue Nov 20, 2007 11:47 pm Post subject: |
|
|
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 |
|
 |
achittu Beginner
Joined: 17 Oct 2006 Posts: 2 Topics: 1 Location: hartford
|
Posted: Wed Nov 21, 2007 12:26 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed Nov 21, 2007 1:35 pm Post subject: |
|
|
"...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 |
|
 |
|
|