CICS program failed in writing/rewrting record in KSDS file



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

CICS program failed in writing/rewrting record in KSDS file

Postby jcsraghavan » Wed Nov 02, 2011 7:35 pm

Hi All,

I recently joined as mainframe analyst .
I had developed below program,but it is getting failed in writing/rewritimg the record in VSAM/KSDS file.

My requirement: With reference to one file i am updating adding a new record or updating the existing record in another file

Please find the code below what i am implementing:

PROCEDURE DIVISION.
PERFORM 101-INIT THRU 101-EXIT.

101-INIT.
MOVE LOW-VALUE TO FILE-KEY-LW
PERFORM 911-STARTBR-LWFILE
THRU 911-EXIT
PERFORM 921-READNEXT-LWFILE
THRU 921-EXIT
PERFORM UNTIL WS-EOF-LW-YES
PERFORM 201-PROCESS
THRU 201-EXIT
PERFORM 921-READNEXT-LWFILE
THRU 921-EXIT
END-PERFORM
PERFORM 961-ENDBR-LWFILE THRU 961-EXIT.
101-EXIT.
EXIT.
201-PROCESS.
IF WORKUNIT-STATUS-LW-COMPLETE
IF WORKUNIT-STATUS-LW-COMPLETE
CONTINUE
ELSE
GO TO 201-EXIT
END-IF

IF TYPE-LW= '2'
CONTINUE
ELSE
GO TO 201-EXIT
END-IF

ORE TEMPORARY LOCATIONS.
IF TO-SLOT-LW(1:1) = '*'
OR TO-SLOT-LW(1:3) = 'HAL'
OR TO-SLOT-LW(1:3) = 'HRH'
GO TO 201-EXIT
END-IF

MOVE LOW-VALUE TO PN-RECORD
MOVE CENTER-LW TO DISTRIBUTION-CENTER-PN
DISTRIBUTION-CENTER-PN-NDX1
MOVE WAREHOUSE-LW TO WAREHOUSE-PN
WAREHOUSE-PN-NDX1
MOVE WORKUNIT-LW TO WORKUNIT-PN

* MOVE TO-SLOT-LW TO LOCATION-ID-PN-NDX1
* MOVE PRODUCT-ID-LW TO PRODUCT-ID-PN
* MOVE SHIPPING-UNITS-LW TO PALLET-QUANTITY-PN

PERFORM 912-READ-PNFL
THRU 912-EXIT.
201-EXIT.
EXIT.
911-STARTBR-LWFILE.

EXEC CICS STARTBR
FILE (LWFILE)
RIDFLD (FILE-KEY-LW)
GTEQ
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
CONTINUE
WHEN FILE-STATUS-DB-NOT-FOUND
WHEN FILE-STATUS-DB-EOF
SET WS-EOF-LW-YES TO TRUE
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-11-STATUS
FAILDATA-FILE-STATUS
MOVE 'LW' TO MSG-11-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-LW TO MSG-11-KEY
MOVE MSG-11 TO ERROR-MSG
FAILDATA-PGM-COMMENT
MOVE '910-STARTBR-LWFILE' TO FAILDATA-PGM-LABEL
GO TO 650-ABNORM-END
END-EVALUATE.
911-EXIT.
EXIT.
921-READNEXT-LWFILE.
EXEC CICS READNEXT
FILE (LWFILE)
INTO (LW-RECORD)
RIDFLD (FILE-KEY-LW)
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
WHEN FILE-STATUS-DB-GOOD-WITH-DUPS
CONTINUE
WHEN FILE-STATUS-DB-NOT-FOUND
WHEN FILE-STATUS-DB-EOF
SET WS-EOF-LW-YES TO TRUE
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-13-STATUS
FAILDATA-FILE-STATUS
MOVE 'LW' TO MSG-13-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-LW TO MSG-13-KEY
FAILDATA-FILE-KEY
MOVE MSG-13 TO ERROR-MSG
FAILDATA-PGM-COMMENT
MOVE '920-READNEXT-LWFILE' TO FAILDATA-PGM-LABEL
GO TO 650-ABNORM-END
END-EVALUATE.

