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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command to append in a file

Status
Not open for further replies.

merctec

Programmer
Mar 10, 2004
1
0
0
CH
Hello
With the following command, the file will be overwritten each time:
PUT("FILE" , "../da_data/"+"EAN01_KUNDE_DETAIL"+ ".txt" ,TEXT(TextField Fields UTILITY:GEN_Message Data:Message_GEN:CA_O_HEADER)), NONE)

How do I have to change this command to get the data appended?

Thank you very much for your help

 
Hi,

I think we dont have any commands for FILE adapter which will allow us to append the new contents to the file.
Probably what you can do is :
1> Add an input card with one text field say FileContent of max length which will take all the contents of file to which u wanna append the new contents, and at the output side u can pick up this information into any text field and then Pack this file content with the new content
TEXT(TextField Fields UTILITY:GEN_Message Data:Message_GEN:CA_O_HEADER)and the u can pass this whole package to the Put command.
Note : In this case the file should be present for the Input card even if it is blank otherwise the map will fail and flag an error saying "Source not available"

2> If u dont want to add the Input card and read the contents if u are working on the UNIX box then probably u can use Exit command and then call cat command on command prompt which will return u the file content in that field and then using this field content u can again follow the same steps as explained in option 1.

3> U can use the external script and pass the data which u wish to append to the file and in the script u can then append this content. And pfcourse u need to call this script using again Exit command passing the necessary parameters to it.

there may be many other options as well....

Hope this helps.

Cheers,
Shrini.



 
You could always RUN another map from the rule to do the PUT, and override the output card with an append (+).

e.g. roughly:
RUN("MAPNAME", "-OF1+ filename", "filecontents to append")

I assume you can't just specify the whole card as a file adapter and choose the option OnSuccess:Append in this case?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top