Jump to content


Photo
- - - - -

Can a GLOBAL_LSCALL be called from Global Logic


17 replies to this topic

#1 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 16 October 2002 - 11:50 AM

Can a GLOBAL_LSCALL be called from Global Logic?

I tried and it does not seem to work.. Just verifying this.

#2 Mike Schoen

Mike Schoen

    Expert

  • Members
  • PipPipPipPip
  • 198 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 16 October 2002 - 12:23 PM

It can, sort of. (Under 4.6, I havent tested version 5 yet)

I have found that you can't pass numerics in/out, but
alpha's can be passed successfully.

And you can call globals that have no parameters.
I've made a few global logics that save @$com* to
scratch variables, set up values for the global,
and restore @$com* when done.

Not pretty, but it has the advantage of working.

#3 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 16 October 2002 - 12:43 PM

Thanks!

that will save me many hours on my current project.

#4 Dan Shannon

Dan Shannon

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 374 posts
  • Gender:Male
  • Location:Australia

Posted 16 October 2002 - 01:09 PM

There also seem to be problems if the interface name you use is not unique in the function using the global logic - I use g001, g002, and so on to uniquely name interfaces for GLOBAL_LSCALLs in global logic. You need to ensure that they're unique across ALL global logics, so as to prevent mistakenly using the same interface in 2 different global logics in the same function.

In general it's a bit ropey - suck it and see! But it DOES work if you persist and it's extremely useful.

Cheers

Dan Shannon

#5 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 16 October 2002 - 04:03 PM

Dan
I 1-st defined this:
GLOBAL CALL INTERFACE FUNCTION NAME: SALESWK Caculate the salesweek

CALLED GLOBAL FUNCTION: SW INTERFACE ID: 1

and then:
CALLED GLOBAL FUNCTION: SW2 INTERFACE ID: 1

So even though the 'CALLED GLOBAL FUNCTION' is different,the fact they have the same 'INTERFACE ID' will call problems?

Also, is ther a way to delete a 'GLOBAL CALL INTERFACE' for a Function or Global Logic?

Rob

#6 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 16 October 2002 - 05:39 PM

FYI,

I give up on calling a GLOBAL Function from a global logic.

It would work sometimes and other times not. I'm not going to trust it.

Better to do more cooding for calling the global function from a regular function.

#7 Dan Shannon

Dan Shannon

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 374 posts
  • Gender:Male
  • Location:Australia

Posted 17 October 2002 - 08:36 AM

Two things:

1. Don't use interface names that start with a numeric - causes all kinds of weird problems on some versions of PRO-IV. And use unique interface names for unique calls.

2. To delete an interface, either use the cleanup stuff in Studio, or delete the records in GLFINTFS bootstrap file.

3. Don't give up! It really does work.

4. Damn, that's 3 things...

#8 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 17 October 2002 - 11:07 AM

Dan,

The problem I have is the inconsistancy. SOmetimes this works and other not. Using the salme global logic.

The problem I'm running into could happen when:
1- the calling function is big.


2- the calling function needs a larger number of
variables returned.... I Just eliminated this possibility by testing..



I have 300 functions that call the Global Logic. I tested 30-40 of them then put the whole group in production. 10 minutes later I had to revert to a backup... So I'll find the problem & solution and get back to you.
The best solution may be to write a pgm
1- enter pgm name
2- auto add recs to GLPARMS .
3- use GLOBAL_LSCALL from the 300 pgms instead of calling the global logic..

That would cut the production work of adding 300
GLOBAL CALL INTERFACE sets of records. Which is the only reason I;m trying to use GLOBAL LOGIC to do the GLOBAL_LSCALL.

#9 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 17 October 2002 - 11:09 AM

Rob,

Appendix F of principles and practice doc explicitly lists 'Calling Global Functions from Global Logic' as something that does not work ON THE MAINFRAME.

Which rather implies it is supposed to work anywhere else!

I'd like to think this can work as it is something I was hoping to use heavily in future :)

Don't give up!
Use the forum Luke...

Although I don't use this now, one question nevertheless occurs to me..

Might there be a problem if one used a NON-EXTERN scratch variable in global logic with the same name as one used elsewhere in the function?
Nothing's as simple as you think