921-EXIT.
EXIT.
961-ENDBR-LWFILE.
EXEC CICS ENDBR
FILE (LWFILE)
RESP (FILE-STATUS-DB)
END-EXEC.
961-EXIT.
EXIT.
912-READ-PNFL.

EXEC CICS READ
FILE (PNFILE)
INTO (PN-RECORD)
RIDFLD (FILE-KEY-PN)
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
* MOVE CENTER-LW TO DISTRIBUTION-CENTER-PN
* DISTRIBUTION-CENTER-PN-NDX1
* MOVE WAREHOUSE-LW TO WAREHOUSE-PN
* WAREHOUSE-PN-NDX1
* MOVE WORKUNIT-LW TO WORKUNIT-PN
PERFORM 913-READ-PNF-UPDATE
THRU 913-EXIT
MOVE TO-SLOT-LW TO LOCATION-ID-PN-NDX1
MOVE PRODUCT-ID-LW TO PRODUCT-ID-PN
MOVE SHIPPING-UNITS-LW TO PALLET-QUANTITY-PN
SET AUDITED-NO-PN TO TRUE
PERFORM 915-REWRITE-PNFL
THRU 915-EXIT
WHEN FILE-STATUS-DB-NOT-FOUND
WHEN FILE-STATUS-DB-EOF
*PLEASE WRITE THE MOVE COMMANDS BEFORE WRITE
* MOVE CENTER-LW TO DISTRIBUTION-CENTER-PN
* DISTRIBUTION-CENTER-PN-NDX1
* MOVE WAREHOUSE-LW TO WAREHOUSE-PN
* WAREHOUSE-PN-NDX1
* MOVE WORKUNIT-LW TO WORKUNIT-PN
MOVE TO-SLOT-LW TO LOCATION-ID-PN-NDX1
MOVE PRODUCT-ID-LW TO PRODUCT-ID-PN
MOVE SHIPPING-UNITS-LW TO PALLET-QUANTITY-PN
SET AUDITED-NO-PN TO TRUE
PERFORM 914-WRITE-PNFL
THRU 914-EXIT
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-12-STATUS
FAILDATA-FILE-STATUS
MOVE 'PN' TO MSG-12-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-PN TO MSG-12-KEY
FAILDATA-FILE-KEY
MOVE MSG-12 TO ERROR-MSG
FAILDATA-PGM-COMMENT
MOVE '912-READ-PNFL' TO FAILDATA-PGM-LABEL
GO TO 650-ABNORM-END
END-EVALUATE.

912-EXIT.
EXIT.
913-READ-PNF-UPDATE.
EXEC CICS READ
FILE (PNFILE)
INTO (PN-RECORD)
RIDFLD (FILE-KEY-PN)
UPDATE
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
CONTINUE
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-14-STATUS
FAILDATA-FILE-STATUS
MOVE 'PN' TO MSG-14-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-PN TO MSG-14-KEY
FAILDATA-FILE-KEY
MOVE MSG-14 TO ERROR-MSG

MOVE '913-READ-PNF-UPDATE' TO FAILDATA-PGM-LABEL
FAILDATA-FILE-STATUS
GO TO 650-ABNORM-END
END-EVALUATE.
913-EXIT.
EXIT.
915-REWRITE-PNFL.
EXEC CICS
REWRITE
FILE (PNFILE)
FROM (PN-RECORD)
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
CONTINUE
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-16-STATUS
MOVE 'PN' TO MSG-16-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-PN TO MSG-16-KEY
FAILDATA-FILE-KEY
MOVE MSG-16 TO ERROR-MSG
FAILDATA-PGM-COMMENT
MOVE '915-REWRITE-PNFLE' TO FAILDATA-PGM-LABEL
GO TO 650-ABNORM-END
END-EVALUATE.
915-EXIT.
EXIT.
914-WRITE-PNFL.
EXEC CICS
WRITE
FILE (PNFILE)
FROM (PN-RECORD)
RIDFLD (FILE-KEY-PN)
RESP (FILE-STATUS-DB)
END-EXEC.

