Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

READ DATASET

Former Member
0 Likes
1,233

Hi All,

Can any one tell what is the difference between MAXIMUM LENGTH and ACTUAL LENGTH addition in READ DATASET.

Regards,

Nikhil

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
842

Hi,

Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.

Reward if useful.

Regards,

Swetha.

5 REPLIES 5
Read only

Former Member
0 Likes
843

Hi,

Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.

Reward if useful.

Regards,

Swetha.

Read only

ak_upadhyay
Contributor
0 Likes
842

Hi,

Syntax


READ DATASET <dsn> INTO <f> 
[MAXIMUM LENGTH <maxlen>]
[ACTUAL LENGTH <len>].

Reads the contents of the file <dsn> on the application server to the variable <f>. The amount of data can be specified using MAXIMUM LENGTH. The number of bytes transferred can be written to <len> using ACTUAL LENGTH.

Reward points if useful...

Regards

AK

Read only

Former Member
0 Likes
842

hi check this...

Syntax

READ DATASET <dsn> INTO <f>

MAXIMUM LENGTH <maxlen>

ACTUAL LENGTH <len>.

Reads the contents of the file <dsn> on the application server to the variable <f>. The amount of data can be specified using MAXIMUM LENGTH. The number of bytes transferred can be written to <len> using ACTUAL LENGTH.

regards,

venkat

Read only

prasanth_kasturi
Active Contributor
0 Likes
842

hi,

MAXIMUM LENGTH : This addition determines how many characters or how many bytes maximum are read from the file

ACTUAL LENGTH This addition assigns the number of characters or bytes to be read from the file to the data object .

reward if helpful

prasanth

Read only

Former Member
0 Likes
842

hi,

READ DATASET dset INTO dobj [MAXIMUM LENGTH mlen]

[[ACTUAL] LENGTH alen].

Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.

DATA: file TYPE string VALUE `flights.dat`,

hex_container TYPE x LENGTH 1000,

len TYPE i.

FIELD-SYMBOLS <spfli> TYPE spfli.

DESCRIBE FIELD <spfli> LENGTH len IN BYTE MODE.

OPEN DATASET file FOR INPUT IN BINARY MODE.

ASSIGN hex_container TO <spfli> CASTING.

DO.

READ DATASET file INTO hex_container MAXIMUM LENGTH len.

IF sy-subrc = 0.

WRITE: / <spfli>-carrid,

<spfli>-connid,

<spfli>-countryfr,

<spfli>-cityfrom,

<spfli>-cityto,

<spfli>-fltime,

<spfli>-distance.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET file.