Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable definition to hold a timestamp 1

Status
Not open for further replies.

neocortex

Programmer
Apr 23, 2001
3
CA
I would like to define a variable that will hold a timestamp value that is obtained from an embedded SQL statement in my COBOL program.
Since the incoming timestamp is 10 characters long, I have thus far defined my variable as follows...TEST_TIMESTMP PIC X(10)

Unfortunately, I receive the SQLCODE error stating 'invalid syntax for the string representation of a date/time value'.

My question is...
Is there such a thing as...TEST_TIMESTMP TIMESTAMP????
Can a variable be defined to hold a date/time string?

Any help would be useful and much appreciated for a first time COBOL programmer like myself.
 
Hi J,

If you're trying to define it in DCL it would be:
FLD_A TIMESTAMP

If you're trying to define it in COBOL it would be:
01 FLD-A PIC X(026).

You may be confusing it with TIME.

Regards, Jack.


 
Your help is much appreciated Jack (uh...I mean slade!)

Changing the code to read PIC X(026) worked and the error message is no more.
One question though...if I put PIC X(26) it also works correctly.
What's the difference/benefit of using 026 or just 26??

Thanks again for your help,
J
 
Hi J,

No dif really, I just use 3 positions to align the numbers in case I have to determine the # of bytes in a group field. It's easier to count.

Good luck, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top