Thank you so much Brad.
Later i realize the same that the version which i am using does not support FLAT and its added recently to newer version.
I have found another way to zip files from a directory using MEMORY like below so that directory structures wont be created.
PUT("ZIP", "MEMORY, myzip.zip," + Str:Record + ".txt",GET("FILE","c:\tmp\" + Str:Record+ ".txt"))
it will take one file each from the directory and add it to the zip.The range of the item need to be 0:s where this put rule specified.
Original Message:
Sent: Tue December 02, 2025 01:44 PM
From: Brad Folkers
Subject: ZIP Adapter
To update, there still may be a race condition where the ZIP operation fails if the text file does not exist prior to running the map. To make sure your file is written before the ZIP command, use a PUT FILE command. I got it working with this simple scenario, where "inputcard1" is my input card. Both output cards have SINK targets.
Card 1: =PUT("FILE", "output1.txt", inputcard1)
Card 2: =PUT("ZIP","FILE,C:\temp\test.zip,c:\temp\abc.txt c:\temp\dir1\* output1.txt,FLAT"," ")
Alternatively, if you don't need to write to an intermediate file at all, you could use the Zip adapter's MEMORY feature and take advantage of the fact that the ZIP PUT operation appends to the archive file. You can call one MEMORY command to add the output card contents from memory, and one FILE command to add existing files. For example:
Card 1: =UPPERCASE(inputcard1)
Card 2: =PUT("ZIP","MEMORY,C:\temp\test.zip,newfile.txt",outputcard1)
Card 3: =PUT("ZIP","FILE,C:\temp\test.zip,C:\temp\abc.txt C:\temp\dir1\*,FLAT"," ")
------------------------------
Brad Folkers
Original Message:
Sent: Mon December 01, 2025 09:57 AM
From: Brad Folkers
Subject: ZIP Adapter
Hi Santanu,
Which version of ITX are you using? The "FLAT" option was just added this year in ITX 11.0.2.0.
Note that if the output file (test.zip) already exists, the ZIP operation will add files to that archive. This may be confusing your test results. Please start without an existing test.zip file.
I just successfully tested with a map where output card #1 creates a file called "mapoutput.txt". Output card #2 contains this PUT rule:
=PUT("ZIP","FILE,C:\temp\test.zip,C:\temp\abc.txt C:\temp\dir1\* mapoutput.txt,FLAT"," ")
The resulting C:\temp\test.zip file contains only the files with no directories:
- abc.txt
- mapoutput.txt
- value1.txt (from C:\temp\dir1)
- value2.txt (from C:\temp\dir1)
Please note in this scenario, the order of output cards matters, and the file must be generated before the ZIP call.
Please also see the full documentation here: https://www.ibm.com/docs/en/ste/11.0.2?topic=lc-archive-file-file
------------------------------
Brad Folkers
Original Message:
Sent: Wed November 26, 2025 02:16 AM
From: Santanu Baral
Subject: ZIP Adapter
Hi,
I am trying to ZIP few files present in a directory C:\\temp\*.txt and one file created by map.
So i have used the below mapping rule.
PUT("ZIP","MEMORY,C:\temp\test.zip,C:\temp\*.txt abc.txt",PACKAGE(abc))--not working, zip file created but without any content in it.
However i have changed the above rule by replacing MEMORY with FILE
PUT("ZIP","FILE,C:\temp\test.zip,C:\temp\*.csv abc.txt",PACKAGE(abc))--not working,i am getting file abc.txt not found exception
i have placed the output file from map to a directory C:\temp\ and then use the below rule.
PUT("ZIP","FILE,C:\temp\test.zip,C:\temp\*.csv C:\temp\abc.txt"," ")--this is working but zip has temp as directory name.
PUT("ZIP","FILE,C:\temp\test.zip,C:\temp\abc.txt,FLAT"," ")-archive file has directory structure
As per the ZIP adapter document, if FLAT parameter is specified then only the file name is used in the archive but i could see directory name is also present.
is there any way to zip files from a directory and a file from the same map with the archive has only the files not the directory.
example--C:\temp\--this directory has a.txt,b.txt and map produce c.txt so the C:\temp\test.zip file would have a.txt,b.txt,c.txt not like temp\a.txt,b.txt,c.txt
Please share your thoughts.
Thanks in advance for your help and time.
------------------------------
Santanu Baral
------------------------------