Hi,
Too fast last time!
I assume the column was defined with CHAR(13) FOR BIT DATA, because the
column must be filled with an unique value where the timestamp is encrypted.
Since V5R4 SQL provides a scalar function GENERATE_UNIQUE(): The
GENERATE_UNIQUE function returns a bit data character string 13 bytes long
(CHAR(13) FOR BIT DATA) that is unique compared to any other execution of
the same function.
The result of the function is a unique value that includes the internal form
of the Universal Time, Coordinated (UTC) and the system serial number. The
result cannot be null.
This function differs from using the special register CURRENT TIMESTAMP in
that a unique value is generated for each instance of the function in an SQL
statement and each row of a multiple row insert statement or an insert
statement with a fullselect. The timestamp value that is part of the result
of this function can be determined using the TIMESTAMP function with the
result of GENERATE_UNIQUE as an argument.
Example:
INSERT INTO MYTABLE (FLD1, FLD2, FLD3)
VALUES(Generate_Unique(),'ABC', 123);
SELECT Timestamp(Fld1), Fld1
From MyTable;
May be that's what you are looking for!
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von MKirkpatrick@xxxxxxxxxxxxxxxxx
Gesendet: Thursday, June 19, 2008 20:46
An: RPG400-L@xxxxxxxxxxxx
Betreff: CHAR for BIT DATA fld
I have a column defined as CHAR FOR BIT DATA or CHAR(13) CCSID 65535 NOT
NULL. Why? Because this is the way it is defined in another table from
DB2 (Windows) that I am trying to duplicate/populate. W/in my RPG pgm,
the following stmt generates the correct data: CREDGUID =
x'20080618090909123456202020';
My problem is I need to use a variable (TIMESTAMP + 3 chars) part of the
value used to populate the CREDGUID column. I have tried stringing
together using the '+' char but when the data gets into the column it is
truncated because the working variable is larger than the result
(CREDGUID). I also tried using the HEX SQL BIF without success.
Any ideas or suggestions would be greatly appreciated. Thanks.
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
Unless you are the addressee (or authorized to receive for the addressee),
you may not use, copy or disclose to anyone this email or any information
contained in this email. If you have received this email in error, please
advise the sender by replying to this email, and delete this email
immediately. Please note that any views or opinions presented in this email
are solely those of the author and do not necessarily represent those of
Western Dental Services, Inc. Finally, the recipient should check this
email and any attachments for the presence of viruses. Western Dental
Services, Inc. accepts no liability for any damage caused by any virus
transmitted by this email.
As an Amazon Associate we earn from qualifying purchases.