View previous topic :: View next topic
|
Author |
Message |
akshathan
New User
Joined: 18 Aug 2006 Posts: 45
|
|
|
|
Hi All,
I am writing a simple cics program which performs the addition,Multiplication and Subtraction of two numbers. We need this program for training purpose. When i give my Transaction ID i displays the Screen where in we key the numbers for arithmetic operation. After which we have to press PF1,PF2 or PF3.
The issue here is which ever key i am pressing it is not geting recognised in my code. I came to know this when i placed displays in the program. The Comparison beween EIBAID and DFHPF1,DFHPF2 or DFHPF3 is not working out even though the values are matching when seen through the displays. It will be of great help if any of you can help me out to recognise the issue.
I have provided the Map,Program and SYSOUT of DISPLAY for reference.
My Map looks like below
Code: |
ENTER THE FIRST NO 100
ENTER THE SECOND NO 100
RESULT OF TWO NUMBER 10000
PRESS PF1-ADD,PF2-SUB,PF3-MUL |
My Program Looks like below
Code: |
PROCEDURE DIVISION.
IF EIBAID = DFHENTER
DISPLAY 'IN ENTER'
MOVE LOW-VALUES TO CALC1O
MOVE LOW-VALUES TO CALC1I
MOVE 'PLEASE ENTER THE VALUES' TO MSGOO
EXEC CICS SEND MAP('CALC1') MAPSET('AKSH321') END-EXEC
ELSE
IF EIBAID = DFHPF2
DISPLAY 'IN ADD'
PERFORM RECEIVE-MAP-DATA THRU END-RECV
PERFORM ADD-PARA THRU 100-EXIT
ELSE
IF EIBAID = DFHPF2
DISPLAY 'IN SUB'
PERFORM RECEIVE-MAP-DATA THRU END-RECV
PERFORM SUB-PARA THRU 200-EXIT
ELSE
IF EIBAID = DFHPF3
DISPLAY 'IN MUL'
PERFORM RECEIVE-MAP-DATA THRU END-RECV
PERFORM MUL-PARA THRU 300-EXIT
END-IF
END-IF
END-IF
END-IF.
PERFORM RETURN-PARA.
RECEIVE-MAP-DATA.
EXEC CICS RECEIVE MAP('CALC1') MAPSET('AKSH321') END-EXEC
DISPLAY 'IN RECV'
DISPLAY 'AID:' EIBAID
MOVE NUM1I TO NUM1.
MOVE NUM2I TO NUM2.
MOVE ZERO TO SUM1.
DISPLAY 'NUM1:' NUM1.
DISPLAY 'NUM2:' NUM2.
DISPLAY 'SUM1:' SUM1.
END-RECV.
EXIT.
ADD-PARA.
DISPLAY 'IN ADD'
COMPUTE SUM1 = NUM1 + NUM2.
DISPLAY 'SUM1' SUM1
MOVE SUM1 TO SUM1O.
100-EXIT.
EXIT.
SUB-PARA.
DISPLAY 'IN SUB'
COMPUTE SUM1 = NUM1 - NUM2.
DISPLAY 'SUM1' SUM1
MOVE SUM1 TO SUM1O.
200-EXIT.
EXIT.
MUL-PARA.
DISPLAY 'IN MUL'
COMPUTE SUM1 = NUM1 * NUM2.
DISPLAY 'SUM1' SUM1
MOVE SUM1 TO SUM1O.
300-EXIT.
EXIT.
RETURN-PARA.
EXEC CICS SEND MAP('CALC1') MAPSET('AKSH321') END-EXEC
EXEC CICS RETURN END-EXEC. |
Code'd
The Displays are looking like below
NAND 20110521062323 IN ENTER
NAND 20110521062327 IN RECV
NAND 20110521062327 AID:1
NAND 20110521062327 NUM1:100
NAND 20110521062327 NUM2:100
NAND 20110521062327 SUM1:00000
NAND 20110521062327 IN ADD
NAND 20110521062327 SUM100200
NAND 20110521062327 IN SUB
NAND 20110521062327 SUM100000
NAND 20110521062327 IN MUL
NAND 20110521062327 SUM110000
Thanks,
Akshatha |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
EXEC CICS RETURN END-EXEC. |
You are telling CICS to end your program at this point -- is this really what you want to do? Normally the screen would be cleared so a blank terminal would be presented so the terminal user can key in the next transaction name. Since you're not returning to your program, your SEND MAP is useless -- why are you doing it? |
|
Back to top |
|
|
akshathan
New User
Joined: 18 Aug 2006 Posts: 45
|
|
|
|
Robert thanks for the reply. I assume that once we are done with functionality of our transction we need to return to cics hence i coded the RETURN statment.(Similar to STOP RUN in COBOL). Is this causing the issue. Correct me if i am wrong.
Thanks,
Akshatha |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why don't you try receiving the map before you check the dfhaid properites? |
|
Back to top |
|
|
akshathan
New User
Joined: 18 Aug 2006 Posts: 45
|
|
|
|
Hi Dick,
I tried receiving the map before the DFHPF1,PF2 and PF3 Checks. I am still facing the same issue.
Thanks,
Akshatha |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I really do not see where you have a problem. The display statements indicate the code is working just fine -- SUM1 is 200 after the add, 000 after the subtract, 10000 after the multiply. If your code was not recognizing the correct EIBAID, you wouldn't be seeing those values.
So why do you think you have a problem with the code -- explain precisely and exactly what leads you to that conclusion?
Most CICS programs have two RETURN statements -- one EXEC CICS RETURN END-EXEC when you are completely through with your transaction, and one EXEC CICS RETURN TRANSID('XXXX') COMMAREA .... END-EXEC for your pseudo-conversational processing. |
|
Back to top |
|
|
akshathan
New User
Joined: 18 Aug 2006 Posts: 45
|
|
|
|
Robert,
Sorry for the confusion. The functionality of the program is to either do a Addition,Subtraction or Multiplication. If you see the Display staments its doing all the 3 of them and at the end its displaying the result of Multiplication on the screen(refer5 Map) even though i am pressing PF1 which indicates that only addition has to be performed.
During Testing i commented out the PERFORM RETURN-PARA to check on how the code will work and thats when i came to know that its not entering in to any of the IF conditions(DFHAID Checks) and its Serially Processing RECEIVE-MAP-DATA followed by ADD-PARA,SUB-PARA ,MUL-PARA and RETURN-PARA. If you see the display you can conclude this.
If i am Uncommenting the PERFORM RETURN-PARA then my Transaction is in error immediately after i key in the numbers for arithmetic operations and hit any of the PF1-PF3 keys. Its taking the key'd number and saying that the number is invalid transaction. I am not sure why this is happening.Hence i commented the RETUN-PARA and provided the results in my first post.
Thanks,
Akshatha |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Its taking the key'd number and saying that the number is invalid transaction. |
It is saying this because your program is totally wrong for a CICS program. As my earlier post said, if you do not issue EXEC CICS RETURN TRANSID('xxxx') ... then the system assumes your transaction is done. According, the first four characters keyed next will become the transaction identifier. You key in numbers -- so the system tells you that is not a valid transaction. The system is doing exactly what you told it to do.
Your code should be something like a "normal" CICS program:
Code: |
PROCEDURE DIVISION.
IF EIBCALEN = 0
MOVE LOW-VALUES TO CALC1O
EXEC CICS SEND MAP('CALC1') MAPSET('AKSH321') END-EXEC
EXEC CICS RETURN TRANSID('xxxx') COMMAREA ('1') END-EXEC
END-IF.
EXEC CICS RECEIVE MAP('CALC1') MAPSET('AKSH321') END-EXEC
EVALUATE TRUE
WHEN EIBAID = DFHCLEAR
<you might want to clear the screen>
EXEC CICS RETURN END-EXEC
WHEN EIBAID = DFHENTER
MOVE 'ENTER TWO VALUES' TO MSGOO
WHEN EIBAID = DFHPF1
COMPUTE SUM1 = NUM1 + NUM2
WHEN EIBAID = DFHPF2
COMPUTE SUM1 = NUM1 - NUM2
WHEN EIBAID = DFHPF3
COMPUTE SUM1 = NUM1 * NUM2
WHEN OTHER
MOVE 'YOU MUST HIT PF1, PF2, PF3 OR CLEAR TO QUIT' TO MSGOO
END-EVALUATE.
MOVE SUM1 TO SUM1O.
EXEC CICS SEND MAP('CALC1') MAPSET('AKSH321') END-EXEC
EXEC CICS RETURN TRANSID('xxxx') COMMAREA ('1') END-EXEC
|
You would be wise to find out about the use of RESP in all CICS commands, as well -- it can save hours of debugging time! |
|
Back to top |
|
|
DB2 Guy
New User
Joined: 28 Oct 2008 Posts: 98 Location: Cubicle
|
|
|
|
Most of the sites uses pseudo-conversational approach for the Application-CICS-programs, as Robert has shown in his post.
You, akshathan, possibly talking about conversational program, however. If so, why are you checking for DHFENTER, the moment you hit enter after entering the transaction-ID, your program is invoked - AFAIK, no need to check for enter. So, possibly you canuse this, for a conversational appraoch:
Code: |
PROCEDURE DIVISION.
EXEC CICS SEND
MAP('CALC1')
MAPSET('AKSH321')
ERASE
END-EXEC
IF EIBAID = DFHPF2
DISPLAY 'IN ADD'
PERFORM RECEIVE-MAP-DATA THRU END-RECV
PERFORM ADD-PARA THRU 100-EXIT
ELSE
.
.
.
|
|
|
Back to top |
|
|
|