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
 

 

Retaining Value of a Variable in Pseudo Conversational Progr

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

New User


Joined: 23 Mar 2010
Posts: 22
Location: Bangalore

PostPosted: Wed Sep 07, 2011 5:27 pm    Post subject: Retaining Value of a Variable in Pseudo Conversational Progr
Reply with quote

Hi All,

I am writing a COBOL,DB2,CICS program to implement pageup & page down logic. I have written pseudo conversational program. Before sending the map first time, I have loaded TSQ with all records from cursor and few records to the output variables of symbolic map. I am maintaining a counter vairable which is calculated while fetching data from cursor. This value is getting initialized to zero after send return of map.

Please advice me how to retain value of this variable.

I tried to retain this value, by declaring this varable in DFHCOMMAREA, but I am getting ASRA(SOC4) abend.

Also I tried to retain this value by declaring this variable in working storage commarea section which is used in COMMAREA of Return command. Still this value is getting initialized to zero.

Please advice me on this...

Thanks
Srikanth
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Sep 07, 2011 5:33 pm    Post subject:
Reply with quote

you have not properly coded the CICS API's.

here is a link for the CICS Application Programmers Guide,
and here is the Application Programmers Reference
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Sep 07, 2011 5:44 pm    Post subject:
Reply with quote

Quote:
Please advice me on this...
Since you posted no code, what do you expect us to be able to do?

The way to retain values in a pseudoconversational CICS program is to place them in an area of WORKING-STORAGE (if using COBOL) and use that WORKING-STORAGE area as your COMMAREA( ...) in the RETURN TRANSID command. If this is not working for you, you have coded something wrong or are otherwise not conforming to the CICS API. We have no way to tell what you are doing wrong based upon what you have provided.
Back to top
View user's profile Send private message
sreekanth1984

New User


Joined: 23 Mar 2010
Posts: 22
Location: Bangalore

PostPosted: Wed Sep 07, 2011 6:22 pm    Post subject:
Reply with quote

Hi,

Below is the code to acheive the Page up, Page Down logic. I am trying to retain the value of the WS-CNT. But this value is getting initialized to zeros one send return is executed.

