(转)Determining equivalent SQL and COBOL data types

SQL与COBOL数据类型等价转换指南


Determining equivalent SQL and COBOL data types

The precompiler determines the base SQLTYPE and SQLLEN of host variables based on this table. If a host variable appears with an indicator variable, the SQLTYPE is the base SQLTYPE plus one.

Table 1. COBOL declarations mapped to typical SQL data types
COBOL data typeSQLTYPE of host variableSQLLEN of host variableSQL data type
S9(i)V9(d) COMP-3 or S9(i)V9(d) COMP or S9(i)V9(d) PACKED-DECIMAL484i+d in byte 1, d in byte 2DECIMAL(i+d,d)
S9(i)V9(d) DISPLAY SIGN LEADING SEPARATE504i+d in byte 1, d in byte 2No exact equivalent use DECIMAL(i+d,d) or NUMERIC (i+d,d)
S9(i)V9(d)DISPLAY488i+d in byte 1, d in byte 2NUMERIC(i+d,d)
S9(i) BINARY or S9(i) COMP-4 where i is from 1 to 45002SMALLINT
S9(i) BINARY or S9(i) COMP-4 where i is from 5 to 94964INTEGER
S9(i) BINARY or S9(i) COMP-4 where i is from 10 to 18.

 

Not supported by OPM COBOL.
4928BIGINT
S9(i)V9(d) BINARY or S9(i)V9(d) COMP-4 where i+d ≤ 4500i+d in byte 1, d in byte 2No exact equivalent use DECIMAL(i+d,d) or NUMERIC (i+d,d)
S9(i)V9(d) BINARY or S9(i)V9(d) COMP-4 where 4 < i+d ≤ 9496i+d in byte 1, d in byte 2No exact equivalent use DECIMAL(i+d,d) or NUMERIC (i+d,d)
COMP-1

 

Not supported by OPM COBOL.
4804FLOAT(single precision)
COMP-2

 

Not supported by OPM COBOL.
4808FLOAT(double precision)
Fixed-length character data452mCHAR(m)
Varying-length character data448mVARCHAR(m)
Fixed-length graphic data

 

Not supported by OPM COBOL.
468mGRAPHIC(m)
Varying-length graphic data

 

Not supported by OPM COBOL.
464mVARGRAPHIC(m)
DATE

 

Not supported by OPM COBOL.
384DATE
TIME

 

Not supported by OPM COBOL.
388TIME
TIMESTAMP

 

Not supported by OPM COBOL.
39226TIMESTAMP

The following table can be used to determine the COBOL data type that is equivalent to a given SQL data type.

Table 2. SQL data types mapped to typical COBOL declarations
SQL data typeCOBOL data typeNotes
SMALLINTS9(m) COMP-4m is from 1 to 4
INTEGERS9(m) COMP-4m is from 5 to 9
BIGINTS9(m) COMP-4 for ILE COBOL.

 

Not supported by OPM COBOL.
m is from 10 to 18
DECIMAL(p,s)If p<64: S9(p-s)V9(s) PACKED-DECIMAL or S9(p-s)V9(s) COMP or S9(p-s)V9(s) COMP-3. If p>63: Not supported p is precision; s is scale. 0<=s<=p<=63. If s=0, use S9(p) or S9(p)V. If s=p, use SV9(s).
NUMERIC(p,s)If p<19: S9(p-s)V9(s) DISPLAY If p>18: Not supported p is precision; s is scale. 0<=s<=p<=18. If s=0, use S9(p) or S9(p)V. If s=p, use SV9(s).
FLOAT(single precision)COMP-1 for ILE COBOL.

 

Not supported by OPM COBOL.
FLOAT(double precision)COMP-2 for ILE COBOL.

 

Not supported by OPM COBOL.
CHAR(n)Fixed-length character string32766≥n≥1
VARCHAR(n)Varying-length character string32740≥n≥1
CLOBNoneUse SQL TYPE IS to declare a CLOB for ILE COBOL.

 

Not supported by OPM COBOL.
GRAPHIC(n)Fixed-length graphic string for ILE COBOL.

 

Not supported by OPM COBOL.
16383≥n≥1
VARGRAPHIC(n)Varying-length graphic string for ILE COBOL.

 

Not supported by OPM COBOL.
16370≥n≥1
DBCLOBNone

 

Not supported by OPM COBOL.
Use SQL TYPE IS to declare a DBCLOB for ILE COBOL.

 

BINARYNoneUse SQL TYPE IS to declare a BINARY.

 

VARBINARYNoneUse SQL TYPE IS to declare a VARBINARY.

 

BLOBNone

 

Not supported by OPM COBOL.
Use SQL TYPE IS to declare a BLOB.

 

