×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 25/08/2007, at 8:41 AM, Walden H. Leverich wrote:
I know I can create a UUID using the _GENUUID mi function, and as
expected, that will return a 16-A field w/a UUID in it. However, I'd
like to store that as a character string in a table, preferable
with the
"standard" format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, like:
C7408D2A-973C-432A-A31A-ED98A88A9115, but just as hex characters would
be ok too, no dashes. Anyone have a simple way to accomplish this?
Since you are already using an MI function (well, built-in really) to
generate the UUID use MI to convert to a hex string via CVTHC. That's
step 1. Step 2 is to substring and concatenate to insert the dashes.
H OPTION(*SRCSTMT : *NODEBUGIO)
H DFTACTGRP(*NO) BNDDIR('QC2LE')
/copy rpgleinc,migenuuid
/copy rpgleinc,micvthc
D UUID_String S 36
/free
UUID_Bytes_Prov = %SIZE(UUID_Template_T);
UUID_Rsvd = *ALLX'00';
genUUID( UUID_Template_T );
cvthc( %ADDR(UUID_String) : %ADDR(UUID_UUID) : %LEN(UUID_UUID)*2 );
UUID_String = %SUBST(UUID_String:01:08) + '-' +
%SUBST(UUID_String:09:04) + '-' +
%SUBST(UUID_String:13:04) + '-' +
%SUBST(UUID_String:17:04) + '-' +
%SUBST(UUID_String:21:12);
dsply UUID_String;
/end-free
C SETON LR
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.