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
 

 

External variables in CICS-cobol program
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Mon Nov 24, 2008 5:03 pm    Post subject: External variables in CICS-cobol program
Reply with quote

HI,

can we use external variables in a series of around 5 CICS-COBOl programs in which the external variables are used only with in one program and DFHCOMMAREA is used to pass on values from one program to other via XCTL?

Thanks & Regards,
Anjum raza
Back to top
View user's profile Send private message

Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Mon Nov 24, 2008 11:11 pm    Post subject:
Reply with quote

anjumraza,

The answer is NO ( I think).

Please explain your question better.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Tue Nov 25, 2008 4:09 am    Post subject:
Reply with quote

I was thinking about keeping the value in a TS, but then you may have to pass the TS name from one program to the other...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7907
Location: Bellevue, IA

PostPosted: Tue Nov 25, 2008 5:11 am    Post subject:
Reply with quote

I haven't found anything saying you can't use EXTERNAL variables in COBOL with CICS, but I haven't found anything saying you can, either. I suspect they are not illegal but may have unexpected side effects. Why not try a program in a test region and report back the results? If the region doesn't crash when you invoke the program with EXTERNAL variables, so much the better!

Quote:

I was thinking about keeping the value in a TS, but then you may have to pass the TS name from one program to the other...
That sounds like a possible COMMAREA variable to me.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Tue Nov 25, 2008 9:18 am    Post subject: Reply to: External variables in CICS-cobol program
Reply with quote

Hi,

The problem is i have to code around 7 to 8 programs in CICS-Cobol and there are functions like scrolling horizontal and vertical both. and i'm new to CICS. so instead of using TSQ's i used arrays(as i have to take care of horizontal scrolling so i thought arrays are better) which i declared as external along with the variables that store values for PF7's and PF8's. Till now i coded all the programs individually and tested them. all the programs worked fine but now i'm facing problem when i'm linking them. i'm calling other programs thru XCTL. For every third program when i'm reentering into it, all the external variables are getting initialized. this is happening for every third program, the behaviour is quite unpredictable.

i hope the problem is clear...

Thanks,
Anjum Raza
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7907
Location: Bellevue, IA

PostPosted: Tue Nov 25, 2008 10:08 am    Post subject:
Reply with quote

What's the commonality? Do the EXTERNAL variables initialize after an XCTL? after a CALL? after a CICS LINK? When you say "third program" does that mean the third unique program invoked, or can you see the behavior if the same program is invoked three times in a row? Can you monitor the transaction via CEDF to start figuring out the problem?

And does
Quote:
but now i'm facing problem when i'm linking them.
mean you're having problems with linking as well as running?

And on a side note, I just have to ask -- what is horizontal and vertical scrolling? I've seen TSQ's used to hold screens of data to allow PF7 and PF8 to go back and forth, but I don't think I've ever heard of horizontal and vertical scrolling in a CICS application.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Tue Nov 25, 2008 10:52 am    Post subject: Reply to: External variables in CICS-cobol program
Reply with quote

Robert,
thanks for your response. I hope below explanation will be clear,

its the third unique program.how many ever times i re enter into same program i didnot find any difficulty in the previous programs. but when i enter into third unique program first the map is displayed well but once if enter a value in the map or press any other key then the external variables are getting initialised.
i cannot use cedf as i'm working in Micro Focus but i can debug it easily thats how i came to know that the external variables are getting initialized. its not happening after an XCTL, its happening when i try to re enter into same program through a Return transid command. I dont have problem in linking its working fine, only while running the third unique program for second time i'm facing problem.

vertical scrolling refers to PF7 and PF8 and horizontal to PF10 and PF11. I preferred this terminology as after these programs are done with coding they will be migrated to windows platform where actually horizontal and vertical scrolling will occur.

Thanks,
Anjum.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 25, 2008 10:52 am    Post subject:
Reply with quote

Hi Robert,

Kinda like the F10/11 to scroll left/right in the editor.

Most often the places i've been do this with multiple programs/panels, but some implemented actual left/right scrolliing in addition to up/down.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7907
Location: Bellevue, IA

PostPosted: Tue Nov 25, 2008 6:00 pm    Post subject:
Reply with quote

Since you're using Micro Focus I cannot provide any assistance -- I don't have the product nor its documentation. You may want to raise an issue with Micro Focus to get an explanation for the behavior you're seeing.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Nov 25, 2008 6:08 pm    Post subject: Reply to: External variables in CICS-cobol program
Reply with quote

I might sound dumb, but EXTERNAL variable addressing, whatever the programming language
are resolved at linkage editor time and only for static objects

so the whole point, from a CICS perspective is pure speculation
maybe nothing can be found in the CICS manuals,
because the issue is completely off topic
as far as CICS program management architecture is concerned
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Nov 25, 2008 8:02 pm    Post subject:
Reply with quote

anjumraza,

as I indicated in an earlier post and as Enrico points out. You can't
do what you are trying to do.

Try a different approach or just ask your CICS technical support
people.

