Fri Nov 16, 2018 1:34 pm
Login Register Lost Password? Contact Us


Module cannot be exported

Topics specific to the use of the ECL IDE

Fri Aug 24, 2018 3:33 pm Change Time Zone

Hi,

I have problem running the following code (it's from Introduction to ECL 2 Course):

IMPORT $,STD;

EXPORT STD_Persons := MODULE
EXPORT Layout := RECORD
$.UID_Persons.UID;
$.UID_Persons.RecID;
STRING15 FirstName := STD.Str.ToUpperCase($.UID_Persons.FirstName);
STRING25 LastName := STD.Str.ToUpperCase($.UID_Persons.LastName);
STRING1 MiddleName := STD.Str.ToUpperCase($.UID_Persons.MiddleName);
STRING2 NameSuffix := STD.Str.ToUpperCase($.UID_Persons.NameSuffix);
UNSIGNED4 FileDate := (UNSIGNED4)$.UID_Persons.FileDate;
$.UID_Persons.BureauCode;
$.UID_Persons.Gender;
$.UID_Persons.DependentCount;
UNSIGNED4 BirthDate := (UNSIGNED4)$.UID_Persons.BirthDate;
$.UID_Persons.StreetAddress;
$.UID_Persons.City;
$.UID_Persons.State;
UNSIGNED3 ZipCode := (UNSIGNED3)$.UID_Persons.ZipCode;
END;
EXPORT File :=output($.UID_Persons,Layout)
:PERSIST('~CLASS::SS::PERSIST::STD_Persons');
END;

I get error C2386: Module OnlineShayan.STD_Persons does not EXPORT an attribute main() (0, 0), 0,

The code works well if I perform it as an action. But as a module, I can't export it. What do you think is the problem?

Thanks,
Shayan
sh.shmss
 
Posts: 4
Joined: Fri Aug 24, 2018 3:24 pm

Mon Aug 27, 2018 8:04 pm Change Time Zone

Shayan,

I presume when you said:
The code works well if I perform it as an action. But as a module, I can't export it.
That what you meant was you could not just hit "Submit" and run a workunit. And the reason for that is implied by the error message:
Code: Select all
Module OnlineShayan.STD_Persons does not EXPORT an attribute main() (0, 0), 0,
because there is no action in the code. You DO have an EXPORT definition whose expression is the OUTPUT action, but by giving it a definition name you make it no longer a direct action but just an action definition to be invoked as an action elsewhere in your code.

So, the real lesson here is: never just hit "Submit" on a definition file (any file that contains an EXPORT or SHARED definition) -- because sometimes it will work and sometimes it won't (and in this case, it won't). If you want to run your code, the file you "Submit" should always be "BWR" code ("Builder Window Runnable" code as discussed in the ECL courses).

HTH,

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


Return to ECL IDE

Who is online

Users browsing this forum: No registered users and 1 guest