Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SC0$ Abend in Cobol Program

Status
Not open for further replies.

imsmain

Programmer
Feb 6, 2003
3
US
Hi,
I am getting a SC04 Abend while running a cobol program
which processes a file with multiple record lay out.When I removed the last set of records, the program is working fine.And while running only with the last set of records,
the program is working fine.But the program abends when i run it with all the sets of records giving SC04.the interesting part is that ,the expeditor is not giving any Abend while running thru it.
Please help if some body has any solution on this problem!

Sujesh
 
The abend occured in the subroutine which reads the file.
The subroutine is reading the file and passing to the main program.The Abend occured in the move statement which moves data from the input record to the working storage of the sub routine.

thanks,
 
Hi Sujesh,

If your pgm is too big to copy into the post, try showing us at minimum the select/assign, the FD (including rec layouts), the WS rec layouts, if you're using "read into" and the read routine. If the move is in a separate routine, provide that too.

Regards, Jack
 
Hi jack,

Subroutine has this code .
-------------------------

INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CLAIMS-FILE ASSIGN TO UT-S-CLAIMS
FILE STATUS IS STATUS-CODE OF CLAIMS-CONTROL.

DATA DIVISION.
FILE SECTION.

FD CLAIMS-FILE
RECORD IS VARYING IN SIZE FROM 15 TO 850 CHARACTERS
LABEL RECORDS STANDARD
RECORDING MODE IS V.

01 CLAIMS-INPUT-RECORD.
05 CLAIMSI-FULL-KEY.
10 CLAIMSI-AGGREGATOR PIC X(014).
10 CLAIMSI-RECORD-TYPE PIC X(003).
10 FILLER PIC X(003).
10 CLAIMSI-RECORD-TYPE-QUAL PIC X(001).
10 CLAIMSI-RECORD-SEQ PIC X(003).

05 FILLER PIC X(826).

01 O-BILLING-PROVIDER.
COPY PROVC REPLACING == :XX: == BY == O ==.

WORKING-STORAGE SECTION.
01 CLAIMS-RECORD.
05 CLAIM-FULL-KEY.
10 CLAIMS-AGGREGATOR PIC X(014).
10 CLAIMS-RECORD-TYPE PIC X(003).
10 FILLER PIC X(003).
10 CLAIMS-RECORD-TYPE-QUAL PIC X(001).
10 CLAIMS-RECORD-SEQ PIC X(003).

05 FILLER PIC X(826).

LINKAGE SECTION.

01 CLMS-COMM-AREA
COPY CLMRECC.


PROCEDURE DIVISION.

PERFORM 1000-READ-CLAIMS
UNTIL PCOCLMS-EOF.

1000-READ-CLAIMS.
READ CLAIMS-FILE
AT END MOVE 'Y' TO PCOCLMS-EOF.
PERFORM 2000-MOVE-RECORD.

2000-MOVE-RECORD.
MOVE O-BILLING-PROVIDER
TO CLAIMS-RECORD

the abend aid shows the abend happended in this statement

Thanks,
 
In para 1000-READ-CLAIMS, you are PERFORM'ing para 2000-MOVE-RECORD even when you hit the end of file condition, at which time you have no record in the FD area. Hence, the S0C4 abend. "Code what you mean,
and mean what you code"

Razalas
 
Hi Sujesh,

See what a little code can do?

Razalas,

Just a little variation on your parting quote:

"Code what you mean,
but by all means send the code" :)

Regards, Jack.
 
Jack,

I see what you mean,
and what you meant is what we all wish to see!

But...

what I meant was that we can minimize these sorts of errors when we follow this rule.

Case in point, imsmain did not code what they meant when they wrote...

Code:
READ CLAIMS-FILE                     
    AT END MOVE 'Y' TO PCOCLMS-EOF.
    PERFORM 2000-MOVE-RECORD.

Since what they really meant was...

Code:
READ CLAIMS-FILE
    AT END
        SET PCOCLMS-EOF TO TRUE
    NOT AT END
        PERFORM 2000-MOVE-RECORD
END-READ

Perhaps if they had asked themselves "Did I code what I meant?" and "Did I mean what I wrote?" they might have saved themselves some grief. But then again, maybe not. These things, of course, are always easier in retrospect.

I guess what I am advocating is a little more advance inspection. Of course, we can all use a second pair of eyes on occasion! "Code what you mean,
and mean what you code!
And when you aren't sure,
by all means post your code!"

Razalas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top