I'm curious, are you a consultant?
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: Tue Nov 25, 2008 8:57 pm    Post subject: Re: External variables in CICS-cobol program
Reply with quote

FWIW, I've used EXTERNAL storage across a given run-unit successfully.

Example: A given LINK-API from program "A" to program "B" could not have its commarea altered. Instead, the new EXTERNAL variable was defined in both programs "A" and "B" and when "B" received control, this EXTERNAL variable was populated. Upon "B" returning back to "A", the EXTERNAL variable contained the data which had been populated in program "B".

The beauty here was that the commarea did not required modification.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Nov 25, 2008 9:07 pm    Post subject:
Reply with quote

Quote:
Instead, the new EXTERNAL variable was defined in both programs "A" and "B"



Bill,
please explain,
how is the EXERNAL variable defined in the programs,
can you show an example?

thanks,

Earl
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Tue Nov 25, 2008 9:23 pm    Post subject: Reply to: External variables in CICS-cobol program
Reply with quote

Hi all,

Thank you all for your suggestions and comments.

though it is MF environment, it completely simulates mainframe. i didnot find any difference in coding except that there is no jcl to compile and run. can do it directly.

today while trying to resolve the issue, i found out something. Please look into it if it is of any help to me.
I declared each of the programs in PCT and PPT entries. so each program is associated with a unique transaction id. To re-enter into the same program i'm using RETURN TRANSID statement where as to jump to other program i'm using XCTL command.
As said earlier, if i'm re entering into third unique program the external variables are initialized. Today to just test the programs i tried XCTL command to return to same program instead of RETURN TRANSID command. here the external variables dint get initialized but if i press 'ENTER' only then the flow goes exactly the same way i want else if any other key like F7 is pressed which returns to same program then it is going in loop.

so My doubt is it any way related with so many transaction id's? if it is so any other method of returning to same program other than transid?
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Nov 25, 2008 9:51 pm    Post subject:
Reply with quote

anjumraza,

I'm assuming your reference to defining external vairables is
a MicroFocus feature.

Have you tried contacting MicroFocus support ?
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: Tue Nov 25, 2008 9:51 pm    Post subject: Re: External variables in CICS-cobol program
Reply with quote

Earl,

EXTERNAL variables were introduced with COBOL2 or COBOL/370 (can't remember exactly - CRS ya know icon_wink.gif ) and must be defined at the 01 level, then all elementary items under this 01 are EXTERNAL until the next 01 is hit.

However, if the 01 level is to be used in multiple programs within a run-unit, they must be identical.

Example -

01 WS-EXTERNAL-AREA EXTERNAL.

Bill
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Nov 25, 2008 11:33 pm    Post subject:
Reply with quote

Bill,

guess I'm behind the times with Cobol. Didn't know external
variable existed.


Thanks,
Earl
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 Nov 26, 2008 12:17 am    Post subject: Re: External variables in CICS-cobol program
Reply with quote

Earl,

Forgot to mention "GLOBAL" variables, which are normally used in nested sub-programs, but are a different animal than "EXTERNAL" variables.

FWIW, I've not used nested sub-programs much, although they can have reduced overhead, similar to an internal PERFORM.

Bill
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Wed Nov 26, 2008 8:25 am    Post subject: Reply to: External variables in CICS-cobol program
Reply with quote

Hi Earl and Bill,

Now even i got confirmed that the probelm i'm facing because of initializing of external variables is not a feature of microfocus.

Can you please tell me any solution to my question posted earlier.

quote:
I declared each of the programs in PCT and PPT entries. so each program is associated with a unique transaction id. To re-enter into the same program i'm using RETURN TRANSID statement where as to jump to other program i'm using XCTL command.
As said earlier, if i'm re entering into third unique program the external variables are initialized. Today to just test the programs i tried XCTL command to return to same program instead of RETURN TRANSID command. here the external variables dint get initialized but if i press 'ENTER' only then the flow goes exactly the same way i want else if any other key like F7 is pressed which returns to same program then it is going in loop.

so My doubt is it any way related with so many transaction id's? if it is so any other method of returning to same program other than transid?

Thanks,
Anjum.
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 Nov 26, 2008 5:08 pm    Post subject: Re: External variables in CICS-cobol program
Reply with quote

Unfortunately, if each program is its own transid (IE: Run Unit), then the values populated in any EXTERNAL variable are lost upon issuing an EXEC CICS RETURN.

A Run Unit would be a series of logically "chained" programs/modules, such as invoking program/transid "A" and subsequent Called/Linked-To programs "B" through "E".

So, if you had five programs and each one of these had the same EXTERNAL variable defined, then whenever this variable is populated/updated, it is reflective in all five programs, providing the Run Unit (the CICS task/transid) isn't terminated.

However, once the Run Unit (the original invoking program/transid) issues an EXEC CICS RETURN (with or without a transid and/or commarea), the values in the EXTERNAL variables in all five programs are lost.

EXTERNAL variables are not like DFHCOMMAREA and perhaps this s where the dilemma is?

Regards,

Bill
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
Goto page 1, 2  Next
Page 1 of 2

 

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 IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 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


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