Code:
       IDENTIFICATION DIVISION.
       PROGRAM-ID. P1338407.
       ENVIRONMENT DIVISION.
      *--------------------------------------------------------*
      *    DATA DIVISION                                       *
      *--------------------------------------------------------*
       DATA DIVISION.
       WORKING-STORAGE SECTION.

               EXEC SQL
                      INCLUDE SQLCA
               END-EXEC.

               EXEC SQL
                      INCLUDE GWCUST
               END-EXEC.

           EXEC SQL
                  DECLARE CURS1 CURSOR  FOR
                           SELECT
                                 ACCOUNT_NO
                                ,CUST_NAME
                                ,SSN
                                ,ADDRESS_LINE1
                                ,CONTACT_NO
                            FROM D338407.GW_CUSTMAST
                            ORDER BY ACCOUNT_NO
           END-EXEC.

      *---------------------------------------------------------*
      *   WORKING STORAGE AREA                                  *
      *---------------------------------------------------------*
        01 WS-AREA.
           05 TSQ-AREA.
            10 TSQ-ACCT-NO                    PIC X(10).
            10 TSQ-CUNAME                     PIC X(15).
            10 TSQ-SSN                        PIC X(10).
            10 TSQ-PHONE-NO                   PIC X(10).
            10 TSQ-ADDRS                      PIC X(15).
           05 WS-ITM                          PIC S9(4) COMP.
           05 I                               PIC 9(3).
           05 J                               PIC 9(3).
           05 WS-EOF-CURSOR                   PIC X(1).
              88 EOF-CURSOR                   VALUE 'Y'.
              88 NEOF-CURSOR                  VALUE 'N'.
           05 WS-ABS-TIME                     PIC S9(15) COMP-3.
           05 WS-DATE                         PIC X(10) VALUE SPACES.
           05 WS-TIME                         PIC X(8) VALUE SPACES.
           05 CTR                             PIC 9(3) VALUE ZEROES.
        01 WS-EROR-MSGS.
           05 WS-ERR-CURSOR                 PIC X(60)
              VALUE 'ERROR IN OPENING THE CURSOR'.
           05 WS-INVLD-KEY                  PIC X(60)
              VALUE 'INVALID KEY PRESSED, ENTER A VALID KEY'.
           05 WS-F7-ERR                     PIC X(60)
              VALUE 'TOP OF THE PAGE REACHED'.
           05 WS-F8-ERR                     PIC X(60)
              VALUE 'BOTTOM OF THE PAGE REACHED'.
      *---------------------------------------------------------*
      *   WORKING STORAGE COMMAREA                              *
      *---------------------------------------------------------*
        01 WS-COMAREA.
           05 WS-SRTFIELD                   PIC X(15).
           05 WS-SRTTYP                     PIC X(1).
           05 WS-CNT                        PIC 9(3).
           05 FILLER                        PIC X(287).
        01 WS-DISP-REC.
            COPY GWDISPL.

        COPY DFHAID.
      *--------------------------------------------------------*
      *    PROCEDURE DIVISION                                  *
      *--------------------------------------------------------*
       PROCEDURE DIVISION.

           PERFORM AAA-INITIAL-VARIABLES.
           PERFORM BBB-PROCESS-MAIN-PARA.

      *--------------------------------------------------------*
      *    AAA-INITIAL-VARIABLES                               *
      *--------------------------------------------------------*
       AAA-INITIAL-VARIABLES SECTION.

             INITIALIZE WS-EOF-CURSOR

             CONTINUE.
       AAA-INITIAL-VARIABLES-EX.
              EXIT.
      *--------------------------------------------------------*
      *    BBB-PROCESS-MAIN-PARA                               *
      *--------------------------------------------------------*
       BBB-PROCESS-MAIN-PARA SECTION.

              IF EIBCALEN = 0
                 PERFORM A100-INITIALIZE-SCREEN
                 PERFORM B100-SND-RTN-PARA
              ELSE
                 PERFORM B200-RCV-PARA
              END-IF
              PERFORM B300-PROCESS-PARA

           CONTINUE.
       BBB-PROCESS-MAIN-PARA-EX.
           EXIT.
      *--------------------------------------------------------*
      *    A100-INITIALIZE-SCREEN                              *
      *--------------------------------------------------------*
       A100-INITIALIZE-SCREEN SECTION.

              PERFORM A150-DELETE-TSQ
              MOVE LOW-VALUES                TO GWDISPLO
              INITIALIZE      I
                              J

              EXEC SQL
                     OPEN CURS1
              END-EXEC

              EXEC CICS
                     ASKTIME
                     ABSTIME(WS-ABS-TIME)
              END-EXEC

              EXEC CICS
                     FORMATTIME
                     ABSTIME(WS-ABS-TIME)
                     YYYYMMDD(WS-DATE)
                     DATESEP('-')
                     TIME(WS-TIME)
                     TIMESEP(':')
              END-EXEC

             PERFORM A200-LOAD-CURSOR
               UNTIL EOF-CURSOR

             CONTINUE.
       A100-INITIALIZE-SCREEN-EX.
              EXIT.
      *--------------------------------------------------------*
      *    A150-DELETE-TSQ                                     *
      *--------------------------------------------------------*
       A150-DELETE-TSQ SECTION.

              EXEC CICS
                   DELETEQ TS
                   QUEUE('ACTTSQ')
                   NOHANDLE
              END-EXEC

              CONTINUE.
       A150-DELETE-TSQ-EX.
              EXIT.
      *--------------------------------------------------------*
      *    A100-LOAD-ITABLE                                    *
      *--------------------------------------------------------*
       A200-LOAD-CURSOR SECTION.

                EXEC SQL
                     FETCH CURS1 INTO
                      :GW-ACCOUNT-NO
                     ,:GW-CUST-NAME
                     ,:GW-SSN
                     ,:GW-ADDRESS-LINE1
                     ,:GW-CONTACT-NO
                END-EXEC

                EVALUATE SQLCODE
                    WHEN 0
                         SET NEOF-CURSOR             TO TRUE
                         PERFORM A300-LOAD-TSQ
                    WHEN 100
                         SET EOF-CURSOR              TO TRUE
                    WHEN OTHER
                         MOVE WS-ERR-CURSOR          TO GD-ERRMSGO
                         PERFORM B500-EXIT-PARA
                END-EVALUATE

              CONTINUE.
       A200-LOAD-CURSOR-EX.
              EXIT.
      *--------------------------------------------------------*
      *    A300-LOAD-TSQ                                       *
      *--------------------------------------------------------*
       A300-LOAD-TSQ SECTION.

              ADD     1                        TO J
              ADD     1                        TO WS-ITM
              MOVE    GW-ACCOUNT-NO            TO TSQ-ACCT-NO
              MOVE    GW-CUST-NAME-TEXT        TO TSQ-CUNAME
              MOVE    GW-SSN-TEXT              TO TSQ-SSN
              MOVE    GW-ADDRESS-LINE1-TEXT    TO TSQ-PHONE-NO
              MOVE    GW-CONTACT-NO            TO TSQ-ADDRS

              EXEC CICS
                       WRITEQ TS
                       QUEUE('ACTTSQ')
                       FROM(TSQ-AREA)
                       LENGTH(50)
                       ITEM(WS-ITM)
              END-EXEC

              IF       I <= 14
              ADD     1                        TO I
              PERFORM A400-LOAD-SCREEN
              END-IF
              MOVE     WS-ITM                     TO WS-CNT

              CONTINUE.
       A300-LOAD-TSQ-EX.
              EXIT.
      *--------------------------------------------------------*
      *    A400-LOAD-SCREEN                                    *
      *--------------------------------------------------------*
       A400-LOAD-SCREEN SECTION.

              MOVE    TSQ-ACCT-NO             TO GD-ACOUNTNOI(J)
              MOVE    TSQ-CUNAME              TO GD-CUNAMEI(J)
              MOVE    TSQ-SSN                 TO GD-SSNOI(J)
              MOVE    TSQ-PHONE-NO            TO GD-PHONENOI(J)
              MOVE    TSQ-ADDRS               TO GD-ADDRESSI(J)

              CONTINUE.
       A400-LOAD-SCREEN-EX.
              EXIT.
      *--------------------------------------------------------*
      *    B100-SND-RTN-PARA                                   *
      *--------------------------------------------------------*
       B100-SND-RTN-PARA SECTION.

              MOVE  -1                        TO GD-SFIELDL
              EXEC CICS SEND
                        MAP('GWDISPL')
                        MAPSET('M338407')
                        FROM(GWDISPLO)
                        CURSOR
                        FREEKB
                        ERASE
              END-EXEC

              EXEC CICS
                       RETURN
                       TRANSID('T407')
                       COMMAREA(WS-COMAREA)
                       LENGTH(LENGTH OF WS-COMAREA)
              END-EXEC

           CONTINUE.
       B100-SND-RTN-PARA-EX.
           EXIT.

      *--------------------------------------------------------*
      *    B200-RCV-PARA                                       *
      *--------------------------------------------------------*
       B200-RCV-PARA SECTION.

              EXEC CICS
                       RECEIVE
                       MAP('GWDISPL')
                       MAPSET('M338407')
                       INTO(GWDISPLI)
              END-EXEC

           CONTINUE.
       B200-RCV-PARA-EX.
           EXIT.
      *--------------------------------------------------------*
      *    B300-PROCESS-PARA                                   *
      *--------------------------------------------------------*
       B300-PROCESS-PARA SECTION.

           EVALUATE EIBAID
               WHEN DFHENTER
                    MOVE LOW-VALUES                TO GWDISPLO
                    PERFORM B400-VALIDATE-SCREEN
               WHEN DFHPF3
                    PERFORM B500-EXIT-PARA
               WHEN DFHPF7
                    PERFORM B600-PREV-SCREN-PARA
               WHEN DFHPF8
                    PERFORM B700-NEXT-SCREN-PARA
               WHEN OTHER
                    MOVE    WS-INVLD-KEY           TO GD-ERRMSGO
           END-EVALUATE

           PERFORM B100-SND-RTN-PARA

           CONTINUE.
       B300-PROCESS-PARA-EX.
           EXIT.
      *--------------------------------------------------------*
      *    B400-VALIDATE-SCREEN                                *
      *--------------------------------------------------------*
       B400-VALIDATE-SCREEN SECTION.

           INITIALIZE       J
                            WS-ITM
           IF I >= 14
              COMPUTE I = I - 14
           END-IF
           PERFORM UNTIL CTR > 14
                   ADD     1                    TO CTR
                   ADD     1                    TO J
                   PERFORM A350-READ-TSQ
                   PERFORM A400-LOAD-SCREEN
           END-PERFORM

           CONTINUE.
       B400-VALIDATE-SCREEN-EX.
           EXIT.
      *--------------------------------------------------------*
      *    B500-EXIT-PARA                                      *
      *--------------------------------------------------------*
       B500-EXIT-PARA SECTION.

              EXEC SQL
                     CLOSE CURS1
              END-EXEC

              EXEC CICS SEND
                       CONTROL
                       ERASE
                       FREEKB
              END-EXEC

              EXEC CICS RETURN
              END-EXEC

           CONTINUE.
       B500-EXIT-PARA-EX.
           EXIT.
      *--------------------------------------------------------*
      *    A350-READ-TSQ                                       *
      *--------------------------------------------------------*
       A350-READ-TSQ SECTION.

              EXEC CICS
                       READQ TS
                       QUEUE('ACTTSQ')
                       INTO(TSQ-AREA)
                       ITEM(WS-ITM)
              END-EXEC.

              CONTINUE.
       A350-READ-TSQ-EX.
              EXIT.
      *--------------------------------------------------------*
      *    B600-PREV-SCREN-PARA                                *
      *--------------------------------------------------------*
       B600-PREV-SCREN-PARA SECTION.

           INITIALIZE          J
                               WS-ITM
           IF I >= 14
              COMPUTE I = I - 28
              MOVE    I                            TO WS-ITM
              PERFORM UNTIL CTR > 14
                      ADD     1                    TO CTR
                      ADD     1                    TO J
                      ADD     1                    TO WS-ITM
                      PERFORM A350-READ-TSQ
                      PERFORM A400-LOAD-SCREEN
              END-PERFORM
           ELSE
              MOVE WS-F7-ERR                       TO GD-ERRMSGO
           END-IF

           CONTINUE.
       B600-PREV-SCREN-PARA-EX.
           EXIT.
      *--------------------------------------------------------*
      *    B700-NEXT-SCREN-PARA                                *
      *--------------------------------------------------------*
       B700-NEXT-SCREN-PARA SECTION.

           MOVE    0                               TO CTR
           MOVE    I                               TO WS-ITM
           IF I < WS-CNT
              PERFORM UNTIL CTR > 14
                      ADD     1                    TO CTR
                      ADD     1                    TO J
                      ADD     1                    TO WS-ITM
                      PERFORM A350-READ-TSQ
                      PERFORM A400-LOAD-SCREEN
              END-PERFORM
           ELSE
              MOVE WS-F8-ERR                       TO GD-ERRMSGO
           END-IF

           CONTINUE.
       B700-NEXT-SCREN-PARA-EX.
           EXIT.



