IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Invalid key and hence error code of 23


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 19, 2008 11:57 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top