Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Invalid key and hence error code of 23

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vab987

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Wed Nov 19, 2008 11:51 pm    Post subject: Invalid key and hence error code of 23
Reply with quote

Hi All,

My Batch program has to read a file(CUSTACFL) for which a key (ACNT-SRC-CUST-KEY) is used.

At very first run the program reads the file correctly but after that for all the subsequent reads it gives the invalid key and hence error code of 23.
I am initializing the key before the next read.

One more question :- My program opens the file(CUSTACFL) each time it has to read even if it is opened . I know this is not right but can this be the cause of the invalid key ?

Please help to know what could be the probable reason for the "invalid key" error.

I have a code pasted below :

OPEN INPUT CUSTACFL.
INITIALIZE W01-COMPST-KEY.
INITIALIZE ACNT-SRC-CUST-KEY.

MOVE CACI-ACNT-N TO W01-ACNT-NUM.
MOVE CACI-SOURC-SYSTM-N TO W01-SRC-SYS.
MOVE CACI-CUST-N TO W01-CUST-NUM.

MOVE W01-COMPST-KEY TO ACNT-SRC-CUST-KEY.

READ CUSTACFL KEY IS ACNT-SRC-CUST-KEY
INVALID KEY
MOVE 'N' TO W01-CACICURS-FOUND
END-READ.

EVALUATE W01-CUSTAC-FL-STAT
WHEN 0
MOVE 'Y' TO W01-CACICURS-FOUND
WHEN 23
MOVE 'N' TO W01-CACICURS-FOUND
END-EVALUATE.


Regards,
Vab
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8212
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 19, 2008 11:57 pm    Post subject:
Reply with quote

Quote:
One more question :- My program opens the file(CUSTACFL) each time it has to read even if it is opened . I know this is not right but can this be the cause of the invalid key ?
Fix this and then try again. Most likely the invalid key is due to opening a file already open and then trying to read from it.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 20, 2008 12:51 am    Post subject:
Reply with quote

Hi Vab,

Another thing to consider is the performance impact of OPENing the file before each READ.

I worked on correcting that type of coding and the job run time was reduced from over 3 hrs to 10 mins.

Where the OPEN creates an error condition, it may have an even bigger impact on performance.
Back to top
View user's profile Send private message
vab987

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Thu Nov 20, 2008 3:09 pm    Post subject: Thanks..
Reply with quote

Hi,

As stated by Robert and mmwife, the problem for " Invalid key err message " was opening the same file again and again without closing.

Thanks,
Vab
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IBEGENER RETURN CODE 12 anilkumar922 All Other Mainframe Topics 5 Wed Dec 13, 2017 11:41 am
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us