Thanks
Srikanth
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Sep 07, 2011 6:37 pm    Post subject:
Reply with quote

From "no code" to "all the code" in one easy click.

/pethate on

It might be the local standard, but perhaps you can ask "what is the point of the comment block which says "DATA DIVISON"", and all the others for that matter.

I didn't think it would take long to find one...

Code:
      *--------------------------------------------------------*
      *    A100-LOAD-ITABLE                                    *
      *--------------------------------------------------------*
       A200-LOAD-CURSOR SECTION.


Doubly pointless.

Also, what about some meaningful datanames? What is I used for? If you gave it a proper name I (sic) wouldn't have to ask.

And literals? Does 14 have any meaning? It is a limit of something. Say someone has the task to "change the limit of <whatever> to 20" a few months down the track. You've not made their job any easier, have you? And it might be you doing it.

Why are things like I and CTR display numeric? You like the compiler generating a heap of stuff each time you use them?

/pethate off

What are all those CONTINUE's about (just out of interest)?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Sep 07, 2011 6:43 pm    Post subject:
Reply with quote

Your COMMAREA consists of 4 fields: WS-SRTFIELD -- which is not referenced in your posted code, WS-SRTTYPE -- which is not referenced in your posted code, WS-CNT -- which is set to the value of WS-ITM in your posted code, and a filler of 287 bytes which is never initialized in your code.

