OpenVMS Source Code Demos

SYS_CREATE_UID_100.C

//================================================================================================
// title : sys_create_uid_100.c
// author: James F Duff
// created: 2011-10-21
// platform: HP C V7.3-009 on OpenVMS Alpha V8.4
// note  : this file stuff was lifted from:
//	   http://eight-cubed.com/examples/framework.php?file=sys_create_uid.c
//       : this version contains a few tweaks
//================================================================================================
#define PROGRAM_VER	"sys_create_uid_100.c"		//
#include <stdio.h>					//
#define __NEW_STARLET	1				// enable new (strict) starlet for OpenVMS Alpha 7.0 and later
							// http://h41379.www4.hpe.com/doc/82final/5841/5841pro_059.html
#include <starlet.h>					// vms specific
#include <ssdef.h>					// vms specific
#include "errchk.h"					// http://eight-cubed.com/examples/framework.php?file=errchk.h

int main() {
	static unsigned int r0_status;
	static unsigned int uid[4];			// sizeof = 16 (128 bits)
	//
	printf("program: %s\n", PROGRAM_VER);
	r0_status = sys$create_uid (uid);		//
//	r0_status = sys$create_uid (&uid);		// not legal with _NEW_STARLET
	errchk_sig (r0_status);				// defined in "errchk.h"
	printf("uid: %08lX.%08lX.%08lX.%08lX\n",
		uid[0],
		uid[1],
		uid[2],
		uid[3]);
	return(SS$_NORMAL);				// vms success
}