PTON
z/OS V1R9.0 Communications Server IP CICS Sockets Guide
SC31-8807-04
PTON converts an IP address in its standard text presentation form to its numeric binary form. On successful completion, PTON returns the converted IP address in the buffer provided.
怎么记忆? presentation form to its numeric binary form即 p to n。我还是记不住,就记为PC输入的 to Networking 吧。
The following requirements apply to this call:
| Authorization: | Supervisor state or problem state, any PSW key |
| Dispatchable unit mode: | Task |
| Cross memory mode: | PASN = HASN |
| Amode: | 31-bit or 24-bit |
| ASC mode: | Primary address space control (ASC) mode |
| Interrupt status: | Enabled for interrupts |
| Locks: | Unlocked |
| Control parameters: | All parameters must be addressable by the caller and in the primary address space |
Figure 145 shows an example of PTON call instructions.
Figure 145. PTON call instruction example
WORKING-STORAGE SECTION.
01 SOC-NTOP-FUNCTION PIC X(16) VALUE IS 'PTON'.
01 S PIC 9(4) BINARY.
* IPv4 socket structure.
01 NAME.
03 FAMILY PIC 9(4) BINARY.
03 PORT PIC 9(4) BINARY.
03 IP-ADDRESS PIC 9(8) BINARY.
03 RESERVED PIC X(8).
* IPv6 socket structure.
01 NAME.
03 FAMILY PIC 9(4) BINARY.
03 PORT PIC 9(4) BINARY.
03 FLOWINFO PIC 9(8) BINARY.
03 IP-ADDRESS.
10 FILLER PIC 9(16) BINARY.
10 FILLER PIC 9(16) BINARY.
03 SCOPE-ID PIC 9(8) BINARY.
01 AF-INET PIC 9(8) BINARY VALUE 2.
01 AF-INET6 PIC 9(8) BINARY VALUE 19.
* IPv4 address.
01 PRESENTABLE-ADDRESS PIC X(45).
01 PRESENTABLE-ADDRESS-IPV4 REDEFINES PRESENTABLE-ADDRESS.
05 PRESENTABLE-IPV4-ADDRESS PIC X(15)
VALUE '192.26.5.19'.
05 FILLER PIC X(30).
01 PRESENTABLE-ADDRESS-LEN PIC 9(4) BINARY VALUE 11.
* IPv6 address.
01 PRESENTABLE-ADDRESS PIC X(45)
VALUE '12f9:0:0:c30:123:457:9cb:1112'.
01 PRESENTABLE-ADDRESS-LEN PIC 9(4) BINARY VALUE 29.
* IPv4-mapped IPv6 address.
01 PRESENTABLE-ADDRESS PIC X(45)
VALUE '12f9:0:0:c30:123:457:192.26.5.19'.
01 PRESENTABLE-ADDRESS-LEN PIC 9(4) BINARY VALUE 32.
01 ERRNO PIC 9(8) BINARY.
01 RETCODE PIC S9(8) BINARY.
01 PRESENTABLE-ADDRESS PIC X(45).
01 PRESENTABLE-ADDRESS-LEN PIC 9(4) BINARY.
PROCEDURE DIVISION.
* IPv4 address.
CALL 'EZASOKET' USING SOC-PTON-FUNCTION AF-INET
PRESENTABLE-ADDRESS
PRESENTABLE-ADDRESS-LEN
IP-ADDRESS
ERRNO RETURN-CODE.
* IPv6 address.
CALL 'EZASOKET' USING SOC-PTON-FUNCTION AF-INET6
PRESENTABLE-ADDRESS
PRESENTABLE-ADDRESS-LEN
IP-ADDRESS
ERRNO RETURN-CODE.
本文介绍PTON函数如何将IP地址从文本形式转换为数值二进制形式,并通过具体示例展示了IPv4及IPv6地址的处理流程。
1万+

被折叠的 条评论
为什么被折叠?



