i get logic error 92 when i run this code



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

i get logic error 92 when i run this code

Postby jophine89 » Wed Aug 24, 2011 4:41 pm

i get logic error 92 when i run this code

IDENTIFICATION DIVISION.     
PROGRAM-ID. BANKTRAN.         
ENVIRONMENT DIVISION.         
INPUT-OUTPUT SECTION.         
FILE-CONTROL.
    SELECT FILE1 ASSIGN TO DD1
    ORGANIZATION IS INDEXED   
    ACCESS MODE IS DYNAMIC   
    RECORD KEY IS LOG         
    FILE STATUS IS FS.       
DATA DIVISION.               
FILE SECTION.                 
FD FILE1.                     
01 BK.                       
    02 LOG PIC X(29).         
WORKING-STORAGE SECTION.     
01 ACC.                       
    02 ACCNO PIC X(10).       
    02 YEAR PIC X(4).         
    02 MON PIC X(2).         
    02 DY PIC X(2).           
    02 TNXNO PIC X(2).       
    02 TNX PIC X(2).         
    02 TNXAMT PIC 9(5)V99.   
77 FLAG PIC X VALUE 'Y'.                             
77 FS PIC X(2).                                     
77 INP PIC X(29).                                   
PROCEDURE DIVISION.                                 
MAIN-RTN.                                           
    OPEN INPUT FILE1.                               
    DISPLAY FS.                                     
    ACCEPT LOG.                                     
    PERFORM READ-SEQ UNTIL FLAG = 'N'.               
    CLOSE FILE1.                                     
    DISPLAY FS.                                     
    STOP RUN.                                       
READ-SEQ.                                           
    START FILE1 KEY IS >= LOG.                       
    READ FILE1 NEXT AT END MOVE 'N' TO FLAG END-READ.
    DISPLAY BK SPACE FS.   


and my input file is

13106125952011081601CR1000000
13106125952011081602CR1100000
13106125952011081603CR1200000
13106125952011081604DB0100000
13106125952011081605DB0300000
13106125952011081606DB1100000
13106125952011081701DB1100000
13106125952011081801DB1100000
13106125952011081901DB1100000
13106125952011082601CR1100000
13106125952011082801CR1200000
13106125962011081701DB1100000
13106125962011081801DB1100000
13106125962011081901DB1100000
13106125972011081701DB1100000

when givem a key/partial key the read should be random first and then sequential as like reading all the bank statements in 6th month.

can any one help me out...
jophine89
 
Posts: 4
Joined: Wed Jul 27, 2011 2:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: i get logic error 92 when i run this code

Postby Robert Sample » Wed Aug 24, 2011 5:43 pm

If you OPEN a file, you READ the file. Using the ACCEPT verb means the system is expecting you to provide input in //SYSIN and the file will be completely ignored -- in which case you risk a S0C4 storage abend by referencing storage that does not exist.

In other words, your code is wrong and you need to fix it.
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: i get logic error 92 when i run this code

Postby BillyBoyo » Wed Aug 24, 2011 5:55 pm

You are doing a START in the paragraph you are performing. You, at best, get START, START, READ, START, READ, START, READ... either in a "loop" or you will eventually do a START which gets EOF and then you do a READ = logic error.

I can't tell which, but whichever your program is wrong.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: i get logic error 92 when i run this code

Postby Ed Goodman » Wed Aug 24, 2011 6:31 pm

Check the return code of the start command. If you don't get a clean start, you can't do a read.

I would do something like this in stages.
First, make sure your ACCEPT is working the way you think it should. Comment out the perform and display the "log" variable.
If that's right, then go ahead and do the perform, but comment out the read. Just do the Start and display the status code.
If that's all correct, then add the read back in, but add some code to check THAT status code too.

I also think you're asking for trouble using an ACCEPT statement with that "LOG" variable which is part of the FILE1 definition. You see, when you coded the "SELECT" statement for FILE1, you told COBOL to look to the "DD1" DD statement in the JCL for that data. You also said that is was a VSAM file. Then you used ACCEPT to try and put data into it.

As billy pointed out, you're also doing the start more than once.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: i get logic error 92 when i run this code

Postby jophine89 » Thu Aug 25, 2011 2:18 pm

thank you guys for your sugestions:):). i then edited the procedure division as follows still i get file status 92. nopt only this program but the cobol file concept programs which were executing correctly are are also throwing file status 92, 23 etc..

PROCEDURE DIVISION.
MAIN-RTN.
OPEN INPUT FILE1.
DISPLAY FS.
ACCEPT LOG.
MOVE '1310612595' TO LOG.
START FILE1 KEY IS >= LOG.
PERFORM UNTIL FLAG = 'N'
READ FILE1 NEXT AT END MOVE 'N' TO FLAG END-READ
DISPLAY BK SPACE FS
END-PERFORM.
CLOSE FILE1.
DISPLAY FS.
STOP RUN.
jophine89
 
Posts: 4
Joined: Wed Jul 27, 2011 2:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: i get logic error 92 when i run this code

Postby BillyBoyo » Thu Aug 25, 2011 3:22 pm

Is there any data on your file? 23 is end-of-file. 92 you would get if you read after receiving end-of-file. If you have lots of programs getting these, which weren't before, I'd guess you have either an empty file or a file truncated before the keys that you are using (in all the programs... that is why I think the first is most likely).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: i get logic error 92 when i run this code

Postby Robert Sample » Thu Aug 25, 2011 6:11 pm

jophine89, I get the feeling your code is wrong because your approach is wrong. Please -- start at the beginning and tell us what you are attempting to do in plain English without any code involved. If we do not understand, then we'll ask for clarification -- and if we do not understand, then you DEFINITELY do not understand well enough to write code.

It appears to me that you are attempting to read some kind of log file and use each record to retrieve matching data records from a VSAM KSDS file. However, the problems I see at this point are:
1. the VSAM KSDS file is defined with a key and nothing else -- you could easily get a 92 file status if there is more data in each record than your COBOL program shows
2. it appears you are attempting to use one file where you need two files (sequential log file and indexed VSAM file).
3. you define the file status and display it, which is good, but you don't have any code to actually CHECK the file status. If you do the OPEN, and you get anything in the file status cod except 00 or 97, you need to stop your program IMMEDIATELY -- because your starts and reads of the VSAM file will not work, period. Similarly, once you do the START you do not check to see if the file status is good -- and I've seen a lot of START commands return file status codes other than 00.
4. once you do a start on the VSAM file, you just read and display until end-of-file. If you are trying to read a file of log records and display matches in the VSAM file, the last record in the VSAM file will be displayed once for each input log file record -- 15 times based on the sample data in your original post. Why are you doing this?
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: i get logic error 92 when i run this code

Postby Ed Goodman » Thu Aug 25, 2011 7:09 pm

Why aren't you checking return code after the start? That would tell you a LOT.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: i get logic error 92 when i run this code

Postby jophine89 » Wed Sep 14, 2011 11:48 pm

thank you so much guys... i got the output...the mistake was not in code but the way i loaded the data in ksds...
jophine89
 
Posts: 4
Joined: Wed Jul 27, 2011 2:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: i get logic error 92 when i run this code

Postby dick scherrer » Thu Sep 15, 2011 12:17 am

Good to hear it is working - thank you for letting us know the resolution :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post