Yang, Tong 3f5759eed2 MRS comp-lts 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2023-01-19 17:08:45 +00:00

75 lines
11 KiB
HTML

<a name="mrs_01_1123"></a><a name="mrs_01_1123"></a>
<h1 class="topictitle1">Fixed File Input</h1>
<div id="body8662426"><div class="section" id="mrs_01_1123__en-us_topic_0000001219029129_s436005c657844750b0b70cbb60a6d171"><h4 class="sectiontitle">Overview</h4><p id="mrs_01_1123__en-us_topic_0000001219029129_ab32cce39dd5945108e045372dac4dc80">The <span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_p85bf799dc0e14d4c9fd4c70f2079c244"><b>Fixed File Input</b></span> operator converts each line in a file into multiple fields by character or byte of a configurable length.</p>
</div>
<div class="section" id="mrs_01_1123__en-us_topic_0000001219029129_s759f17562aa1459daf12b3d873dfa940"><h4 class="sectiontitle">Input and Output</h4><ul id="mrs_01_1123__en-us_topic_0000001219029129_u6c11f0feb415464da2f701203796afee"><li id="mrs_01_1123__en-us_topic_0000001219029129_lb47b8ff0bb7f4962811a972b2aecd418">Input: text file</li><li id="mrs_01_1123__en-us_topic_0000001219029129_l273bd78ac2fb44ada5292106d0bc5077">Output: fields</li></ul>
</div>
<div class="section" id="mrs_01_1123__en-us_topic_0000001219029129_sd0594dc6f06347ea8ca38ca9ea7d9b3a"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1123__en-us_topic_0000001219029129_tfb180be286a34d3ca09ab959d7be67be" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Operator parameter description</caption><thead align="left"><tr id="mrs_01_1123__en-us_topic_0000001219029129_rcafa491e8358460980430fc87cfd9722"><th align="left" class="cellrowborder" valign="top" width="16.490000000000002%" id="mcps1.3.3.2.2.6.1.1"><p id="mrs_01_1123__en-us_topic_0000001219029129_af51d83499a3f4d47810170c73799d023">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="43.61000000000001%" id="mcps1.3.3.2.2.6.1.2"><p id="mrs_01_1123__en-us_topic_0000001219029129_a1931e0e9c24745c2909b29e4390ef288">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.620000000000001%" id="mcps1.3.3.2.2.6.1.3"><p id="mrs_01_1123__en-us_topic_0000001219029129_acc7bc0c649694ebeaf3488d020b50b28">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.270000000000003%" id="mcps1.3.3.2.2.6.1.4"><p id="mrs_01_1123__en-us_topic_0000001219029129_ad08c9003f9904a8cb2297fbe5da8754b">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.010000000000002%" id="mcps1.3.3.2.2.6.1.5"><p id="mrs_01_1123__en-us_topic_0000001219029129_af6ce95f4ddbc4c7697946242db91f84a">Default Value</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_1123__en-us_topic_0000001219029129_r6b63c91009b14e529928101f1a612e75"><td class="cellrowborder" valign="top" width="16.490000000000002%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1123__en-us_topic_0000001219029129_af01b9d680c084da3a39953d87aaa1209">Line Delimiter</p>
</td>
<td class="cellrowborder" valign="top" width="43.61000000000001%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a6574b56a84ee4432b6b400fefa585c01">Line delimiter, which can be any string specified by users based on the actual situation. The OS line delimiter is used by default.</p>
</td>
<td class="cellrowborder" valign="top" width="10.620000000000001%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a22f9ab5c2a5443ed924cc4907e8616e9">string</p>
</td>
<td class="cellrowborder" valign="top" width="16.270000000000003%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a7ad40dc33f144ff283a231fdcac28927">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.010000000000002%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1123__en-us_topic_0000001219029129_ae70b7821940b4b46bbfc9e66d3b55589">\n</p>
</td>
</tr>
<tr id="mrs_01_1123__en-us_topic_0000001219029129_r6b62b9bfc2234103949ab318849d7c11"><td class="cellrowborder" valign="top" width="16.490000000000002%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a8c6bb3daf2b640b7bfb2b8a5f34fe4ca">Fixed length unit</p>
</td>
<td class="cellrowborder" valign="top" width="43.61000000000001%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a1394e3f5326448008bc4d3166788e48d">Length unit. The options are <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_p6fc1b777abe947e291f6621660a7049f"><b>char</b></span> and <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_p725bab98d66d4de9a758097184df2218"><b>byte</b></span>.</p>
</td>
<td class="cellrowborder" valign="top" width="10.620000000000001%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a954b0a88df6e4964b654c2fab8ec60df">enum</p>
</td>
<td class="cellrowborder" valign="top" width="16.270000000000003%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a0912ec2e4a4b4e728283f0f892291fdf">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.010000000000002%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a98ecb24664f4464a881ffa3f9c5869cc">char</p>
</td>
</tr>
<tr id="mrs_01_1123__en-us_topic_0000001219029129_r6bf43dfa58ad4ebc99d58fe608adef22"><td class="cellrowborder" valign="top" width="16.490000000000002%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1123__en-us_topic_0000001219029129_aae4f2de6650645d9ac447ed2696b21c3">Input fields</p>
</td>
<td class="cellrowborder" valign="top" width="43.61000000000001%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a5c52210bfd5640edaf9f9d49be0b8b0a">Information about input fields:</p>
<ul id="mrs_01_1123__en-us_topic_0000001219029129_ud0c5eae421b64f0aaf51007989841517"><li id="mrs_01_1123__en-us_topic_0000001219029129_l76731cfe04474b68b61852612a8ef03f"><span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_pab5978dd9ed74044803b76d01c9c803c"><b>fixed length</b></span>: Field length. The ending of the first field is the starting of the second field, the ending of the second field is the starting of the third field, and so on.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_lb62f63306f5a4b26af85931b5421a879"><span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_pfd6b0e884bda4c3d9f69b3c5b84a9dea"><b>field name</b></span>: Names of input fields.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_l83fe1a7716184674975a27a1f8fb5aaf"><span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_p2a855060237f4bfaa105142fea1dec12"><b>type</b></span>: Field type.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_ld93380cbeac342f1803a7e5ec81bc2ff"><span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_pbe344b368d904edcb4d3399eb043de69"><b>date format</b></span>: If the field type is <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_p6b2b3b37f24e4094b498316af56f050b"><b>DATE</b></span>, <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_pb056d51932724bc5901f4b2abeff577e"><b>TIME</b></span>, or <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_p85836511e3dd4a719fad3fd6173dc1aa"><b>TIMESTAMP</b></span>, you must specify a time format. If the field type is set to other values, the time format is invalid. An example time format is <span class="filepath" id="mrs_01_1123__en-us_topic_0000001219029129_fe67c23834ef148eb9bba915a970541d3"><b>yyyyMMdd HH:mm:ss</b></span>.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_l7c4c7baad4e14d8494293211be27d96a"><span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_pcadfb28bef84424788eb273f906ef09f"><b>length</b></span>: Field value length. If the actual field value is excessively long, the value is cut based on the configured length. When <span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_p0e6f88db0e4948d7b922da688139a721"><b>type</b></span> is set to <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_pde99f347e9c6472da8bd97094a9e2fff"><b>CHAR</b></span>, spaces are added to the field value for supplement if the actual field value length is less than the configured length. When <span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_p2b97adcca1b042c98f072ddff4c927e2"><b>type</b></span> is set to <span class="parmvalue" id="mrs_01_1123__en-us_topic_0000001219029129_p901d1e8c136648f6957bc006b72b4c4b"><b>VARCHAR</b></span>, no space is added to the field value for supplement if the actual field value length is less than the configured length.</li></ul>
</td>
<td class="cellrowborder" valign="top" width="10.620000000000001%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a00294cc51ee84d8ba468c5052a497c33">map</p>
</td>
<td class="cellrowborder" valign="top" width="16.270000000000003%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1123__en-us_topic_0000001219029129_a78735d17bf8b4132a7296bc1544f5443">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.010000000000002%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1123__en-us_topic_0000001219029129_ae42fe5863b074de4ba3dc42bd09de4ec">None</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_01_1123__en-us_topic_0000001219029129_sb3703b7776f04efdadafe8094d262e39"><h4 class="sectiontitle">Data Processing Rule</h4><ul id="mrs_01_1123__en-us_topic_0000001219029129_ubb7e250da0f84370ae4def6dc2103642"><li id="mrs_01_1123__en-us_topic_0000001219029129_l98afa39c8f744bb5a40d1cfffcf63e17">The source file is split based on the input field length to generate fields.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_l9c51a3baf54540e78a153e552f5ea67b">If the field value does not match the actual type, the data in the line will become dirty data.</li><li id="mrs_01_1123__en-us_topic_0000001219029129_lcb287e06146c4d2b8097a6bc765a466d">If the field split length is greater than the length of the original field value, the data split fails and the line becomes dirty data.</li></ul>
</div>
<div class="section" id="mrs_01_1123__en-us_topic_0000001219029129_se9f4db973307446199da76e663d33342"><h4 class="sectiontitle">Example</h4><p id="mrs_01_1123__en-us_topic_0000001219029129_afe3467d3ca2c4c158557dd3a0273a671">The following figure shows the source file.</p>
<p id="mrs_01_1123__en-us_topic_0000001219029129_a0b233b1548254039985dc7a554b3005a"><span><img id="mrs_01_1123__en-us_topic_0000001219029129_i805be655130d440eb96ebd8a5dcd672f" src="en-us_image_0000001295900008.jpg"></span></p>
<p id="mrs_01_1123__en-us_topic_0000001219029129_ad59bb0b684e74e7aa76caea86f25fc7c">Configure the <span class="parmname" id="mrs_01_1123__en-us_topic_0000001219029129_pddd44c5caac4427ebc17a2035400a88c"><b>Fixed File Input</b></span> operator to generate fields A, B, and C.</p>
<p id="mrs_01_1123__en-us_topic_0000001219029129_a397bfd8a745849e29720027e2c3f1442"><span><img id="mrs_01_1123__en-us_topic_0000001219029129_i6e57e913b1a947b6891ee49d9e14716d" src="en-us_image_0000001348739869.png"></span></p>
<p id="mrs_01_1123__en-us_topic_0000001219029129_aea5f975c835f47aeb1beffca7ff495a5">The three fields are generated, as shown in the following figure.</p>
<p id="mrs_01_1123__en-us_topic_0000001219029129_a478bcbc64fde4cc18d1c028aaf4e6fe2"><span><img id="mrs_01_1123__en-us_topic_0000001219029129_i43ee7d98ea224487b0a3ba1760029ebf" src="en-us_image_0000001295740040.jpg"></span></p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1121.html">Input Operators</a></div>
</div>
</div>