If you are thinking the variables in the copybook GWDISPL are part of the COMMAREA, they are not. There is a different 01 level for them.

So based upon what you've posted, the ONLY COMMAREA variable you can use is WS-CNT becsue none of the other data in COMMAREA is ever initialized by your posted code. Have you checked WS-CNT to make sure it has a value when you return to the program?
Back to top
View user's profile Send private message
sreekanth1984

New User


Joined: 23 Mar 2010
Posts: 22
Location: Bangalore

PostPosted: Wed Sep 07, 2011 6:45 pm    Post subject:
Reply with quote

Still I did not find solution for this, from the previous post
Back to top
View user's profile Send private message
sreekanth1984

New User


Joined: 23 Mar 2010
Posts: 22
Location: Bangalore

PostPosted: Wed Sep 07, 2011 6:47 pm    Post subject:
Reply with quote

Quote:
Still I did not find solution for this, from the previous post


Please ignore the above post...which not for Robert Sample..
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Wed Sep 07, 2011 7:06 pm    Post subject:
Reply with quote

Bill Woodger wrote:

What are all those CONTINUE's about (just out of interest)?
I can't speak for the TS, but I sometimes throw in some extra CONTINUEs to provide convenient places to set breakpoints. IBM's Debug tool doesn't allow you to set breakpoints at END-IF statements, so sometimes I throw in a CONTINUE immediately after the END-IF and set the breakpoint there. This is especially useful (to me) when the END-IF is at the end of a paragraph. I (usually) delete the extraneous CONTINUEs when I am done.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Wed Sep 07, 2011 8:18 pm    Post subject:
Reply with quote

