read dataset

OPEN DATASET FNAME FOR INPUT IN BINARY MODE.

  READ DATASET FNAME INTO TEXT2 LENGTH LENG.

 

leng 能够判断 text2 的长度

 

DATA FNAME(60) VALUE 'myfile'.

DATA: TEXT1(4) VALUE '1234    ',
      TEXT2(8) VALUE '12345678',
      TEXT3(2),
      LENG TYPE I.

OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
   TRANSFER: TEXT1 TO FNAME,
             TEXT2 TO FNAME.
CLOSE DATASET FNAME.

OPEN DATASET FNAME FOR INPUT IN TEXT MODE.
   DO 2 TIMES.
      READ DATASET FNAME INTO TEXT3 LENGTH LENG.
      WRITE: / TEXT3, LENG.
   ENDDO.
CLOSE DATASET FNAME.

The output appears as follows:

12 4

12 8

This example writes the strings TEXT1 and TEXT2 to the file "myfile" in text mode. They are then read into the string TEXT3 (length 2). The amount of memory occupied by the lines is read into the field LENG.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值