Thu Oct 21, 2021 5:34 am
Login Register Lost Password? Contact Us


Newbe - getting to grips with compiler errors.

Comments and questions related to the Enterprise Control Language

Thu Oct 06, 2011 5:52 pm Change Time Zone

Hi David,

I was going though the example 'Working with Data' from the 'HPCC Data Tutorial'
This worked, but for this simple example I ended up with 7 source files.
I was finding navigation difficult. It would help if the ECL IDE had a 'goto definition' and 'goto reference' ability. (if it does please tell me)

Lacking easy navigation I decided to do much the same but use a Bible example from the reference above, but use a single source file (or two, one to construct the bibliographic and index files, a second to allow searchs)

That's when my troubles started.

The complete program for construction part is below, I've tried to incorporate all I've learnt from the above corrispondance but still get error:
Code: Select all
Error:    WHEN must be used to associated an action with a definition (26, 1), 2325,

The code compiles and works all the way up to the definition of 'With_Index' which is line 26.
If I make the last 3 definitions 'local' I get error:
Code: Select all
Error:    Action side effect is not associated with a definition (3, 19), 2325,

Code: Select all
IMPORT std;

EXPORT Program := MODULE

Layout_Book := RECORD
   STRING Text;
END;

Layout_Verse := RECORD
   UNSIGNED2 Chapter;
    UNSIGNED2 Verse;
   STRING Text;
END;

Raw := DATASET('~thor::genesis_csv',Layout_Book,CSV(HEADING(4)));

Layout_Verse Split(Layout_Book pInput) := TRANSFORM
    SELF.Chapter := (UNSIGNED2)pInput.Text[1..std.str.Find(pInput.Text,':',1)];
      SELF.Verse   := (UNSIGNED2)pInput.Text[std.str.Find(pInput.Text,':',1)+1..std.str.Find(pInput.Text,':',2)];
      SELF.Text    := pInput.Text[Std.Str.Find(pInput.Text,':',2)+1..];
END;

t := PROJECT(Raw,Split(LEFT));
OUTPUT (t,,'~thor::Genesis::C2',OVERWRITE);

EXPORT With_Index := DATASET ('~thor::Genesis::C2',{Layout_Verse,UNSIGNED8 fpos {virtual(fileposition)}},THOR);

EXPORT Index_By_Chapter :=
    INDEX(With_Index,{Chapter,fpos},'~thor::Genesis::VerseByChapterINDEX');

EXPORT BuildGenesis := BUILDINDEX(Index_By_Chapter,OVERWRITE);
END;


Any idea's to help me proceed?
I can't see what I'm doing different form the example from 'HPCC Data Tutorual' apart from place all the source into a single file.

Oh by-the-way, when editing the line and column numbers used to be displayed on the bottom left of the screen, they don't appear now, how are they toggled back on?

In addition is there any way to view line numbers with the source code? I see no option in the 'View' pane.

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

Fri Oct 07, 2011 6:52 pm Change Time Zone

Hi Allan,

Perchance are you the Allan that's coming to our training next week?

I believe the error is caused by the nested OUTPUT action prior to the EXPORT. If you define and EXPORT the OUTPUT, you will get no errors. After that, open a new Builder window, IMPORT the MODULE, and then execute any of all of the definitions that you EXPORTed.

This code compiles fine without errors:

IMPORT std;

EXPORT Program := MODULE

SHARED Layout_Book := RECORD
STRING Text;
END;

SHARED Layout_Verse := RECORD
UNSIGNED2 Chapter;
UNSIGNED2 Verse;
STRING Text;
END;

SHARED Raw := DATASET('~thor::genesis_csv',Layout_Book,CSV(HEADING(4)));

SHARED Layout_Verse Split(Layout_Book pInput) := TRANSFORM
SELF.Chapter := (UNSIGNED2)pInput.Text[1..std.str.Find(pInput.Text,':',1)];
SELF.Verse := (UNSIGNED2)pInput.Text[std.str.Find(pInput.Text,':',1)+1..std.str.Find(pInput.Text,':',2)];
SELF.Text := pInput.Text[Std.Str.Find(pInput.Text,':',2)+1..];
END;

t := PROJECT(Raw,Split(LEFT));
EXPORT myout := OUTPUT(t,,'~thor::Genesis::C2',OVERWRITE);

EXPORT With_Index := DATASET ('~thor::Genesis::C2',{Layout_Verse,UNSIGNED8 fpos {virtual(fileposition)}},THOR);

EXPORT Index_By_Chapter :=
INDEX(With_Index,{Chapter,fpos},'~thor::Genesis::VerseByChapterINDEX');

EXPORT BuildGenesis := BUILDINDEX(Index_By_Chapter,OVERWRITE);
END;


Note the use of SHARED, which allows definitions to be used within the same module.

Hope this helps!

Best regards,
Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1005
Joined: Wed Jun 29, 2011 7:13 pm

Fri Oct 07, 2011 7:09 pm Change Time Zone

