Fetch modules 
Author Message
 Fetch modules

Hi There

I am no expert in fetch-modulet yet, so I will try to ask here.
I am re-developing a batch-program and the new version have to be more
advanced than the old one, what a surprise.
I have never used fetch-modules but in the company people are writing code
like:
FETCH XX10010;
.
CALL XX10010 (parm);

This is just like normal code the only thing is that the sub-module can be
changed without the need of relinking. I can see that is good in some
situations.

Now, what i really need to do is to fetch a module like this:
FETCHMODULE = 'XX10010'; /* will be from a DB2-base in real life */
FETCH FETCHMODULE;
CALL FETCHMODULE (parm);
in other words a real dynamic load of any submodule, can this be done in
some way?

another question I have is:
Is it possible to FETCH another sub-module in a FETCH-module like:
MAIN:
   FETCH A;
   CALL A('F');

A:
   IF PARM = 'F'
   THEN
       FETCH B;

thanks in advance
Peter Larsen



Sat, 29 Dec 2001 03:00:00 GMT  
 Fetch modules
Hi There

I am no expert in fetch-modulet yet, so I will try to ask here.
I am re-developing a batch-program and the new version have to be more
advanced than the old one, what a surprise.
I have never used fetch-modules but in the company people are writing code
like:
FETCH XX10010;
.
CALL XX10010 (parm);

This is just like normal code the only thing is that the sub-module can be
changed without the need of relinking. I can see that is good in some
situations.

Now, what i really need to do is to fetch a module like this:
FETCHMODULE = 'XX10010'; /* will be from a DB2-base in real life */
FETCH FETCHMODULE;
CALL FETCHMODULE (parm);
in other words a real dynamic load of any submodule, can this be done in
some way?

another question I have is:
Is it possible to FETCH another sub-module in a FETCH-module like:
MAIN:
   FETCH A;
   CALL A('F');

A:
   IF PARM = 'F'
   THEN
       FETCH B;

thanks in advance
Peter Larsen



Sat, 29 Dec 2001 03:00:00 GMT  
 Fetch modules
Peter Larsen writes ...

Quote:
>Hi There

>I am no expert in fetch-modulet yet, so I will try to ask here.
>I am re-developing a batch-program and the new version have to be more
>advanced than the old one, what a surprise.
>I have never used fetch-modules but in the company people are writing code
>like:
>FETCH XX10010;
>.
>CALL XX10010 (parm);

>This is just like normal code the only thing is that the sub-module can be
>changed without the need of relinking. I can see that is good in some
>situations.

>Now, what i really need to do is to fetch a module like this:
>FETCHMODULE = 'XX10010'; /* will be from a DB2-base in real life */
>FETCH FETCHMODULE;
>CALL FETCHMODULE (parm);
>in other words a real dynamic load of any submodule, can this be done in
>some way?

Although I haven't tried it, I believe it should work; "fetchmodule" should be
declared as an entry variable.

Quote:
>another question I have is:
>Is it possible to FETCH another sub-module in a FETCH-module like:
>MAIN:
>   FETCH A;
>   CALL A('F');

>A:
>   IF PARM = 'F'
>   THEN
>       FETCH B;

Not currently. PL/I has long had a limitation that a fectched module may not in
turn fetch another module. Rumor is that the next PL/I compiler (coming in
September?) will support fetching from a fetched module.

Cheers,

Steve Comstock
Telephone: 303-393-8716
www.trainersfriend.com

256-B S. Monaco Parkway
Denver, CO 80224
USA



Sat, 29 Dec 2001 03:00:00 GMT  
 Fetch modules

Quote:

> Now, what i really need to do is to fetch a module like this:
> FETCHMODULE = 'XX10010'; /* will be from a DB2-base in real life */
> FETCH FETCHMODULE;
> CALL FETCHMODULE (parm);
> in other words a real dynamic load of any submodule, can this be done in
> some way?

    another question I have is:

Quote:
> Is it possible to FETCH another sub-module in a FETCH-module like:
> MAIN:
>    FETCH A;
>    CALL A('F');

> A:
>    IF PARM = 'F'
>    THEN
>        FETCH B;

> thanks in advance
> Peter Larsen

 From OS PL/I Programming Guide V2.3

2.4.3.7 FETCH and RELEASE Restrictions

When using dynamically-loaded procedures:

1.  Only external procedures can be fetched.

2.  Variables with the EXTERNAL attribute are not allowed in a fetched
    procedure.

3.  Variables with the CONTROLLED attribute are not allowed in a fetched
    procedure unless they are parameters.