EVALUATE TRUE
WHEN FILE-STATUS-DB-GOOD
CONTINUE
WHEN OTHER
MOVE FILE-STATUS-DB TO MSG-15-STATUS
FAILDATA-FILE-STATUS
MOVE 'PN' TO MSG-15-FILE
FAILDATA-FILE-ID
MOVE FILE-KEY-PN TO MSG-15-KEY
FAILDATA-FILE-KEY
MOVE MSG-15 TO ERROR-MSG
FAILDATA-PGM-COMMENT
MOVE '914-WRIT-PNFL' TO FAILDATA-PGM-LABEL
GO TO 650-ABNORM-END
END-EVALUATE.
914-EXIT.
EXIT.
650-ABNORM-END.
EXEC CICS
SYNCPOINT ROLLBACK
END-EXEC.

MOVE MY-PROG TO FAILDATA-PGM-ID
PERFORM 887-CSMTBLD
THRU 887-EXIT
PERFORM 888-CSMT-WRITE
THRU 888-EXIT
PERFORM 887-CSMTBLD-2
THRU 887-EXIT-2
PERFORM 888-CSMT-WRITE
THRU 888-EXIT

EXEC CICS
RETURN
END-EXEC.

COPY CSMTBLD.
COPY CICSCSMT.

Error i am getting is :

FS99 00 111102 05:29:56 914-WRIT-PNFL PN 0206583224
FS99 00 111102 05:29:56 15:ERROR WRITE PN , 21, 02065

But when i try to insert the this record manually by using XPED option it got inserted.

Can some one please help in getting this resolved.

Please let me know if u need any more information.
jcsraghavan
 
Posts: 6
Joined: Wed Nov 02, 2011 7:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CICS program failed in writing/rewrting record in KSDS f

Postby Robert Sample » Wed Nov 02, 2011 8:18 pm

What you have posted is pretty much useless. What is the response code -- 15, 21, or something else? The meanings of the response codes can be found in the description of the EIB fields in the CICS Application Programming Reference manual, which should be your FIRST reference. If your response code is 15, then you attempted to write a record that has a key already in the file; if your response code is 21, then you got an ILLOGIC condition which means you are attempting to do something that doesn't make sense (such as rewriting a record you have not yet read).

In any case, your best debugging effort would be to clearly identify the response code and use that as a clue to what the problem is. If your site has Xpediter, you can use that to step through the code to ensure your program is not falling through or otherwise having logic issues resulting in the abend.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: CICS program failed in writing/rewrting record in KSDS f

Postby BillyBoyo » Wed Nov 02, 2011 9:11 pm

You are performing 101-init and then when that finishes you are dropping through the program. Results likely to be not what you want.

In fact, the only exit you have for the program is in 650, for your abnormal condition.

When posting something which needs the spacing preserved to be useful, please use the Code tags.

You have numbered paragraphs. That is pointless if they do not appear in number order.

You are GO TOing out of PERFORMs (to 650), which is not a good idea, even though you can get away with it these days. Could be your site "standard" for this, even, I suppose.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: CICS program failed in writing/rewrting record in KSDS f

Postby jcsraghavan » Wed Nov 02, 2011 11:23 pm

Hi Robert

Thanks for you reply.
Sorry if had posted in wrong manner.
As i am very new to this type of forums and to job also,thats why i might have posted in that manner.

Ok As you said that "if your response code is 21, then you got an ILLOGIC condition which means you are attempting to do something that doesn't make sense (such as rewriting a record you have not yet read)."

I am not rewriting the record which not yet read.
I am rewriting the record only after the successful read.
With reference to the above code i am performing read operation in this perform PERFORM 912-READ-PNFL
THRU 912-EXIT
if the record is found then i am holding the exclusive control over that record by using this perform PERFORM 913-READ-PNF-UPDATE THRU 913-EXIT only after this read with update operation is good i am performing the rewrite operation in this perform PERFORM 915-REWRITE-PNFL THRU 915-EXIT( which means that i am not trying to rewrite on the record which is not read).

