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

Throw 2 different maps in same program


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Tue Mar 22, 2011 10:20 am
Reply with quote

Hi All,

I have PRG A which is associated with the transaction TRN1. PRG A is designed in such a way that it should display 2 different maps. PRG A is XCTLed by PRG 1. PRG A receives the data via commarea from PRG1 and displays the first map. It is running in the Pseudo-conversational mode. It returns the control with trans id TRN1 so that PRG A will be invoked upon the user input.

After validating the user input, PRG A needs to display the second Map. I want the same PRG A to be invoked when user selects any thing in the second map as well. Can i return the control with trans id TRN1 for this map as well?

My doubt is already TRN1 has already invoked PRG A and PRG A is running. Can i give the same instruction(return with trans id TRN1 while throwing the second map) again?

Thanks,
Suma
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Mar 22, 2011 11:16 am
Reply with quote

How far did you manage to throw the map? One sends maps.

Ideally you should have one program per unit of work - 2 maps suggest 2 units of work. However, you can return to your tansaction as many times as you want - you just need to remind yourself as to which map was last sent - maybe a map id within the map data or a counter within the COMMAREA?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Mar 22, 2011 1:30 pm
Reply with quote

Quote:
have PRG A which is associated with the transaction TRN1. PRG A is designed in such a way that it should display 2 different maps. PRG A is XCTLed by PRG 1. PRG A receives the data via commarea from PRG1 and displays the first map. It is running in the Pseudo-conversational mode. It returns the control with trans id TRN1 so that PRG A will be invoked upon the user input.


This doesn't seem to make sense. Either TRN1 executes PRGA or PRG1 XCTLS to PRGA. If TRN1 executes PRGA, then how can it receive anything from PRG1?

Garry.
Back to top
View user's profile Send private message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Thu Mar 24, 2011 9:11 am
Reply with quote

The program flows like this...

1. PRG1 XCTLs PRGA -
(in which PRGA receives data from the PRG1. Say PRG1 is associated with transaction TRN2.)

2.PRGA receives the data and displays the data in the MAP(first map). PRG A executes the Return statement with the Transaction TRN1.

3. TRN1 is defined to invoke PRG A.

4. When the user enters any value in the first map, it will enter into PRG A.

5. After validating the user input, PRGA will display another new MAP(second map).

My doubt is whether return statement can have same transaction TRN1 when displaying the second map so that PRGA will again be invoked for processing the user input in the second map as well.

let me know if any thing is not clear.

Thanks.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Mar 24, 2011 12:43 pm
Reply with quote

You can keep invoking TRN1 from PRGA. Possibly the most common pseudo-conversations are a transaction (TRN1) which invokes a program (PRGA) passing a COMMAREA in which some setting is used control the flow in PRGA. In this case, for example, TRN1 might check COMMAREA field for W-MAP-NUM and decide which map to display from this.

A common practice is to use EIBCALEN=0 as a test for 'first-time-in'.

Garry.
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 Mar 24, 2011 2:58 pm
Reply with quote

Quote:
My doubt is whether return statement can have same transaction TRN1 when displaying the second map so that PRGA will again be invoked for processing the user input in the second map as well.
If you paid money for a CICS course, you were robbed. Very common logic used in CICS programs is
Code:
PROCEDURE DIVISION USING ...
    IF  EIBCALEN = 0
         set COMMAREA-FLAG to 1
         send map 1
         EXEC CICS RETURN TRANSID('xxxx') COMMAREA(COMMAREA)
    END-IF
    IF  COMMAREA-FLAG = 1
        set COMMAREA-FLAG to 2
        receive map 1
        process map 1
        send map 2
        EXEC CICS RETURN TRANSID('xxxx') COMMAREA(COMMAREA)
    END-IF
    IF  COMMAREA-FLAG = 2
        receive map 2
    ...
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 Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top