Mon Oct 25, 2021 11:27 pm
Login Register Lost Password? Contact Us


STD.File.FileExists with nothor()

Comments and questions related to the Enterprise Control Language

Thu Apr 18, 2019 10:38 pm Change Time Zone

I am trying to use nothor() for a simple project() .


Here is my code :
----------------------SNIP---------------------------------------------------
global_newSuperfileLink := global(newSuperfileLink);

newSuperfileLinkCheckLogical := nothor(PROJECT(global_newSuperfileLink,
TRANSFORM(superfile_logicalfile_flat_layout,
SELF.LogicalFileExists := STD.File.FileExists(left.LogicalFile),
SELF := left ))) : INDEPENDENT;

Then I use newSuperfileLinkCheckLogical for rest of the processing …..
----------------------SNIP---------------------------------------------------


This gives me an error : Error: INTERNAL: Expected a parent/container context. Likely to be caused by executing something invalid inside a NOTHOR. (0, 0), 4818,

I just want to check and record if those files actually exist.
rati
 
Posts: 4
Joined: Wed Oct 23, 2013 2:51 pm

Fri Apr 19, 2019 4:32 pm Change Time Zone

rati,

There is no inherent problem with using STD.File.FileExists inside a NOTHOR. I just tested this code on one of our training clusters and it ran fine:
Code: Select all
import Std;
LogicalFile := '~CLASS::RT::Intro::Persons';
NOTHOR(STD.File.FileExists(LogicalFile));
So your problem is not with that function per se. This code also works correctly:
Code: Select all
import Std;
ds := DATASET([{'~CLASS::RT::Intro::Persons'},
               {'~CLASS::RT::Intro::Accounts'},
               {'~CLASS::RT::Intro::NoFileForThis'}
              ],{STRING LogicalFile});

nothor(PROJECT(ds,
                TRANSFORM({BOOLEAN LogicalFileExists,STRING LogicalFile},
                          SELF.LogicalFileExists := STD.File.FileExists(left.LogicalFile),
                          SELF := left ))) : INDEPENDENT;

Perhaps it's an interaction with your use of the GLOBAL function?

HTH,

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

Tue Apr 23, 2019 3:13 pm Change Time Zone

Adding few to global() helped.

Code: Select all
global_newSuperfileLink := global(newSuperfileLink,few);
rati
 
Posts: 4
Joined: Wed Oct 23, 2013 2:51 pm


Return to ECL

Who is online

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

cron