Please let me know if am wrong.
jcsraghavan
 
Posts: 6
Joined: Wed Nov 02, 2011 7:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CICS program failed in writing/rewrting record in KSDS f

Postby BillyBoyo » Thu Nov 03, 2011 2:57 am

And did you read my comments?

After your very first PERFORM in the Procedure Division, you fall into the same paragraph again and continue falling until you hit the 650-, which then reports an error, which might not necessarily exist.

If you ignore this again, you might run the risk of me looking at the program in detail :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: CICS program failed in writing/rewrting record in KSDS f

Postby Robert Sample » Thu Nov 03, 2011 6:04 am

Please let me know if am wrong.
Okay, you made me look at your code. If your code is exactly as you have posted (that is, you did not leave anything out), then your code is WRONG -- deeply, totally flawed.
PROCEDURE DIVISION.
PERFORM 101-INIT THRU 101-EXIT.

101-INIT.
MOVE LOW-VALUE TO FILE-KEY-LW
PERFORM 911-STARTBR-LWFILE
THRU 911-EXIT
The way COBOL works, it will perform 101-INIT through 101-EXIT. After that, COBOL drops to the next statement in sequence ... which will be the MOVE LOW-VALUE statement after 101-INIT. So your 101-INIT code will be executed twice. If the rest of your PERFORM statements are as well written, you have a lot of debugging to do. So based on the little bit of code I've examined, your statements
I am not rewriting the record which not yet read.
I am rewriting the record only after the successful read.
cannot be asserted at this time -- either you do not understand your code, or you are deluding yourself about what the code does.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: CICS program failed in writing/rewrting record in KSDS f

Postby jcsraghavan » Thu Nov 03, 2011 9:00 pm

Hi Robert/Belly ,

what u said is exactly right.
But unfortunately i missed out some part of code when i did copy and pasted.

I had coded EXEC CICS RETURN END-EXEC. after the

961-ENDBR-LWFILE.
EXEC CICS ENDBR
FILE (LWFILE)
RESP (FILE-STATUS-DB)
END-EXEC.

which eventually exit the program after ending the browse operation
jcsraghavan
 
Posts: 6
Joined: Wed Nov 02, 2011 7:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CICS program failed in writing/rewrting record in KSDS f

Postby jcsraghavan » Thu Nov 03, 2011 9:09 pm

Hi Robert/Belly ,

I got some discussion which is related to the same error i am getting in the below link

http://ibmmainframes.com/about24957.html

I had checked all the below suggestion in that discussion which follow below

verify the following:
use CEMT to inquire on the file and ensure the Add attribute is there

I FILE(FILEA)
STATUS: ,RESULTS - OVERTYPE TO MODIFY
,Fil(FILEA ),Vsa,Ope,Ena,Rea,Upd,Add,Bro,Del, ,Sha, ,
,, ,Dsn(,QAMQS.CICSV813.FILEA ,)


the value of FDPT_FILE is a valid CICS file name



the record length matches what is defined for records in the file

the value of KEYLEN is the correct key length for records in the file

the file you are trying to write to is not currently under Browse
control within same task
i.e.

startbr
readnext
write < illogic

the file you are trying to wrie to is not under update within same task
read update
write < illogic

I am able to write the record by using CECI supplied transaction.

Still i am unable to figure out my error .

If some one can help me it would be great
jcsraghavan
 
Posts: 6
Joined: Wed Nov 02, 2011 7:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CICS program failed in writing/rewrting record in KSDS f

Postby Robert Sample » Thu Nov 03, 2011 11:24 pm

You need to use Xpediter to debug your program by stepping through the logic, one statement at a time. If you do not have the skills to do that, try to get some training to learn how to use Xpediter.

Failing that, use CEDF to debug your program -- this will at least let you follow the CICS commands one by one and ensure that they are executing in the correct sequence.