Your counter is in the W-S.
When you do RETURN TRANSID COMMAREA, that piece of storage is saved somewhere by CICS.

When the program is restarted, the same piece of storage is returned to you in the DFHCOMMAREA in the LINKAGE SECTION.
In the W-S you have nothing!

Add in B200-RCV-PARA:
Code:
MOVE DFHCOMMAREA TO WS-COMAREA
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Sep 07, 2011 8:53 pm    Post subject:
Reply with quote

don.leahy wrote:
Bill Woodger wrote:

What are all those CONTINUE's about (just out of interest)?
I can't speak for the TS, but I sometimes throw in some extra CONTINUEs to provide convenient places to set breakpoints. IBM's Debug tool doesn't allow you to set breakpoints at END-IF statements, so sometimes I throw in a CONTINUE immediately after the END-IF and set the breakpoint there. This is especially useful (to me) when the END-IF is at the end of a paragraph. I (usually) delete the extraneous CONTINUEs when I am done.


Thanks Don.

I find it funny, but that is me. I guess CONTINUE appears in the XREF, END-IF not. Just for fun, you can even use EXIT (I'm sure it used to be "must be in a paragraph on its own"). A casually-encountered EXIT is treated as a CONINUE. IE, neither generate any specific code, they don't "do" anything, but can be targets for generated branches, or generate branches themselves, and the EXIT in its proper place can get loads of stuff generated, fo course.
Back to top
View user's profile Send private message
sreekanth1984

New User


Joined: 23 Mar 2010
Posts: 22
Location: Bangalore

PostPosted: Thu Sep 08, 2011 10:58 am    Post subject:
Reply with quote

Hi All,

Thank you all for the valuable inputs provided. Now I am able to retain the value of WS variable in my program after executing RETURN TRANSID COMMAREA also.

Marso,

I have changed the code as you sugeested and my program is working fine.

I have added the below code to the code pasted above.

Code:
LINKAGE SECTION.                               
 01 DFHCOMMAREA.                               
    05 LK-SRTFIELD                   PIC X(15).
    05 LK-SRTTYP                     PIC X(1). 
    05 LK-CNT                        PIC 9(3). 
    05 FILLER                        PIC X(287).


Below code in B200-RCV-PARA after Receive Map statement.

Code:
 MOVE DFHCOMMAREA TO WS-COMAREA     


The above mentioned COMMAREA declaration is similar to WS-COMMAREA.

Thanks
Srikanth[/code]
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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am
No new posts File Manager with Variable Length File ahabib IBM Tools 10 Thu Mar 31, 2016 11:00 pm


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