DATEFixed-length character string or DATE for ILE COBOL.If the format is *USA, *JIS, *EUR, or *ISO, allow at least 10 characters. If the format is *YMD, *DMY, or *MDY, allow at least 8 characters. If the format is *JUL, allow at least 6 characters.
TIMEFixed-length character string or TIME for ILE COBOL.Allow at least 6 characters; 8 to include seconds.
TIMESTAMPFixed-length character string or TIMESTAMP for ILE COBOL.n must be at least 19. To include microseconds at full precision, n must be 26. If n is less than 26, truncation occurs on the microseconds part.
DATALINKNot supported
ROWIDNoneUse SQL TYPE IS to declare a ROWID.

 

<think> Hmm, the user is asking about "lightweight acquisition and ranging of flows in the data plane." This seems like a very specific networking topic, probably related to data plane programming or network monitoring. Let me unpack this. First, I notice the user provided some unrelated references about Java acquisition and image redaction - but explicitly mentioned they're not relevant. Smart of them to clarify. The core ask is clearly about flow measurement techniques in networking. The term "lightweight acquisition and ranging" suggests they need solutions that minimize resource consumption. Data plane processing happens at line speed, so efficiency is critical. "Flows" likely refers to network traffic flows. "Ranging" might imply measuring flow characteristics like size, duration, or path metrics. Key aspects I should cover: - Data plane programmability (P4/FPGAs) since traditional methods won't cut it - Sampling techniques (like sFlow/netFlow but more efficient) - In-band telemetry approaches (INT, IOAM) - Sketch-based methods (Count-Min, Bloom filters) - Recent research like Flare or Cheetah that optimize flow measurement The user seems technical - probably a network engineer or researcher. Their phrasing "data plane" suggests familiarity with SDN concepts. I should avoid basic definitions but explain how lightweight techniques differ from control-plane monitoring. Biggest challenge: "ranging" is ambiguous. Does it mean: 1) Measuring flow metrics (size/duration) 2) Determining flow paths 3) Estimating distances? (less likely) I'll address all interpretations with examples. Also worth noting: they might be comparing solutions for a real deployment. Should include practical considerations like deployment complexity and vendor support (Barefoot/Tofino vs FPGA). </think>以下是关于数据平面中轻量级流量获取与测距的详细解答,结合网络测量领域的核心技术: ### 一、核心概念解析 1. **数据平面轻量级流量获取** 在可编程交换机(如P4/Tofino)或智能网卡上,通过以下方式实现低开销流量监控: - **采样技术**:基于概率的报文采样(如sFlow改进版),仅处理1%-10%的流量[^1] - **流键值提取**:仅提取五元组(源/目的IP、端口、协议)等关键标识 - **内存优化**:使用Count-Min Sketch等数据结构,将流表内存占用降低10-100倍[^2] 2. **流量测距(Ranging)技术** 主要测量网络流量的时空特性: ```mermaid graph LR A[流量测距] --> B[时间维度] A --> C[空间维度] B --> B1(流持续时间) B --> B2(包到达间隔) C --> C1(路径跳数) C --> C2(端到端延迟) ``` ### 二、关键技术实现 1. **轻量级采集方案** - **P4实现示例**: ```p4 // 定义采样逻辑 action probabilistic_sampling(rate) { random<T>(0,100) < rate ? clone_to_cpu() : nop(); } // 流表键值压缩 key = { ipv4.srcAddr lpm 24, // 仅取IP前缀 tcp.dstPort & 0xFF00 // 端口分组 } ``` - **资源消耗对比**: | 方案 | 内存占用 | CPU利用率 | 精度损失 | |---|---:|---:|---:| | 全流量捕获 | 100% | 80% | 0% | | 轻量级采集 | 5-15% | 10-20% | 3-8% | 2. **动态测距方法** - **延迟测量**:通过带内网络遥测(INT)插入时间戳 $$ \Delta t = \frac{1}{N} \sum_{i=1}^{N} (T_{egress}^i - T_{ingress}^i) $$ - **路径追踪**:利用TTL衰减机制反推跳数 - **最新研究**:加州大学伯克利分校提出的Flare方案,将测量开销控制在<5%[^3] ### 三、典型应用场景 1. **DDoS检测** 通过突发流量特征识别攻击: - 源IP熵值突变:$ H(X) = -\sum p(x_i)\log_2 p(x_i) $ - 500Gbps攻击下检测延迟<50ms 2. **网络性能诊断** 结合机器学习实现: ```python # 基于测距数据的异常检测 from sklearn.ensemble import IsolationForest model = IsolationForest(contamination=0.01) model.fit(flow_metrics) # 输入延迟、丢包等向量 anomalies = model.predict(test_data) ``` 3. **负载均衡优化** 根据实时流量测距动态调整ECMP权重 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值