This statement has the following parameter:
Parameter | Description |
---|---|
UniqueID | Identifier of an alphanumeric data item that will contain the unique ID value after successful completion of this statement. The data item must be at least 38 characters in length. |
The XML GET UNIQUEID statement generates a unique identifier that may be used to form a unique filename. Please note that the return value might not contain any alphabetic characters. Therefore, it would be a good programming practice to add an alphabetic character to the name for those operating systems where filenames require at least one alphabetic character (see the following example).
The unique value returned by this statement is a string representation having the same format as a Windows UUID (Universal Unique Identifier). The string is a series of hexadecimal digits with embedded hyphen characters. The string is enclosed in brace characters ({ and }). The entire string is 38 characters in length.
On Windows systems, the value is an actual UUID. On UNIX systems, the value is a string having the same format as a Windows UUID, but constructed by an internal algorithm. This algorithm uses various components, including the system ID, the start time of the run unit, the current time, and an internal counter, to generate a unique value.
This statement may be used in conjunction with the COBOL STRING statement to generate a unique filename.
A status value is returned in the data item XML-Status of XML-data-group, which is defined in the copy file lixmldef.cpy.
MOVE SPACES TO MY-FILE-NAME. XML GET UNIQUEID MY-UNIQUEID. IF NOT XML-OK GO TO Z. STRING "mydir\a" DELIMITED BY SIZE MY-UNIQUEID DELIMITED BY SPACE ".xml" DELIMITED BY SIZE INTO MY-FILE-NAME.