4.  With the exception of the file SYSPRINT, variables with the FILE
    attribute are not allowed in a fetched procedure unless they are
    parameters.  This means any other file used in the fetched procedure,
    including the file SYSIN, must be passed from the calling procedure.

    A file that is explicitly opened in a fetched procedure must be
    explicitly closed in that procedure before the procedure ends.

    A file that is implicitly opened in a fetched procedure must be closed
    only in the fetching procedure.  The close must be prior to releasing
    the fetched procedure.

    A file that is open when it is passed to a fetched procedure must not
    be closed in the fetched procedure.

5.  Storage for STATIC variables in the fetched procedure is allocated
    when the FETCH statement is executed, and is freed when a
    corresponding RELEASE statement is executed.  Each time a procedure is
    fetched into main storage, a STATIC variable either is given the value
    specified in an INITIAL attribute, or, if there is no INITIAL
    attribute, is not initialized.

6.  The FETCH, RELEASE, and CALL statements must specify entry constants.
    An entry constant for a fetched procedure cannot be assigned to an
    entry variable.

7.  Fetched procedures cannot fetch further procedures.

8.  The fetching module and the fetched module must both use (or neither
    can use) the shared library option.

9.  Fetched procedures must not be compiled with the COUNT or FLOW
    options.

Violation of items 3, 4, 6, 8 or 9 causes random errors, but the compiler
is unable to detect the violation.

 I hope you will be useful. To resolve point 7 we've developed our own fetch
ASM interface. This has
 allowed us to chain multiples call of fetched procedure



Sat, 29 Dec 2001 03:00:00 GMT  
 Fetch modules


Quote:
> Hi There

> I am no expert in fetch-modulet yet, so I will try to ask here.
> I am re-developing a batch-program and the new version have to be more
> advanced than the old one, what a surprise.
> I have never used fetch-modules but in the company people are writing
code
> like:
> FETCH XX10010;
> .
> CALL XX10010 (parm);

> This is just like normal code the only thing is that the sub-module
can be
> changed without the need of relinking. I can see that is good in some
> situations.

> Now, what i really need to do is to fetch a module like this:
> FETCHMODULE = 'XX10010'; /* will be from a DB2-base in real life */
> FETCH FETCHMODULE;
> CALL FETCHMODULE (parm);
> in other words a real dynamic load of any submodule, can this be done
in
> some way?

> another question I have is:
> Is it possible to FETCH another sub-module in a FETCH-module like:
> MAIN:
>    FETCH A;
>    CALL A('F');

> A:
>    IF PARM = 'F'
>    THEN
>        FETCH B;

> thanks in advance
> Peter Larsen

Hi Peter,

You didn't mention the release of PL/I and the operating system you use.
So I am nor shure whether my answer to your question is appropriate or
not.

I know of PL/I optimizing compiler for MVS Version 2.3 and IBM PL/I for
MVS & VM Version 1.1 (this is the newer one). On the OS/390 mainframe,
there is no newer compiler version commercial available.

In this environment, the fetched entry MUST be a CONSTANT, not a
variable. No directly dynamic fetching of submodules! The FETCH
statement is a compiler directive rather than a executable statement.

And ... no nesting fetch is allowed. A fetched module cannot fetch
another module. If it does, it gets a runtime error.

Bad news fo you! IBM says that in the next generation of compiler (VA
PL/I for OS/390), these restrictions will no more exist. But for the
moment, you have to design your application a bit less dynamic than
desired (or you write it in COBOL ;-).

If you like ASSEMBLER language, you could write your own fetch routines,
but this is a hard piece of work and not supported by IBM.

--
Cheers

Daniel
------------------------------------------------------------------------
visit us at http://www.winterthur.com

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sat, 29 Dec 2001 03:00:00 GMT  
 Fetch modules

Quote:

>If you like ASSEMBLER language, you could write your own fetch routines,
>but this is a hard piece of work and not supported by IBM.

I've written such a routine (including a preprocessore-proc for
comfortably using it). It will allow fetches on any (hmm, as long MVS
delivers storage) nesting level and switching between arbitrary
AMODE(24/31).

If you're interested I'll post it (after my coming vacation for four
weeks...). Please email me for details.

CUL8R!

Ing. Michael Fitz
A-2410 Hainburg; Carnuntumstr. 21

=== PGP-Key on request ===



Mon, 31 Dec 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Fetch modules and file I/O

2. Fetching HTML Pages with Socket Control

3. Fetch Returns Record Not Found... revisited

4. Problem with fetch after insert

5. Fetch Not Working (C5EE & ABC)

6. How to check for error on a FETCH

7. HELP can't perform FETCH

8. HELP: Keeping entries in record buffer after a fetch

9. Fetch error, please help

10. Fetch the Address book from exchange server ...

11. Fetch Question

12. Question about Access:File.fetch(Key) ...

 

 
Powered by phpBB® Forum Software