Use of &scop

Posted by goo on 07-Feb-2018 06:42

11.7

Is it not possible to use &scop like this? :

THis one Works:

ProcedureA

&scop StatusNew 1
&scop StatusInWork 2
&scop StatusFinished 3

for each ..... where xxx = {&StatusNew}:

end.

__________________

THis one does not work:

myinclude.i

&scop StatusNew 1
&scop StatusInWork 2
&scop StatusFinished 3

procedureA:

for each ..... where xxx = {&StatusNew}:

end.

end.

What am I doing wrong?

Posted by Mike Fechner on 07-Feb-2018 07:12

In an include you must use global-defines if they should be valid outside the include file.

Sent from Nine

Von: goo <bounce-goo@community.progress.com>
Gesendet: Mittwoch, 7. Februar 2018 14:08
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] Use of &scop

Update from Progress Community
goo

I am putting the &Scop definitions in an include file, and the including that file into my procedure...

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

All Replies

Posted by Matt Gilarde on 07-Feb-2018 06:53

Does not work as in doesn't compile or doesn't run as expected?

Posted by Matt Gilarde on 07-Feb-2018 06:54

It would be helpful to provide examples that actually compile against the sports2000 database.

Posted by goo on 07-Feb-2018 06:56

Does not compile….
 

Posted by Matt Gilarde on 07-Feb-2018 07:03

This compiles for me. How is your code different? Are the contents of myinclude.i important?

ProcedureA:

&scop StatusNew 1
&scop StatusInWork 2
&scop StatusFinished 3

for each customer WHERE creditlimit = {&StatusNew}:

end.

/*******************************/

//myinclude.i

&scop StatusNew2 1
&scop StatusInWork2 2
&scop StatusFinished2 3

procedureB:

for EACH customer WHERE creditlimit = {&StatusNew2}:

end.

Posted by Mike Fechner on 07-Feb-2018 07:04

Would you mind sharing the actual error message with us? Or is that top secret?

Sent from Nine

Von: goo <bounce-goo@community.progress.com>
Gesendet: Mittwoch, 7. Februar 2018 13:57
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] Use of &scop

Update from Progress Community
goo

Does not compile….
 

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Posted by goo on 07-Feb-2018 07:04

Sorry, the code is so simple that it should be possible to reproduce easier than making code against sports2000….
 
It seems like if I add scopes in an includefile, eclipse does not get them, and then it feils….
 
This compiles with the scope in the same file, but not if I add them to an includefile and include that…
 
PROCEDURE ProcessType_{&TypeFakturer}:
  /*------------------------------------------------------------------------------
   Purpose:
   Notes:
  ------------------------------------------------------------------------------*/
  LOG-MANAGER:WRITE-MESSAGE ('Funnet: endrer til {&StatusInWork} for jobbnr:' + string(JobbKo.iJobbkoId)).
  changeJobbkoStatus({&StatusInWork}).
  addJobbkoLogg('Start: ' + string(NOW)).
 
  oFR = NEW FakturaRapport(Jobbko.JobbkoJobbnr,Jobbko.JobbkoKlientnr).
 
  changeJobbkoStatus({&StatusFinished}).
  addJobbkoLogg('Ferdig: ' + string(NOW)).
 
  addJobbko(Jobbko.iJobbkoId,{&TypeLagBevis},{&StatusNew},JobbKo.JobbkoJobbnr,Jobbko.jobbkoKlientnr).
 
END PROCEDURE.
 
 
 

Posted by goo on 07-Feb-2018 07:05

I am putting the &Scop definitions in an include file, and the including that file into my procedure...

Posted by goo on 07-Feb-2018 07:06

THis is put into an includefile:

&scop StatusNew 1

&scop StatusInWork 2

&scop StatusFinished 3

&scop TypeFakturer 1

&scop TypeLagBevis 2

&Scop TypeFlyttVismaXML 3

Posted by marian.edu on 07-Feb-2018 07:09

you need global not scope define, the later work only for code in same file as far as I remember… what is wrong with it is the abbreviated form though ;)


Marian Edu

Acorn IT 
+40 740 036 212

Posted by Mike Fechner on 07-Feb-2018 07:12

In an include you must use global-defines if they should be valid outside the include file.

Sent from Nine

Von: goo <bounce-goo@community.progress.com>
Gesendet: Mittwoch, 7. Februar 2018 14:08
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] Use of &scop

Update from Progress Community
goo

I am putting the &Scop definitions in an include file, and the including that file into my procedure...

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Posted by goo on 07-Feb-2018 07:20

Thanks !!!!

Posted by Patrick Tingen on 08-Feb-2018 01:36

&SCOPED-DEFINE was designed to be valid only in the file you define it in, so if you define it in an include, it is not valid outside of that include. &GLOBAL-DEFINE is valid throughout the whole compilation unit.

Besides that, I would like to urge you to restrain yourself from overusing includes. They seem very handy and they are for defining stuff like datasets or temp-tables and the like, but don't use them for real code. With that I mean with that is constructions like this:

{ find.i &table=customer &where="cust-id = 12" &lock=exclusive }

find.i

FIND {&table} WHERE {&where} {&LOCK}-LOCK NO-ERROR.

They create an unnecessary coupling of programs. By using includes in this way, you couple all programs that use it to each other, even though those programs have nothing to do with each other.

I noticed that you used it for statuses and that is OK (consider using enums!) but I just wanted to point it out.

This thread is closed