Also, to turn on line numbers, go to the Preferences window (click on the ECL IDE Orb menu in the upper left corner, and click on the Preferences button in that window. The Line Numbers setting can be found in the Editor tab.
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1005
Joined: Wed Jun 29, 2011 7:13 pm

Fri Oct 07, 2011 8:26 pm Change Time Zone

Hi Bob,

I was coming on the course next week but family problems mean I must delay joining LN till Mid November (hopefully) with a view to taking the January course.

In the mean time I'm attempting to learn ECL.

Your suggestion worked a treat.

Code: Select all
OUTPUT (t,,'~thor::Genesis::C2',OVERWRITE);


generates Error
Code: Select all
Error:    WHEN must be used to associated an action with a definition (26, 1), 2325,

Whereas:
Code: Select all
x := OUTPUT (t,,'~thor::Genesis::C2',OVERWRITE);

Compiles cleanly!

I don't think the code breakers at Bletchley Park would have got that one :-)

As to displaying the cursor position (line,column) I can find preferences but I can't find this 'ECL IDE Orb' thing. My ECL IDE Version is 6.0.1.5.682.1

I must admit I'm finding this whole IDE/ EClWatch a bit buggy and lacking in features.
1. With ECLWatch The 'Description' of a logical file is displayed when viewed from 'Browse Logical Files' but not displayed when viewing via 'Browse File by scope'.

2. Attempting to Zoom in on a graph screen does not work properly, thats ctrl+. You get into a situation where you cannot scroll to see any part of the graph.

3. Close ECL IDE with files open works ok (the changes are saved), however on restarting the IDE the same files are marked as requiring saving (* by name in tab).

4. No way to move cursor to the matching block token, be that END,(, or {

5. No 'goto definition' or 'goto reference'. Seems to be important given a project seems to require numerious source files.

6. No context sensitive help.

7. 'Print' -> 'Print Setup' Also beings up the 'ECL Reference' help.

8. Ability to do f1 on an error message to get up its help. PLEASE! (it brings up the ECL reference dialog box which is a fat load of use.)

9. On closing the 'preferences' dialog box a [0%] image is left on the screen and is still there on closeing the entire IDE! (I'm using Windows 7)
(Can't reproduce this one)

10. If you go though all the tabs on the 'Preferences' dialog box, on canceling it prompts to save changes made even though you've not made any changes.

11. If the 'Limit Results (rows)' in the 'Results' tab of the 'Preferences' dialog box is set to >= 1000 the number of rows output in a result set is set to 1.

Anyway Thanks for your help. If you'r in a position to, could you please pass on my comments above. I have a feeling I have more in a short while.

Yours

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

Mon Oct 10, 2011 7:44 pm Change Time Zone

The fact that a single file contains a single EXPORT definition whose name must match the filename is one of those bits of information that sits on the cusp between the Language and the environment tools.

This code file/EXPORT definition relationship is highly stressed in our ECL classes (which you are most welcome to attend, take a look at http://hpccsystems.com/products-and-ser ... s/training). But as you pointed out, it is missing from our language reference documentation. I think that's because it most properly belongs as part of a guided tutorial -- so I have updated the Data Tutorial PDF to include this important fact. The updated PDF will be in the next release.

Thanks for bringing this to our attention.
richard.taylor@lexisnexis.com
 
Posts: 11
Joined: Wed Jun 15, 2011 6:00 pm

Mon Oct 17, 2011 11:16 am Change Time Zone

Allan wrote:3. Close ECL IDE with files open works ok (the changes are saved), however on restarting the IDE the same files are marked as requiring saving (* by name in tab).

4. No way to move cursor to the matching block token, be that END,(, or {

5. No 'goto definition' or 'goto reference'. Seems to be important given a project seems to require numerious source files.

6. No context sensitive help.

7. 'Print' -> 'Print Setup' Also beings up the 'ECL Reference' help.

8. Ability to do f1 on an error message to get up its help. PLEASE! (it brings up the ECL reference dialog box which is a fat load of use.)

9. On closing the 'preferences' dialog box a [0%] image is left on the screen and is still there on closeing the entire IDE! (I'm using Windows 7)
(Can't reproduce this one)

10. If you go though all the tabs on the 'Preferences' dialog box, on canceling it prompts to save changes made even though you've not made any changes.

11. If the 'Limit Results (rows)' in the 'Results' tab of the 'Preferences' dialog box is set to >= 1000 the number of rows output in a result set is set to 1.


Alan - Thank you for your feedback, I will be opening issue tickets on GIT Hub for most of these, but would like to address some of the minor ones:

4. Match brace (and select to match brace) are available under the "Advanced" option either in the Ribbon or in the context menu (ctrl+E and ctrl+shit+E). It does not currently work with RECORD/END etc. but given we "know" about these and use them for the tree folding, it should be possible to add this.

5. There are some limited locate functions, F12 will attempt to resolve an external "attribute" but its use is limited. FWIW Historically all ECL was stored remotely with the HPCC server and the client IDE had no access to all the ECL files, making "proper" resolving impossible. However this functionality will be part of the eclipse plugin which is under development.

6. There is context help for ECL now (in later IDE builds).

7. These worked fine on my machine (maybe fixed in later IDE build?)

8. I shall forward this suggestion to documents guys and see if we can get an indexed help file for it.

Gordon.
gsmith
 
Posts: 290
Joined: Thu May 12, 2011 9:40 am

Mon Oct 17, 2011 3:17 pm Change Time Zone

Hi Gordon,

Thanks for taking these suggestions on board.

There were items 1. and 2. which are also repeatable. Please don't miss out those.

Yours

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

Mon Oct 17, 2011 3:37 pm Change Time Zone

Allan wrote:Hi Gordon,
There were items 1. and 2. which are also repeatable. Please don't miss out those.


2. Graph control (there may be differences based on IDE version and/or if you are refering to IDE or EclWatch graphs): But in general double click is your friend, no matter what you double click, it should zoom to fit (so works for zooming out as well as in).
gsmith
 
Posts: 290
Joined: Thu May 12, 2011 9:40 am

Previous

Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest

cron