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
 

 

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: 8055
Location: East Dubuque, Illinois, 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 Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts IDC2902I Error tzeche ABENDS & Debugging 2 Tue Mar 28, 2017 11:39 am


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