cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle multiple structures in sender file content conversion in SFTP?

Former Member
0 Kudos

Hi,

I have a file structure like below with fixed length.

FileHeader  

      field1,field2,...

BatchHeader  

     field1,field2,....

DetailRecord    

     field1,field2,....

BatchTrailer

     field1,field2,....

FileTrailer

     field1,field2,....

File Header and File Trailer repeats once in the file. Batch Header, Detail Record and Batch Trailer repeat multiple times. May be take it as for each employee the Batch Header, Detail Record and Batch Trailer gets repeated with multiple line items (Detail Record ) for each employee.

FH0012016   28072016

BH0165757   28072016 1st

DT0165757   28072016  Richa 388893 34.09

DT0265757   28072016  Tina   385693 36.09

BT0165757   28072016  1st

BH0234345   29072016 2nd

DT0134345  28072016  Dilip   388893 44.09

BT0165757   28072016  2nd

FT0012016   28072016

I tried placing the file in NFS location and pick with file adapter , FCC is not working. Kindly help me how to pick the file with this structure from sender location.

Regards,

Suman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All,

'FileHeader,1,BatchHeader,*,DetailRecord,*,BatchTrailer,*,FileTrailer,1'

RecordSet Sequence parameter be Variable

This worked for my case.

Regards,

Suman

Answers (4)

Answers (4)

apu_das2
Active Contributor

Hi Suman,

It seems to be a very simple file structure. can you please share your FCC your are using so that prominent answer can be given.

Thanks,

Apu

Former Member
0 Kudos

Hi Apu,

In channel ,

Recordset Structure : FileHeader,1,BatchHeader,1,DetailRecord,*,BatchTrailer,1,FileTrailer,1


The same is repeated for others.

It works fine when i have the below.

FH0012016   28072016

BH0165757   28072016 1st

DT0165757   28072016  Richa 388893 34.09

BT0165757   28072016  1st

FT0012016   28072016

When Batch Header, Detail Record and Batch Trailer gets repeated , it fails with error . So when the next batch starts , it fails.

vicky20691
Active Contributor
0 Kudos

Your file is not in accordance with the data type structure.

Batch header and batch tailer have occurrince 0-1 , it can't repeat

Regards,

Vikas

Former Member
0 Kudos

Hi Vikas,

I tried with the below as well but it gives me the same error as posted above.

Regards,
Suman

vicky20691
Active Contributor
0 Kudos

Hi Susan,

As per ur structure ur file can be like this

----first recordset----

FH

BH

BH

BH

BH

Dr

Dr

Dr

Bt

Bt

Bt

Ft

----second recordset----

FH

BH

BH

Dr

Dr

Bt

Bt

Ft

So

Former Member
0 Kudos

Hi Vikas,

I get your point. Please revisit the question . I tried my solutions , they are not working. I have posted the question to fix the design. Have a look at the file structure (at top) and kindly help with how to design the Data Type and FCC.

Regards,
Suman

Former Member
0 Kudos

Hi Suman,

As per your file you need to maintain BatchHeader,*,BatchTrailer,*

Regards,

Suhale Shaik.

Former Member
0 Kudos

Hi Suhale,

I tried 'FileHeader,1,BatchHeader,*,DetailRecord,*,BatchTrailer,*,FileTrailer,1'that but gives the same error 'len no 5 missing before Batch Header'

Regards,
Suman

Former Member
0 Kudos

Hello All,

My file pattern looks like the below.

FH

BH

DL

BT

BH

DL

DL

DL

DT

BH

DL

BT

BH

DL

DL

DL

BT

FT

Regards,

Suman

manoj_khavatkopp
Active Contributor
0 Kudos

Try setting sequence of the recordset structures : Variable in your FCC.

apu_das2
Active Contributor
0 Kudos

Hi Suman,

Looking into structure now its bit clear to me. To pick it simply without and custom module your source structure should looks like below as you dont know how many times this chunk will occur -

Batch Header

    Detail Record  0.*

Batch Trailer

Structure should looks like -

FileHeader   0.1

BHDTBTRecord   0.*

FileTrailer     0.1

FCC

FileHeader  as you have done currently

BHDTBTRecord.fieldSeparator  'nl'

BHDTBTRecord.endSeparator   'nl'

FileTrailer  as you have done

Now you should get a separate BHDTBTRecord tag for all BH, DT and DT like -

<BHDTBTRecord>BH0165757   28072016</BHDTBTRecord>

<BHDTBTRecord>DT0165757   28072016  Richa 388893 34.09</BHDTBTRecord>

<BHDTBTRecord>DT0265757   28072016  Tina   385693 36.09</BHDTBTRecord>

<BHDTBTRecord>BT0165757   28072016</BHDTBTRecord>

Now use an UDF ... split each record by space and store in array/arrayList as per requirement. Reading first 2 characters of arr[0] will understand whether its Batch Header/Detail Record/Batch Trailer and map to the target accordingly from the UDF using multiple ResultList object.

By the way how did you use keyField is it fixed.

Thanks,

Apu

former_member190293
Active Contributor
0 Kudos

Hi Suman!

Regards, Evgeniy.

Former Member
0 Kudos

Hi Suman,

For your file structure, below should be the data type structure:

Accordingly you need to change your FCC.

Regards,

Vishal

Former Member
0 Kudos

Hi Suman,

1. Please do FCC & have your 1st structure (All nodes at same level).

2. For this 1st structure you can apply java mapping to have DetailRecord under your BatchHeader record.

Let the RecordSet Sequence parameter be Variable while doing FCC in 1st step.

Regards,

Mohammed Farooq

Former Member
0 Kudos

Hi Suman,

Please go through the below blogs for MTB in SFTP sender for your requirement.

Regards,

Suhale Shaik.

former_member186851
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

Raghu,

My query is to pick multi level structure. Your answer relates to mapping multi level structures.

Regards,
Suman

former_member186851
Active Contributor
0 Kudos

Hello Suman,

Lets wait for Apus reply.

up to 2 level you can pick from FCC,rest you have to handle in mapping only after pick.