View previous topic :: View next topic
|
Author |
Message |
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
Thanks for the reply robert.
I have declared switch in the working storage .
Should I define it under the commarea. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
[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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
great & thx for letting us know how you are doing. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Vishu
New User
Joined: 23 Mar 2009 Posts: 22 Location: Bangalore
|
|
|
|
Thanks all
For your valuable suggessions. |
|
Back to top |
|
|
|