ABAP Cursosentenciareaddataset
<html>
<head> <title>READ DATASET</title> </head> <BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#0099FF" VLINK="#AA0000"> <p align="left">⚠ <b><span class="titulo">READ </span>⚠ </b><span class="titulo">⚠ <b>DATASET⚠ </b></span></p>
<p align="left">⚠ <b>Definicin⚠ </b></p>
<p align="left">Lee un fichero secuencial en el servidor de aplicacin.</p>
<p align="left">⚠ <b>Sintaxis:⚠ </b></p>
<pre>READ DATASET <fichero> INTO <campo> [ LENGTH <longitud> ].</pre>
<p>Lee datos del fichero secuencial <fichero> sobre el campo
<campo>. Para decidir el formato de <campo> es necesario conocer la estructura del fichero. El modo de transferencia se indica en la sentencia⚠ <a href="open_dataset.htm" tppabs="open_dataset.htm">OPEN DATASET⚠ </a>. Si el fichero no esta abierto para lectura, el sistema intenta abrir el fichero en modo binario, o con las opciones de la ltima sentencia⚠ <a href="open_dataset.htm" tppabs="open_dataset.htm">OPEN DATASET⚠ </a>sobre ese fichero. No obstante, es recomendable abrir siempre el fichero con la sentencia⚠ <a href="open_dataset.htm" tppabs="open_dataset.htm">OPEN DATASET⚠ </a>. Si la operacin de lectura ha sido satisfactoria la variable SY-SUBRC vale 0, si vale 4 quiere decir que hemos llegado al final del fichero, y si vale 8 es que el fichero no ha podido ser abierto. Trabajando en el modo binario, se puede utilizar la clusula LENGTH para que el sistema actualice el campo <longitud> con la longitud del campo ledo.</p>
<p>⚠ <b>Ejemplo:⚠ </b></p>
READ DATASET '/usr/test' INTO REC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE: / REC-TEXT, REC-NUMBER.
ENDDO.</pre>
<p>⚠ <b>Vase tambin:⚠ </b> ⚠ <a href="open_dataset.htm" tppabs="open_dataset.htm">OPEN DATASET⚠ </a>,
⚠ <a href="close_dataset.htm" tppabs="close_dataset.htm">CLOSE DATASET⚠ </a>,⚠ <a href="transfer.htm" tppabs="transfer.htm">TRANSFER⚠ </a>.</p>
</body>
</html>