The code of method is exceeding the 65535 bytes limit

Highlighted
One Star

The code of method is exceeding the 65535 bytes limit

Hi,
My Job generate a job where the code of method is exceeding the 65535 bytes and i don't know how reduce the size of the method.
My job have to read a file positionnal and execute a lot of transformation to insert / update data in database in lot of tables with the data read in file.
I think that my job is bad modelised because il put all transformation in a only job but i don't know how create sub-job or other in my case.
Fastly, my job do the transformation below :
tfileInputRegex----> tMap --if three first caracters == 000 ---> save data in context
--if three first caracters == 010 ---> i do insert data in four tables in database and save some data in context
--if three first caracters == 020 ---> i do insert data in two tables in database
--if three first caracters == 030 ---> ...
--if three first caracters == 040 ---> ...
For all my steps, i use the data readed in tFileInputRegex to insert data in database. I don't see how explose my job in somes function java, job-code or other.
Highlighted

Re: The code of method is exceeding the 65535 bytes limit

If you're hitting the max method size its a good idea to start thinking of a fundamental redesign of your job.
without knowing much about the problem you need to solve, I can suggest that you shard your input file (by the first 3 characters) so that you can have one job to parse '010' lines, one job to parse '020' lines etc...
Highlighted
One Star

Re: The code of method is exceeding the 65535 bytes limit

Hi,
Thanks for response but i don't do a job by type of line (010, 020, 030, 040, ...) because i don't share the database connection between my job and so the connection will be done to each line... i believe.
I think to have find a solution for my problem.
I success to split my job in lot of sub-job like this :
tfileInputRegex ----> tMap ---- if three first caracters == 000 --> toFlowToIterate --> tJavaRow (i stock the data) ---- On component Ok --> tFixedFlowInput --> ...
---- if three first caracters == 010 --> toFlowToIterate --> tJavaRow (i stock the data) ---- On component Ok --> tFixedFlowInput --> ...
---- if three first caracters == 020 --> toFlowToIterate --> tJavaRow (i stock the data) ---- On component Ok --> tFixedFlowInput --> ...
---- if three first caracters == 030 --> toFlowToIterate --> tJavaRow (i stock the data) ---- On component Ok --> tFixedFlowInput --> ...
...

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog