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

78 lines
10 KiB
HTML

<a name="mrs_01_1149"></a><a name="mrs_01_1149"></a>
<h1 class="topictitle1">File Output</h1>
<div id="body8662426"><div class="section" id="mrs_01_1149__en-us_topic_0000001219350681_sad23f79cd9f344e3b456933801d3cc4c"><h4 class="sectiontitle">Overview</h4><p id="mrs_01_1149__en-us_topic_0000001219350681_a068ee7f0ac854252bbabe8152aa18b9f">The <span class="parmname" id="mrs_01_1149__en-us_topic_0000001219350681_pf61440aca7db476d8d3ba069314fd773"><b>File Output</b></span> operator uses delimiters to concatenate existing fields and exports new fields to a file.</p>
</div>
<div class="section" id="mrs_01_1149__en-us_topic_0000001219350681_scbad6201c3a44571902ba3e19793a88b"><h4 class="sectiontitle">Input and Output</h4><ul id="mrs_01_1149__en-us_topic_0000001219350681_ued1520c229ce4b689f32a26d55c9a648"><li id="mrs_01_1149__en-us_topic_0000001219350681_l54f609bce10b40678d8b630779ee32c0">Input: fields to be exported</li><li id="mrs_01_1149__en-us_topic_0000001219350681_lde5d5d0094c5440486454819e4f80330">Output: files</li></ul>
</div>
<div class="section" id="mrs_01_1149__en-us_topic_0000001219350681_s1c31675e0b764e6ebefb669fe52bd2f7"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1149__en-us_topic_0000001219350681_t1a1cfe84162d410fba262e5572f8fa50" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Operator parameters description</caption><thead align="left"><tr id="mrs_01_1149__en-us_topic_0000001219350681_rff4ab49d1c6b46b99344a5fdc5f9224b"><th align="left" class="cellrowborder" valign="top" width="18.37%" id="mcps1.3.3.2.2.6.1.1"><p id="mrs_01_1149__en-us_topic_0000001219350681_a8abbfca1161d4078b736c3f33b07f230">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54.730000000000004%" id="mcps1.3.3.2.2.6.1.2"><p id="mrs_01_1149__en-us_topic_0000001219350681_acc3ec81be56d4eebb1d65c7bda47fdc2">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.3.3.2.2.6.1.3"><p id="mrs_01_1149__en-us_topic_0000001219350681_a577989cdbcfa48e7845a0e75090a6fc4">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.69%" id="mcps1.3.3.2.2.6.1.4"><p id="mrs_01_1149__en-us_topic_0000001219350681_a84e842a897b645a08f65c97a20388938">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.69%" id="mcps1.3.3.2.2.6.1.5"><p id="mrs_01_1149__en-us_topic_0000001219350681_a360994fc3db240dea3adb46c9e4c36bb">Default Value</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_1149__en-us_topic_0000001219350681_r49fd6048a5aa49fead78a112db2834d7"><td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a66e08207545846a1b57d0e0edf51afcc">Output delimiter</p>
</td>
<td class="cellrowborder" valign="top" width="54.730000000000004%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1149__en-us_topic_0000001219350681_ae2ed8ad77dc741f9ab0f5bb3e598b669">Set a delimiter.</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a6b5e0a56d43d46d29c906406be6067e4">string</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1149__en-us_topic_0000001219350681_abb9f40f3ecea44ebab416a1b003adb4a">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a8adc3e10640e475fa18cce1558ebda25">None</p>
</td>
</tr>
<tr id="mrs_01_1149__en-us_topic_0000001219350681_reb337bbbb9414f2eb4fbcdb24b057d09"><td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1149__en-us_topic_0000001219350681_ab091362de9d24d72b9b06a09cf48a18f">Line breaker</p>
</td>
<td class="cellrowborder" valign="top" width="54.730000000000004%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a874ce61941654da4b6b6f9b194f37e50">Line delimiter, which can be any string specified by users based on the actual situation. Any character string is supported. The OS line delimiter is used by default.</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a990ca4f30bf5440ab1cb0a1b01fe08a6">string</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a57f2dadc4bfc4bcc9a70907ba99cf5b4">No</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a47ebfbd23d9642bca1775067d5752858">\n</p>
</td>
</tr>
<tr id="mrs_01_1149__en-us_topic_0000001219350681_r2d51ee97bfa14fca985aa623d1e321b9"><td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1149__en-us_topic_0000001219350681_abe5d56a131074bada3af62fba31113ff">Output fields</p>
</td>
<td class="cellrowborder" valign="top" width="54.730000000000004%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a375fa67f17b742c5bb9d8be3de8adcf5">Information about output fields:</p>
<ul id="mrs_01_1149__en-us_topic_0000001219350681_u76983a13dded4dc7b02199cf05e870c3"><li id="mrs_01_1149__en-us_topic_0000001219350681_leb3a40a8f9924089aec9157f9f377b35"><strong id="mrs_01_1149__en-us_topic_0000001219350681_b1719201991015">position</strong>: Position of output fields.</li><li id="mrs_01_1149__en-us_topic_0000001219350681_l21171f6e4fe54900809ecdcf575c9817"><strong id="mrs_01_1149__en-us_topic_0000001219350681_b1113717323100">field name</strong>: Names of output fields.</li><li id="mrs_01_1149__en-us_topic_0000001219350681_l00943332cd984a5a92b8d24ae7c13048"><strong id="mrs_01_1149__en-us_topic_0000001219350681_b125881542161014">type</strong>: Field type. If type is set to <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_parmvalue1066645003984"><b>DATE</b></span>, <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_parmvalue41382312984"><b>TIME</b></span>, or <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_parmvalue579068028984"><b>TIMESTAMP</b></span>, you must specify a time format. If type is set to other values, the time format is invalid. The example time format is <span class="filepath" id="mrs_01_1149__en-us_topic_0000001219350681_f1f14fdd0ec3e4f3884895da8d530e162"><b>yyyyMMdd HH:mm:ss</b></span>.</li><li id="mrs_01_1149__en-us_topic_0000001219350681_l96fbb1770e20434697336cb6bc59bdca"><strong id="mrs_01_1149__en-us_topic_0000001219350681_b1737192424984">length</strong>: 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_1149__en-us_topic_0000001219350681_parmname600268311984"><b>type</b></span> is set to <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_parmvalue994559125984"><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_1149__en-us_topic_0000001219350681_parmname1044623232984"><b>type</b></span> is set to <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_parmvalue40607635984"><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="7.5200000000000005%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a449e7b03344e4c05a609199cf4234bdd">map</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a5305da7422054975a57647d712a8437e">No</p>
</td>
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1149__en-us_topic_0000001219350681_a7b5472a7dea4488c9d276f5de4f56ee2">None</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_01_1149__en-us_topic_0000001219350681_s0fbea37b297049a0af55026b888d4e29"><h4 class="sectiontitle">Data Processing Rule</h4><p id="mrs_01_1149__en-us_topic_0000001219350681_abed7974b64ae41a19367a080ec54dd2e">The field is exported to a file.</p>
</div>
<div class="section" id="mrs_01_1149__en-us_topic_0000001219350681_sea204be76a1c483699ade5da465e5f7d"><h4 class="sectiontitle">Example</h4><p id="mrs_01_1149__en-us_topic_0000001219350681_aa8b84b731b674d73b6dfe3728ad5eecf">Use the <span class="parmname" id="mrs_01_1149__en-us_topic_0000001219350681_p341b9276fd1644c089e7aea40be21da6"><b>CSV File Input</b></span> operator to generate two fields A and B.</p>
<p id="mrs_01_1149__en-us_topic_0000001219350681_a8d128370d93f46719f1572fce08aa71a">The following figure shows the source file.</p>
<pre class="screen" id="mrs_01_1149__screen386215172519">aaa,product
bbb,Bigdata</pre>
<p id="mrs_01_1149__en-us_topic_0000001219350681_a75b18d9bef894c328611964b28eb349d">Configure the <span class="parmname" id="mrs_01_1149__en-us_topic_0000001219350681_p06fb9e4df6274e2fbe35428fdb850b1f"><b>File Output</b></span> operator, set <span class="parmvalue" id="mrs_01_1149__en-us_topic_0000001219350681_p2a912aed704140c793d2ce3141f15ce3"><b>Output delimiter</b></span> to a comma (,), and export A and B to a file, as shown in the following figure.</p>
<p id="mrs_01_1149__en-us_topic_0000001219350681_aca357196a89f45edba9703c179601f5b"><span><img id="mrs_01_1149__en-us_topic_0000001219350681_i8af9425396b24f61bfd13a1aa4e374ea" src="en-us_image_0000001349139685.png"></span></p>
<p id="mrs_01_1149__en-us_topic_0000001219350681_ad3c0cd0a902849cbaa13ca76495161f2">The following figure shows the result.</p>
<pre class="screen" id="mrs_01_1149__screen5415165355113">aaa,product
bbb,Bigdata</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1145.html">Output Operators</a></div>
</div>
</div>