GETMAIN ACROSS LINKAGE IN COBOL 
Author Message
 GETMAIN ACROSS LINKAGE IN COBOL

What happens when i have a field like this

PROGRAM1.

01 field-1   PIC  X(1000000).

i GETMAIN  1000 bytes for the field-1 in this program and pass it
across linkage to program-2

program-2

inside of program-2 i do a FREEMAIN on this field and i do a getmain
again say with 2000 bytes this time.

at
GOBACK in program2 will program-1 get back the 2000 bytes ??

or will it lose addressability to field-1 as program-2 has FREEMAINed

it??

**

Question-2

what happens when this field is used with COBOL  verbs like

INITIALIZE , INSPECT ??

will I get a S0C-4  ??

krishna.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 04 Nov 2002 03:00:00 GMT  
 GETMAIN ACROSS LINKAGE IN COBOL

Quote:

>What happens when i have a field like this

>PROGRAM1.

>01 field-1   PIC  X(1000000).

>i GETMAIN  1000 bytes for the field-1 in this program and pass it
>across linkage to program-2

>program-2

>inside of program-2 i do a FREEMAIN on this field and i do a getmain
>again say with 2000 bytes this time.

>at
>GOBACK in program2 will program-1 get back the 2000 bytes ??

No
Quote:

>or will it lose addressability to field-1 as program-2 has FREEMAINed

>it??

No, it is worse.  Program-1 still has addressability to the previous area, even though it
is freemained.  Actually, it may now be GETMAIN for some other area used by this task, and
program-1 might now destroy some of its own controlblocks etc
Quote:
>**

>Question-2

>what happens when this field is used with COBOL  verbs like

>INITIALIZE , INSPECT ??

>will I get a S0C-4  ??

Most probably, yes.

     With kind Regards            |\      _,,,---,,_
                            ZZZzz /,`.-'`'    -.  ;-;;,
     Volker Bandke               |,4-  ) )-,_. ,\ (  `'-'
      (BSP GmbH)                '---''(_/--'  `-'\_)

         Strike while the iron is hot.



Mon, 04 Nov 2002 03:00:00 GMT  
 GETMAIN ACROSS LINKAGE IN COBOL
Same question, different values, you asked in another thread...but

Quote:

> [Second]  Question-2

> what happens when this field is used with COBOL  verbs like

> INITIALIZE , INSPECT ??

> will I get a S0C-4  ??

In the other thread, someone suggested you pass an item of USAGE POINTER to
GETMAIN. Once you have the pointer, you can SET ADDRESS OF (item in linkage
section to which you do have addressability) TO (valid pointer obtained by
GETMAIN) and use COBOL verbs on that item.

(I think).

But of course, then why bother with GETMAIN, as COBOL will allocate the
space for the COBOL dataname? Well, if you were trying to create a large
table of  items, you could work on them one at a time in COBOL defining only
one element in LINKAGE, SET ADDRESS as above, then SET ADDRESS OF (this
item) UP BY FUNCTION LENGTH(this item) to "walk the table."

(Also a guess).

Probably worth a try?

I don't know squat about how this stuff might work/not work under CICS,
which I have gathered uses some of its own rules for allocations and
addressing, but this might be worth tinkering with.

(Doesn't CICS have its own callable functions for allocations?)

MCM



Mon, 04 Nov 2002 03:00:00 GMT  
 GETMAIN ACROSS LINKAGE IN COBOL
    One of my pet peeves.  Initialize can NOT be used with a
variable length (ODO) array.
Not certain  about inspect.

    You would need to pass the pointer if you expect try this.
Even so, I am
not sure what would happen when you cancel program-2.  Some
cobol's
would automatically free the memory.


Quote:
> What happens when i have a field like this

> PROGRAM1.

> 01 field-1   PIC  X(1000000).

> i GETMAIN  1000 bytes for the field-1 in this program and pass
it
> across linkage to program-2

> program-2

> inside of program-2 i do a FREEMAIN on this field and i do a
getmain
> again say with 2000 bytes this time.

> at
> GOBACK in program2 will program-1 get back the 2000 bytes ??

> or will it lose addressability to field-1 as program-2 has
FREEMAINed

> it??

> **

> Question-2

> what happens when this field is used with COBOL  verbs like

> INITIALIZE , INSPECT ??

> will I get a S0C-4  ??

> krishna.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 04 Nov 2002 03:00:00 GMT  
 GETMAIN ACROSS LINKAGE IN COBOL
FYI,
  The rule on INITIALIZE and ODO's is "fixed" in the next Standard.  You
might want to do a "requirement" (enhancement request) to your vendor of
choice to fix this NOW.  FYI, many vendors do already support this (as an
extension).

--
Bill Klein
    wmklein <at> ix dot netcom dot com

Quote:
>     One of my pet peeves.  Initialize can NOT be used with a
> variable length (ODO) array.
> Not certain  about inspect.

>     You would need to pass the pointer if you expect try this.
> Even so, I am
> not sure what would happen when you cancel program-2.  Some
> cobol's
> would automatically free the memory.



> > What happens when i have a field like this

> > PROGRAM1.

> > 01 field-1   PIC  X(1000000).

> > i GETMAIN  1000 bytes for the field-1 in this program and pass
> it
> > across linkage to program-2

> > program-2

> > inside of program-2 i do a FREEMAIN on this field and i do a
> getmain
> > again say with 2000 bytes this time.

> > at
> > GOBACK in program2 will program-1 get back the 2000 bytes ??

> > or will it lose addressability to field-1 as program-2 has
> FREEMAINed

> > it??

> > **

> > Question-2

> > what happens when this field is used with COBOL  verbs like

> > INITIALIZE , INSPECT ??

> > will I get a S0C-4  ??

> > krishna.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.



Fri, 15 Nov 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. GETMAIN/FREEMAIN routines in MVS Cobol/370

2. GETMAIN limitations in COBOL??

3. fujitsu cobol linkage problem

4. COBOL II, Linkage Editor Options for Multi-Entry Point Module

5. LE run time options / COBOL for MVS compiler options / LINKAGE editor

6. Compilation and/or Linkage option for COBOL/370 ?

7. UNIX parameters passed thru cobol linkage

8. COBOL jobs across Canada ???

9. MF Cobol indexed files across NFS?

10. GETMAIN

11. Getmain Help

12. GETMAIN

 

 
Powered by phpBB® Forum Software