Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Conversion - combine 2 files preserving data in target file

Status
Not open for further replies.

karlomutschler

Programmer
Jun 5, 2001
75
DE
Hi,

In the file conversion below wish to combine the data from CCData4.tps with that of CCData3.tps - preserving whatever data is already stored in the respective columns of CCData3.tps

This source quoted below removes the data already present in CCData3.tps

CODE
SourceName = 'C:\Entw_C5\CCData\cnv\Ccdata4.tps'
TargetName = 'C:\Entw_C5\CCData\cnv\Ccdata3.tps'

OPEN(Progress)

OPEN(CCData4)
IF ERROR() THEN MESSAGE('Error opening CCData4.tps' & ERROR()); RETURN.
OPEN(CCData3)
IF ERROR() THEN MESSAGE('Error opening CCData3.tps' & ERROR()); RETURN.
SET(CCData3)
LOOP
NEXT(CCData3)
IF ErrorCode() = 33 THEN BREAK.
CC4:NUMBER = CC3:NUMBER
GET(CCData4,CC4:Number_Key)
IF ErrorCode() THEN
MESSAGE('CCData with No.: '& CC4:NUMBER &' not found').
CC3:REACHED = CC4:REACHED
CC3:TRY = CC4:TRY
CC3:REASON_NB = CC4:REASON_NB
CC3:REACTION = CC4:REACTION
CC3:REMARKS = CC4:REMARKS
PUT(CCData3)
END
CLOSE(Ccdata4)
CLOSE(CCData3)

CLOSE(Progress)

TIA and kind regards
Karlo
 
if all you want to do is ADD the data to file CCData3 :

SET(CCData4,1) !START WITH CCDATA4
LOOP
NEXT(CCData4)
IF ErrorCode() THEN BREAK.
CLEAR(CC3:RECORD)
CC3:REACHED = CC4:REACHED
CC3:TRY = CC4:TRY
CC3:REASON_NB = CC4:REASON_NB
CC3:REACTION = CC4:REACTION
CC3:REMARKS = CC4:REMARKS
ADD(CCData3)
IF ERRO() THEN STOP(ERROR()).
END
This will create a new CCDATA3 record from the fields shown
from CCdata4.
Is this what you want to do?

Hope it helps.
Joe

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top