#10 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 17 October 2002 - 11:33 AM

Richard,

I've about spent as long as I can on this.

GLOBAL_LSCALL from Global Logic works if the function which calls the global logic is not big. It does not work from large functions.
THe problem is the inconsistancy. So I can't use it.
I did not try every possibility to get this to work. But I'd bet that if I got it to work now, that some upgrade to pro4 would eliminate the bug I utilized to get it to work.

I think for 4.6 rev213 that GLOBAL_LSCALL called from Global Logic is not reliable.

Rob

#11 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 17 October 2002 - 11:40 AM

Dan,

Just wanted to be sure what you meant by 'use unique interface names for unique calls'.

I understood you to mean - use a systemwide-unique interface-id for every distinct global-logic:called-function pair. This is not quite 'every GLOBAL_LSCALL from a global logic' because I presume it is OK to use the same interface-id to call the same function more than once from the same global logic?

This presumably ensures that whatever combination of global logics end up being used by a function, none of them can use a common interface-id (and none of them will use an interface-id also used by the calling function or any called functions)?

I presume it's no problem to use the same interface-id twice within the same or different local logic routines of the top-level calling function?

Do you have a view on where problems arise? Does it seem to be with scratch variables for example or with specific parameter types (ie. I/O/B/E) ?

Do you think there's an issue if there are global logics with the SAME NAME as the (calling or called) function?

Regards, Richard


Ps. More tortuously...

Do you have any experience with this issue where a called global FUNCTION itself makes further GLOBAL_LSCALLs (via global logic or otherwise)?

What if a global functions ends up being used recursively (via global logic or otherwise) ?! Obviously in this case the same interface-id(s) must be reused in some sense!

Ouch. my brain hurts. I think I'll stop now.
Sorry that turned into such a long post..
Nothing's as simple as you think

#12 Dan Shannon

Dan Shannon

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 374 posts
  • Gender:Male
  • Location:Australia

Posted 17 October 2002 - 11:47 AM

Richard,

Your interpretation of my loosely-defined statement is, of course, correct. You can use the same interface ID multiple times in one global logic to call the same function.

As for recursive calling of global screens, it seems to work fine. Some of the apps I've written do this quite deliberately and seem to work OK (for example, opening multiple logic editor windows, all using the same logic editor global function, in the editor I've written).

Of course eventually you'll run out of function workspace if you keep calling more and more functions...

Cheers

Dan

#13 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 17 October 2002 - 11:49 AM

OK Rob, thanks for persisting this far. Workspace problems maybe, yechhhhh...

Can you tell me specifically what you meant by 'doesn't work' ie. does it coredump, do some of the parameter values not arrive in the called function or what? Do the symptoms vary?

I'll try and make some time to pursue it later.

Regards, Richard
Nothing's as simple as you think

#14 Dan Shannon

Dan Shannon

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 374 posts
  • Gender:Male
  • Location:Australia

Posted 17 October 2002 - 11:49 AM

Rob,

None of us actually said it was *reliable* :)

#15 Rob Fantini

Rob Fantini

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 267 posts
  • Gender:Male
  • Location:Haverhill, United States

Posted 17 October 2002 - 03:33 PM

Here is some workspace info:


1- pgm which had problem:

10/17/02 FUNCTION DEFINITION REV#: 4.6000
FUNCTION NAME: OS1B TITLE: ORDER ENTER HEADER SCREEN 08-2002
TYPE: S
LOGIC SIZE: 3594 GLOBAL LOGIC SIZE: 259 FORMAT/HEADER SIZE: 599
FIELDS SIZE: 9792 BASE SIZE: SYMBOL TABLE SIZE: 21000




2- pgm which worked:
FUNCTION NAME: DATES_S TITLE: TEST YEAR DATA LOGIC
LOGIC SIZE: 12 GLOBAL LOGIC SIZE: 200 FORMAT/HEADER SIZE: 344
FIELDS SIZE: 680 BASE SIZE: SYMBOL TABLE SIZE: 4176



- The 1-st pgm calls the global logic 4 times. I just tried having it call the global logic 1x. Same problem.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users