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
 

 

Switch And Flag.

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

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Thu Apr 09, 2009 8:25 pm    Post subject: Switch And Flag.
Reply with quote

Hi,

I am facing a problem related to SWITCH and FLAG.

Req :
I want to display a SCREEN(CICS) and do usuala work like accepting values,XCTL etc based on the keys I press.

I am using switch in the way:
01 SWITCH.
05 SEND-SCREEN-SW PIC X VALUE '0'.
88 SEND-SCREEN VALUE '1'.

in procedure div Im using:

IF
SEND-SCREEN
PERFORM EVALUATE-KEY-PARA
ELSE
PERFORM SEND-PARA
END-IF.
In SEND para:

MOVE '1' TO SEND-SCREEN-SW
etc
like send map, return.


BUT it doesn't seem to work .
It keeps on satisfying the ELSE condition.
(Is the SWITCH getting reset to its default value i.e 0)
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Thu Apr 09, 2009 8:40 pm    Post subject:
Reply with quote

Where is SWITCH located in your program? If you don't put it into DFHCOMMAREA, it will be part of WORKING-STORAGE. And WORKING-STORAGE is reset every time you do the EXEC CICS RETURN TRANSID after sending the map.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Thu Apr 09, 2009 10:17 pm    Post subject: Reply to: Switch And Flag.
Reply with quote

Thanks for the reply robert.

I have declared switch in the working storage .
Should I define it under the commarea.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Apr 09, 2009 10:50 pm    Post subject:
Reply with quote

It will need to be in the DFHCOMMAREA passed from your program back to itself after the SEND-PARA is executed so the data value will be retained between transactions, which follows normal CICS pseudo-conversational coding practice. If you're doing something different, DFHCOMMAREA may or may not be the place to put the variable declaration.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Thu Apr 09, 2009 11:15 pm    Post subject:
Reply with quote

Thanks robert,
I will employ your suggestions for sure .

I have another query.
I am passing an Account number from program A to B and further to C.
This particular discussion is for the program B only.
This account no is kept in the commarea only, thats why i kept it untouched.
Will the the informatiom be lost if i use these switches or flags in the commarea.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Apr 09, 2009 11:39 pm    Post subject:
Reply with quote

No, the existing data shouldn't be lost but you will need to expand the commarea to be long enough to handle the additional field(s). If programs A and C cannot be changed, then your code will need to check EIBCALEN to be one length (passed from A) or another length (passed from B), and you'll need to pass only the necessary length and data to program C.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Fri Apr 10, 2009 10:27 am    Post subject:
Reply with quote

[quote="Robert Sample"]No, the existing data shouldn't be lost but .

Robert,

I tried declaring the switch in the commarea.
But, the very first bit of account no i.e commarea was set to 1.

I have coded it as under:

Working storage:
01 WS-COMMAREA.
05 SWITCH.
07 SEND-SCREEN-SW PIC X VALUE '0'.
88 SEND-SCREEN VALUE '1'.
05 WS-USER-ID PIC X(10).
While debugging in CICS I checked the COMMAREA it was set to "1DIN " instead of "ADMIN ".

What should I do to retain the accout information.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 10, 2009 11:28 am    Post subject:
Reply with quote

as basic rule of thumb:
If a commarea is used by multiple modules, it should be defined the same in all modules.
Is the commarea the same for all modules in the call-chain?
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Fri Apr 10, 2009 12:15 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
as basic rule of thumb:
If a commarea is used by multiple modules, it should be defined the same in all modules.
Is the commarea the same for all modules in the call-chain?


I missed that pard while coding.
Now I have changed to DFHCOMMAREA lenthh to 11 for all the 3 modules.
And made following modifications to the codes.
For all the modules I have defined the commarea as

01 WS-COMMAREA.
05 WS-USER-ID PIC X(10).
05 SWITCH.
07 SEND-SCREEN-SW PIC X VALUE '0'.
88 SEND-SCREEN VALUE '1'.

Module A:
It will pass following COMMAREA to next module during XCTL:
WS-COMMAREA(ADMIN )
Module B:
When screen is sent for the first time it sets switch to on i.e '1'
It will pass following COMMAREA to next module during XCTL:
WS-COMMAREA(ADMIN 1)
Module C:
for this module the value inherited from the COMMAREA is '1'
So, in order to have the flag switched on for the very first time following changes were required
88 SEND-SCREEN VALUE '1'.
instead of value '0'.


The code seems to be working fine now.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 10, 2009 12:45 pm    Post subject:
Reply with quote

great & thx for letting us know how you are doing.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Apr 10, 2009 4:31 pm    Post subject:
Reply with quote

Glad to hear you got it going. Another basic rule of thumb is that if you have to change a COMMAREA, add to the end of it, not the beginning. Other programs are already using the COMMAREA as defined, but adding to the end shouldn't impact what they are doing. The COMMAREA definition is often in a copy book to ensure every program gets the same structure each time it is compiled.
Back to top
View user's profile Send private message
Vishu

New User


Joined: 23 Mar 2009
Posts: 22
Location: Bangalore

PostPosted: Fri Apr 10, 2009 5:11 pm    Post subject:
Reply with quote

Thanks all icon_biggrin.gif
For your valuable suggessions.
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 do i use the switch indicators fo... raghava manda COBOL Programming 3 Wed Jan 06, 2016 11:42 pm
No new posts Switch between environments Khadhar Basha CLIST & REXX 9 Sat Jan 17, 2015 2:43 pm
No new posts Delete a set of records based on the ... akumaras DFSORT/ICETOOL 1 Fri Jun 21, 2013 2:40 am
No new posts Count number of record in input and f... thunderstorm DFSORT/ICETOOL 14 Fri Feb 24, 2012 5:19 pm
No new posts What does FLAG# represent in CA1 panel prasad029 CA Products 6 Wed Dec 07, 2011 3:58 pm


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