Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reference of a variable in COBOL-CICS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
raviputran

New User


Joined: 05 Jul 2007
Posts: 13
Location: bangalore

PostPosted: Tue Sep 09, 2014 12:37 pm    Post subject: Reference of a variable in COBOL-CICS
Reply with quote

Hi All,

I have a query about referencing a variable in COBOL-CICS environment.

Code:

01 VAR-1 PIC X(1).

01 VAR-5 PIC X(10).

SET ADDRESS OF VAR-1 TO ADDRESS OF DFHCOMMAREA.

CALL SUBPGM1 USING VAR-1 VAR-5

Which value of VAR-1 will be taken either its default value or the value contained in DFHCOMMAREA?

Thanks
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Sep 09, 2014 1:16 pm    Post subject: Reply to: Reference of a variable in COBOL-CICS
Reply with quote

VAR-1 can only have one value at any given time. It has no "default" value.

Assuming that the absurdly-named VAR-1 is in the LINKAGE SECTION and that the code actually compiles, VAR-1 has the address of DFHCOMMAREA.

What is your actual question behind this?
Back to top
View user's profile Send private message
raviputran

New User


Joined: 05 Jul 2007
Posts: 13
Location: bangalore

PostPosted: Tue Sep 09, 2014 1:47 pm    Post subject:
Reply with quote

Hi Bill,

Thanks for the reply. You are right. VAR-1 is in linkage section. Forgot to mention that.


If VAR-1 already has a value from the calling program and in the called program it is made to point the address of DFHCOMMAREA.

If we call a subprogram SUBPRG1 using VAR-1 what value will be passed to SUBPRG1?

Thanks
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Tue Sep 09, 2014 5:09 pm    Post subject:
Reply with quote

Hi,

What happened when you did a test and put a display for VAR-1?

Regards,
Chandan
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Sep 09, 2014 5:17 pm    Post subject: Reply to: Reference of a variable in COBOL-CICS
Reply with quote

Quote:
What happened when you did a test and put a display for VAR-1?


what a silly question icon_wink.gif

why test when it is faster to ask on a forum ?
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Wed Sep 10, 2014 12:43 pm    Post subject:
Reply with quote

Hi Enrico,

I undestand what you meant to say by silly question icon_wink.gif

I hope raviputran also get it understood icon_biggrin.gif

Regards,
Chandan
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Sep 10, 2014 1:23 pm    Post subject: Reply to: Reference of a variable in COBOL-CICS
Reply with quote

raviputran,

DFHCOMMAREA PIC (something) defined somewhere

Program CICSA

stupid-dumb-name PIC (something else, though could be the same) defined somewhere else

CALL "CICSB" USING USING stupid-dumb-name

Program CICSB USING a-dumb-name-in-LINKAGE-SECTION.

So, a-dumb-name-in-LINKAGE-SECTION has the address of stupid-dumb-name passed to it by CICSA.


SET ADDRESS OF a-dumb-name-in-LINKAGE-SECTION
TO ADDRESS OF DFHCOMMAREA

Now it doesn't.

Does that answer your question?
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Sep 10, 2014 7:55 pm    Post subject:
Reply with quote

If these are CICS programs then why are you doing CALLS ??? instead of XCTL or START, it this is a subroutine then a LINK.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Sep 10, 2014 8:45 pm    Post subject:
Reply with quote

Mickeydusaor,
May be because of below probable valid reasons.

1. CALL gives a better performance over LINK. The reason being CALL executes in the same run unit of the main program, wehre as LINK runs in a separate run unit.
2. CALL can be used to transfer more than 32K between the calling and called programs.
3. CALL can transfer multiple data elements, where as LINK can transfer only one. (DFHCOMMAREA)
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Sep 10, 2014 9:27 pm    Post subject: Reply to: Reference of a variable in COBOL-CICS
Reply with quote

If the OP is dead-set on using LINK and/or XCTL API's and has a large amount of data, take at look at CHANNELS and CONTAINERS (introduced with CICS/TS 3.1), which allows usage of greater than 32763 of commarea-storage. You can also use CHANNELS and CONTAINERS for remote access with LINK API's. CALLED sub-programs can only be accessed locally within their own region.

HTH....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us