cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate sequence no in output file name using FTP

Former Member
0 Kudos

Hi All,

I am doing a file to file scenario in which i have to generate output file name with sequence numbers with fix increment.for ex:if first file has name:output.000002.dat

then second will have the name output.000003.dat like that each time i will generate i have to generate a unique sequence number.In NFS there is an option add counter where we can achieve this functionality but for FTP i am not able to achieve it .please guide me how to proceed

Regards,

Neha

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Prabhu

u told me to use shell script ,is its value will persist for each time i will call the map.Secondaly is there is any other way to proceed olease advice me as its very urgent.I thought of UDF to generate Seq no and take the seq no from payload to put in the output file name but the problem is that the seq no value is not persisting each time i am running the map.

Regards,

Neha

prabhu_s2
Active Contributor
0 Kudos

neither in udf nor shell script the seq number will persist. in udf we need to do a lookup logic which would get the list of files from the path and build the seq based on it ; for instance if the file name ur using file.dat doesnt exists then u will have file001.dat saved. this is done using dyn file naming for which blogs are there. in the next run we need to extract the list of files in the location and hence we would get only file001.dat. based on this generate the next seq i.e. file002.dat and hence on. where in in shell script the dynamic file name can be ignored and processing is much faster in shell scirpt. the same kind of logic follows here. i hope there shud be much improvised solution.

Former Member
0 Kudos

Hi Neha,

Please make sure if your FTP server have the feasibility with GDG (Generation Data Group). This makes the life easier. You need to add suffix to the file name with (1) i.e. Test.dat(1) and define GDG for that the file name with naming convention Test* .

It will take care of the counters.

Thanks

Swarup

prabhu_s2
Active Contributor
0 Kudos

also check the option with operating system command. using a shell script check if u can have this done. again there u need to have logic implemented to acheive this function

former_member859847
Active Contributor
0 Kudos

Hi Neha,

You can generate sequnce no in output file name.

The following url will help you alot.

but you need to modify the program which is avialble in the blog.

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

award points, it it really helpful;)

Regards

mahesh.

Former Member
0 Kudos

Hi,

The file name is extended with a counter, which is inserted before the file name extension (for example, default002.file). This selection is only available for the File System (NFS) transport protocol.

Make specifications for Counter Definition:

● Prefix

Specify one or more characters that you want to add before the counter in the file name.

● Format

Specify the first counter to be used. It must be a valid integer number. Leading zeros are permitted.

● Step

Specify the counter increment.

● Mode

Specify when the counter is to be added.

○ After First File

The counter is added when the file name is used unaltered for the first time.

○ Immediately

The counter is added with the first document.

http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Thanks

Swarup