I think one of the main issues, however, is that you are not believing the computer. When you get the message from CICS with an ILLOGIC error, you need to accept that the system is not lying to you. Despitre your assurances that everything is set up correctly, and despite the fact that doing the command with CECI works (and by the way this proves nothing except you can type in a CICS command on the terminal), when the system tells you something did not work -- BELIEVE THE SYSTEM.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: CICS program failed in writing/rewrting record in KSDS f

Postby jcsraghavan » Fri Nov 04, 2011 12:21 am

Hi Robert,

I tried to debug the program by using expediter by step by step.
I got the error at rewrite with EIBRESP = 21

Please find below the screeb shot of what i am getting

LV ---- COBOL DATANAME KEEPS ---- -- ATTRIBUTES -- ----+---10----+---20--->
K 04 WORKUNIT-LW 9(06) NUM-DIS 689752
K 01 PN-RECORD GROUP 02066897520206K34410A122
02 EIBRESP S9(8) COMP +00000021
01 FILE-STATUS-DB S9(08) COMP +00000000
**END**
------ --------------------------------------------------- Before FS99.992 ->
000985 * FROM (PN-RECORD)
000986 * RESP (FILE-STATUS-DB)
000987 *END-EXEC.
000988 Move length of PN-RECORD to dfhb0020
000989 Call 'DFHEI1' using by content x'0606e0002700004000f0f0f9f0f0
000990 - '404040' by reference PNFILE by reference PN-RECORD by
000991 reference dfhb0020 end-call
=====> Move eibresp to FILE-STATUS-DB.
000993
000994
000995 EVALUATE TRUE
000996 WHEN FILE-STATUS-DB-GOOD
000997 CONTINUE

so i had used to see the record by using keep PN-RECORD.
I saved it,

01 PN-RECORD GROUP
02 FILE-KEY-PN GROUP
03 DISTRIBUTION-CENTER-PN 9(02) NUM-DIS 02
03 WAREHOUSE-PN 9(02) NUM-DIS 06
03 WORKUNIT-PN 9(06) NUM-DIS 689752
02 NDX1-KEY-PN GROUP
03 DISTRIBUTION-CENTER-PN-NDX1 9(02) NUM-DIS 02
03 WAREHOUSE-PN-NDX1 9(02) NUM-DIS 06
03 LOCATION-ID-PN-NDX1 X(08) K34410A1
02 PRODUCT-ID-PN 9(07) NUM-DIS 2212694
02 AUDITED-FLAG-PN X(01) N
88 AUDITED-YES-PN VALUE Y
88 AUDITED-NO-PN VALUE N
02 PALLET-QUANTITY-PN 9(04) NUM-DIS 8752
02 FILLER X(30) ........................

I manually tried to write in to PNFL02 by using xped 5.1.3 option and got the ********* I/O error "ILLOGIC", EIBRCODE=086C8F04 error.


--------------- XPEDITER/CICS - EDIT CICS DATASET RECORD (5.1.3) ----------CIT1
COMMAND ===> SCROLL ===> CSR
MODULE: ********* I/O error "ILLOGIC", EIBRCODE=086C8F04 *********
VALID COMMANDS: READ DELETE WRITE REWRITE NEXT PREV CLOSE
ACCESS METHOD: VSAM TYPE: KSDS
FILENAME: PNFL02 RECLN: 00064 MAX RECLN: 00064
DEC-OFFSET: 000000 ADD-OFFSET: ______ RECFM: F KEYLN: 00010 RKP: 00000
KEY FIELD: ----+---10
0206689572
FFFFFFFFFF
0206689572
----+---10----+---20----+---30----+---40----+---50----+---60--64
02066895720206K34410A12212694N8752..............................
FFFFFFFFFFFFFFDFFFFFCFFFFFFFFDFFFF000000000000000000000000000000
0206689572020623441011221269458752000000000000000000000000000000
----+---10----+---20----+---30----+---40----+---50----+---60--64


Please suggest me do i need to do anything
jcsraghavan
 
Posts: 6
Joined: Wed Nov 02, 2011 7:09 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to CICS

 


  • Related topics
    Replies
    Views
    Last post