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

Switch And Flag.


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 09, 2009 8:40 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 09, 2009 10:50 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 09, 2009 11:39 pm
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
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
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
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 10, 2009 4:31 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Db2 SQL - how to switch among differe... DB2 18
No new posts How do i use the switch indicators fo... COBOL Programming 3
No new posts Switch between environments CLIST & REXX 9
No new posts Delete a set of records based on the ... DFSORT/ICETOOL 1
No new posts Count number of record in input and f... DFSORT/ICETOOL 14
Search our Forums:

Back to Top