Delete item in line

  • kda
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
10 years 3 months ago #16235 by kda
Delete item in line was created by kda
Dear all
I have one file
TEST under TEMP.BP with content
ABC*123
CDE*344
FEH*566

I want to use routine to delete LINE 2 with CDE..., how should i do?

Thanks

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #16236 by jpb
Replied by jpb on topic Delete item in line
DIR = "TEMP.BP"
F1  = "TEST"
F2  = "TEST.OUT"

OPENSEQ DIR,F1 TO F.FI ELSE ABORT "F1"
OPENSEQ DIR,F2 TO F.FO THEN ABORT "F2 EXISTS"

LOOP
    READSEQ R.F FROM F.FI ELSE R.F = ""
WHILE R.F DO
    IF R.F[1,3] = "CDE" ELSE
        WRITESEQ R.F TO F.FO ELSE ABORT "WRITE"
    END
REPEAT

CLOSESEQ F.FI
CLOSESEQ F.FO

EXECUTE "COPY FROM ":DIR:" ":F1:",":F2:" OVERWRITING DELETING"

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds