Kernel 8.0 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

$$FORCEIP4^XLFIPV(): Convert any IP Address to IPv6

Reference Type: Supported, Category: IP Address Functions, ICR#: 5844

Description

The $$FORCEIP4^XLFIPV extrinsic function converts an IP address (either IPv4 or IPv6) into an IPv6 address in a standardized format consisting of eight groups of hexadecimal numbers separated by colons. For example:

    2001:0DB8:85A3:0042:0000:8A2E:0370:7334

Format

  $$FORCEIP6^XLFIPV(ip)

Input Parameters

ip:

(required) IPv4 or IPv6 address (string; in quotes) to be converted.

Output

returns:

Returns:

  • An IPv6 address in “hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh” notation if the input address is valid and has an IPv6 equivalent.

  • The NULL address “0000:0000:0000:0000:0000:0000:0000:0000” if the input address is invalid.

 

Examples

Example 1

>S X=$$FORCEIP6^XLFIPV("10.126.3.1")

>W X
0000:0000:0000:0000:0000:FFFF:0A7E:0301

Example 2

>S X=$$FORCEIP6^XLFIPV("10.999.3.1")

>W X
0000:0000:0000:0000:0000:0000:0000:0000

Example 3

>S X=$$FORCEIP6^XLFIPV("2001:db8::8a2e:370:7334")

>W X
2001:0DB8:0000:0000:0000:8A2E:0370:7334

Example 4

>S X=$$FORCEIP6^XLFIPV("::ffff:10.126.3.1")

>W X
0000:0000:0000:0000:0000:FFFF:0A7E:0301

Example 5

>S X=$$FORCEIP6^XLFIPV("127.0.0.1")

>W X
0000:0000:0000:0000:0000:0000:0000:0001