Mon Dec 09, 2019 12:36 pm
Login Register Lost Password? Contact Us


Parsing an ECL file

Questions around writing code and queries

Tue Jul 23, 2019 7:46 pm Change Time Zone

There is an ECL file in my repository that has a series of statements that assign a source description to a source code like:
export src_ABC := 'AB';

I run some stats grouped by the source codes in the ECL file, and I want to include the source description. So I would like to create a lookup table using the file (this is a living file, it changes, I shouldn't be hard coding anything). Is there a way to use PARSE on an ECL file in a repo? Is there a better way to go about this?
janet.anderson
 
Posts: 33
Joined: Wed Jul 17, 2013 5:31 pm

Tue Jul 23, 2019 8:18 pm Change Time Zone

Janet,

Since an ECL code file is just a UTF8 text file, you can certainly use PARSE on it. But the real issue is getting to it.

It's easy if you are NOT using an old-school, pre-Open Source, central repository, because that means it's just a file on your local hard drive, and you can do anything you want with it. But, if you are using a central repository (a MySQL database to anybody not inside Lexis Nexis) then I have no idea how you can get to that,

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1488
Joined: Wed Oct 26, 2011 7:40 pm

Tue Jul 23, 2019 8:59 pm Change Time Zone

Thanks, Richard. I am using git, so I do have the file locally. However, the IDE already knows where the file is and what it's contents are, so is there a way to avoid having to spray it and then read it as a dataset (like I would for a typical text file)? I'm trying to automate a reporting process to be a one click BWR, so is there a sleek way to do this?
janet.anderson
 
Posts: 33
Joined: Wed Jul 17, 2013 5:31 pm

Tue Jul 23, 2019 9:44 pm Change Time Zone

Janet,

The problem is that, although the IDE knows about the file, you're going to be running that PARSE on a Thor (or hThor) so to make the file available in the cluster you have to be able to define it as a DATASET in your ECL code.

If you can configure your environment to use the machine where your code lives as a Landing Zone (or automate some process to put it on an LZ every time it's updated), you could then define the ECL code file as a Landing Zone file (see the "Scope and Logical Filenames => Landing Zone Files" section in the ECL Language Reference) and then you can PARSE it.

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1488
Joined: Wed Oct 26, 2011 7:40 pm

Wed Jul 24, 2019 1:05 pm Change Time Zone

Thanks, Richard.
janet.anderson
 
Posts: 33
Joined: Wed Jul 17, 2013 5:31 pm

Wed Nov 20, 2019 4:31 pm Change Time Zone

Hi Janet,

Just noticed your post, there is an obscure way to access ECL.
Just use a SOAPCALL on:
Code: Select all
STD.File.GetEspUrl()/WsWorkunits/WUInfo


Requesting just
IncludeECL
on an old workunit (its WUID is a parameter)
to get the ECL back in the SOAP response.

Actually trivial to implement, but a bit 'round the houses'.
Yours
Allan
Allan
 
Posts: 386
Joined: Sat Oct 01, 2011 7:26 pm

Wed Nov 20, 2019 4:38 pm Change Time Zone

Interesting. Thank you.
janet.anderson
 
Posts: 33
Joined: Wed Jul 17, 2013 5:31 pm

Wed Nov 20, 2019 4:45 pm Change Time Zone

Janet,
If you think about it, under the hood the IDE is just one huge set of SOAPCALLS.

Anything you see in the IDE or can manipulate in the same, you can do programmatically and, as you want to do, implement additional functionality not shipped as standard by LN.
Cheers
Allan
Allan
 
Posts: 386
Joined: Sat Oct 01, 2011 7:26 pm

Wed Nov 20, 2019 5:02 pm Change Time Zone

Janet,

Thinking on about this, you could run 'Fiddler'
https://www.telerik.com/download/fiddler

Run it while logging in on the IDE and you will find out the HTTP request/responses the IDE is doing to attach to your particular code repository.

You then just have to reproduce those in your code to get the ECL file you want to parse directly without having to look-up old workunits, which, frankly, is Mad Hatter party time.

I hope this helps.

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


Return to Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron