Examples of %DO

Example:

	GTM>DO INT^%DO 
	Decimal: 12
	Digits: 4
	GTM>ZWRITE
	%DO="0014"
	

This example invokes %DO interactively with INT^%DO. %DO prompts for a decimal number and an output length. If the output value of %DO has leading zeros, the value is a string. ZWRITE displays the contents of the variables.

Example:

	GTM>SET %DO=12 
	GTM>DO ^%DO
	GTM>ZWRITE
	%DO="000000000014"
	

This example sets the read-write variable %DO to 12 and invokes %DO to convert the number non-interactively. Because the number of digits was not specified, %DO used the default of 12 digits. Set %DL to specify the number of output digits. ZWRITE displays the contents of the variables.

Example:

	GTM>WRITE $$FUNC^%DO(12,7)
	0000014	
	

This example invokes %DO as an extrinsic function with the label FUNC. The first argument specifies the number to be converted and the optional, second argument specifies the number of output digits. If the second argument is not specified, %DO uses the default of 12 digits.