Sun Aug 07, 2022 10:46 pm
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl ( This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.

Detecting a layout

Comments and questions related to the Enterprise Control Language

Tue Jun 29, 2021 8:29 pm Change Time Zone

Hello, I hope someone can help with this. Any way we can detect an input file's layout before performing the next operation. Let's say the vendor sends a monthly file but sends it with two different layouts without warning. How can I ask the compiler to make a decision based on the input layout with ECL code?
Posts: 18
Joined: Thu Jan 09, 2020 3:57 pm

Wed Jun 30, 2021 2:31 pm Change Time Zone


It's not the compiler, but the runtime that needs to know.

You write your code to handle either, then you could read the first 32K of the file with a RECORD structure like this:
Code: Select all
rec := RECORD
  DATA1 char;
and do some heuristics to detect which format you've got.


Community Advisory Board Member
Community Advisory Board Member
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Fri Jul 02, 2021 3:56 pm Change Time Zone

Also read up section
'RECORD Structure' in the ECL reference manual.
In there you'll see an
IFBLOCK construct you can use in a RECORD layout.
This IFBLOCK is a run time action conditional on content of preceding fields in the same record.


Posts: 444
Joined: Sat Oct 01, 2011 7:26 pm

Return to ECL

Who is online

Users browsing this forum: No registered users and 2 guests