IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reference of a variable in COBOL-CICS


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Sep 09, 2014 1:16 pm
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
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: 275
Location: Mumbai

PostPosted: Tue Sep 09, 2014 5:09 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 09, 2014 5:17 pm
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: 275
Location: Mumbai

PostPosted: Wed Sep 10, 2014 12:43 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 10, 2014 1:23 pm
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Sep 10, 2014 8:45 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Sep 10, 2014 9:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top