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

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

Reference Type: Supported, Category: IP Address Functions, Integration Agreement: 5844


This extrinsic function converts an IP address (either IPv4 or IPv6) into an IPv4 address in a standardized format consisting of four decimal numbers, each in the range 0 to 255. For example:


Input Parameters: ip: (required) IPv4 or IPv6 address (string; in quotes) to be converted
Output: returns:
  • An IPv4 address in "nnn.nnn.nnn.nnn" notation if the input address is valid and has an IPv4 equivalent.
  • The null address "" if the input address is invalid.
  • The null address "" if an IPv6 address is input that does not have an IPv4 equivalent.



Example 1
>W X
Example 2
>S X=$$FORCEIP4^XLFIPV("10.999.3.1")
>W X
Example 3
>S X=$$FORCEIP4^XLFIPV("2001:db8::8a2e:370:7334")
>W X
Example 4
>S X=$$FORCEIP4^XLFIPV("::ffff:")
>W X
Example 5
>S X=$$FORCEIP4^XLFIPV("::ffff:c000:2eb")
>W X