on 09-22-2016 7:56 AM
Hi Experts,
My requirement is like suppose if there is a file with 58 records it is getting split in to 12 individual files with 5 records each. Now in mapping level using UDF , we need to name the each file ending with number like here in this example there 12 files that got generated after splitting then UDF should name them as file1, file2, .... file12 etc. & also counter should be reset to zero every day and start from beginning each day like if tomorrow there n number of files preset on source then they should named as file1, file2 ... filen. Is it possible by global container ? Kindly guide me with code sine I am new to this.
Thanks,
Ramu G.
Hi Ramu,
Please furnish more details on the scenario.
1. Sample input and output file
2. are you using FCC in source
3. do you need fcc in receiver side.
4. format of source file and format of target file to be generated.
5. Is this NFS to NFS or involves FTP/SFTP.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anupam,
Sorry for delay in my reply. Please find below answers.
1. Sample input and output file
- you can take any files with some sample DT as input & output file should have same content but filenames should have counter at end.
2. are you using FCC in source
No NFS used on source.
3. do you need fcc in receiver side.
No NFS used on target.
4. format of source file and format of target file to be generated.
.DAT would be source file format & .DAT would be target file format
5. Is this NFS to NFS or involves FTP/SFT
NFS to NFS interface.
Thanks,
Ramu.
Dear Anupam,
Sorry the inputs I gave above are wrong, input channel is SFTP using FCC to convert to xml then in mapping I need UDF to name the files that are split to file1, file2, ...filen etc.
I mapped root node of source & target DT as below with UDF in between them.
Where UDF is used in b/w them, can you please guide me with code.
Thanks,
Ramu G.
Dear Anupam,
Sorry for delayed response.Please find the below answers.
1. what is the receiver adapter/protocol? (NFS/FCC/FTP/SFTP)
It is NFS.
2. what is the output file type ? xml/csv
xml
3. sample output file produced
both input & output file content are one and same , in sender FCC the flat file is getting converted to xml and in mapping
I am thinking to write an UDF involving global container & dynamic configuration for filename generation
with counter & again reset it to zero every day using the similar logic in blog suggested by Evgeniy which is:
4. sample input file
Please consider some input xml file with any fields where the input & output structures would be same, Just need to increase the counter in filename using global container UDF.
Thanks,
Ramu G.
Dear Praveen,
Every day how many files you picked up from source directory??
- The count is varies from day to day & it is not constant.
is it only one file per day?? or multiple files per day??
- Multiple files per day.Suppose in a day sender channel is picking up "N" number of files which will have different name but using UDF I need to name them depending on count like file1, file2, file3, .....fileN .
Next day/next time say there are "M" number of files then they should be named like file1, file2, .... fileM. Kindly suggest.
Thanks,
Ramu G.
Hi Ramu,
Regards,
Praveen.
Hi Praveen,
I could manage to split the file but here I just need to name the files according to number using UDF please forget about splitting depending on records count. I could manage to convert .txt to .xml by sender FCC.But my requirement is:
As you said if there are two files like First1.txt, First2.txt then they are converted to xml in FCC but they need to named as file1.xml , file2.xml .
During second time , say if there are two files Second1.txt, Second2.txt then I need UDF where they can they should be named again as file1.xml , file2.xml but not file3.xml, file4.xml since they have ended with 2 last time.
Thanks,
Ramu G.
Hi Ramu,
Regards,
Praveen.
Hi Praveen,
- Yes, right.
- We can append by timestamp or as you said we can create First1.xml, First2.xml.
- We can create Second1.xml, Second2.xml after picking from Second.txt.
- We can create either First1.xml, First2.xml (or) Second1.xml, Second2.xml inorder to avoid
duplicate files issue.
Kindly help me with UDF using global container & Dynamic configuration to achieve this.
Thanks,
Ramu G.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Experts,
Kindly help me on the above requirement, Thanks a ton in advance!
-Ramu G.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.