Fri Nov 26, 2021 11:07 pm
Login Register Lost Password? Contact Us


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?
mo0926
 
Posts: 18
Joined: Thu Jan 09, 2020 3:57 pm

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

mo0926,

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;
END;
and do some heuristics to detect which format you've got.

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1604
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.

Yours

Allan
Allan
 
Posts: 442
Joined: Sat Oct 01, 2011 7:26 pm


Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest

cron