ABEND S0C1 REASON=00000001



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

ABEND S0C1 REASON=00000001

Postby GUI1504 » Thu Oct 14, 2010 6:51 pm

Hello guys. Now i'm trying to create a new file using Balance Line method (my way). First it was "moving on". Now, i can't do anymore 'cause this abend. The code is big and a little bit confused, but i think that is understandable.


COBOL

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BLNCLN.
      *
      *
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES. DECIMAL-POINT IS COMMA.
      *
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CADASTRO ASSIGN TO CADASTRO FILE STATUS IS WS-STATUS1.
           SELECT ATUALIZA ASSIGN TO ATUALIZA FILE STATUS IS WS-STATUS2.
           SELECT CADFINAL ASSIGN TO CADFINAL FILE STATUS IS WS-STATUS3.
      *
      *
       DATA DIVISION.
      *
       FILE SECTION.
       FD CADASTRO
           RECORDING MODE IS F
           RECORD CONTAINS 300 CHARACTERS.
       01 REG-CADASTRO PIC X(300).
      *
       FD ATUALIZA
           RECORDING MODE IS F
           BLOCK CONTAINS 200 CHARACTERS.
       01 REG-ATUALIZA PIC X(200).
      *
       FD CADFINAL
           RECORDING MODE IS F
           BLOCK CONTAINS 300 CHARACTERS.
       01 REG-CADFINAL PIC X(300).
      *
       WORKING-STORAGE SECTION.
      *
       01 WS-STATUS1        PIC X(02).
       01 WS-STATUS2        PIC X(02).
       01 WS-STATUS3        PIC X(02).
       01 WS-FLAG           PIC X(03) VALUE 'NAO'.
       01 WS-CADASTRO.
          10 CD-CODE.
             15 CD-EMP-CODE PIC 9(11).
          10 CD-DATA-INI    PIC 9(08).
          10 CD-DATA-FIM    PIC 9(08).
          10 CD-PLANO-DSCT  PIC 9(09).
          10 CD-PLANO-CNSM  PIC 9(09).
          10 CD-PLANO-TRFS  PIC 9(09).
          10 CD-EMP-NOME    PIC X(40).
          10 CD-EMP-END     PIC X(60).
          10 CD-EMP-CEP     PIC 9(08).
          10 CD-EMP-CITY    PIC X(20).
          10 CD-EMP-UF      PIC X(02).
          10 FILLER         PIC X(116).
      *
       01 WS-ATUALIZA.
          10 AT-FLAG        PIC X(01).
          10 AT-EMP-CODE    PIC X(11).
          10 AT-EMP-NOME    PIC X(40).
          10 AT-EMP-END     PIC X(60).
          10 AT-EMP-CEP     PIC 9(08).
          10 AT-EMP-CITY    PIC X(20).
          10 AT-EMP-UF      PIC X(02).
          10 FILLER         PIC X(58).
      *
       01 AUX-CADASTRO.
           10 AX-EMP-CODE    PIC 9(11).
           10 AX-DATA-INI    PIC 9(08).
           10 AX-DATA-FIM    PIC 9(08).
           10 AX-PLANO-DSCT  PIC 9(09).
           10 AX-PLANO-CNSM  PIC 9(09).
           10 AX-PLANO-TRFS  PIC 9(09).
           10 AX-EMP-NOME    PIC X(40).
           10 AX-EMP-END     PIC X(60).
           10 AX-EMP-CEP     PIC 9(08).
           10 AX-EMP-CITY    PIC X(20).
           10 AX-EMP-UF      PIC X(02).
      *
       01 AX-DATA-EDIT.
          10 AX-ANO          PIC 9(4).
          10 AX-MES          PIC 9(2).
          10 AX-DIA          PIC 9(2).
      *
       01 AX-DATA-OK.
          10 AX-DIA-OK       PIC 9(2).
          10 AX-MES-OK       PIC 9(2).
          10 AX-ANO-OK       PIC 9(4).
      *
       PROCEDURE DIVISION.
      *
       0000-MAIN.
           PERFORM 1000-OPEN
           PERFORM 2000-ROTINA
           PERFORM 4000-CLOSE
           STOP RUN.
       1000-OPEN.
           OPEN INPUT CADASTRO
           OPEN INPUT ATUALIZA
           OPEN OUTPUT CADFINAL.
       2000-ROTINA.
           PERFORM 2500-READ
           INITIALIZE AUX-CADASTRO
           IF CD-EMP-CODE = 99999999999 AND AT-EMP-CODE = 99999999999
              MOVE 'SIM' TO WS-FLAG
           END-IF
           PERFORM 3000-PERFORM UNTIL WS-FLAG = 'SIM'.
       2500-READ.
           PERFORM 2600-READ-CADASTRO
           PERFORM 2800-READ-ATUALIZA.
       2600-READ-CADASTRO.
            READ CADASTRO INTO WS-CADASTRO.
       2800-READ-ATUALIZA.
            READ ATUALIZA INTO WS-ATUALIZA.
       3000-PERFORM.
            IF AT-EMP-CODE < CD-EMP-CODE
               EVALUATE TRUE
                   WHEN AT-FLAG = 'A'
                        PERFORM 3100-WRITE-CADATT
                        PERFORM 2800-READ-ATUALIZA
                   WHEN AT-FLAG = 'D'
                        ACCEPT AX-DATA-EDIT FROM DATE
                        MOVE AX-DIA TO AX-DIA-OK
                        MOVE AX-MES TO AX-MES-OK
                        MOVE AX-ANO TO AX-ANO-OK
                        PERFORM 3200-WRITE-CADASTRO
                        PERFORM 2800-READ-ATUALIZA
                   WHEN AT-FLAG = 'I'
                        PERFORM 3300-WRITE-ATUALIZA
                        PERFORM 3200-WRITE-CADASTRO
                        PERFORM 2800-READ-ATUALIZA
               END-EVALUATE
            ELSE
               IF AT-EMP-CODE = CD-EMP-CODE
                  PERFORM 3100-WRITE-CADATT
                  PERFORM 2600-READ-CADASTRO
                  PERFORM 2800-READ-ATUALIZA
               ELSE
                  WRITE REG-CADFINAL FROM WS-CADASTRO
                  PERFORM 3300-WRITE-ATUALIZA
                  PERFORM 2600-READ-CADASTRO
               END-IF
            END-IF.
       3100-WRITE-CADATT.
            MOVE WS-CADASTRO TO AUX-CADASTRO
            MOVE AT-EMP-CODE TO AX-EMP-CODE
            MOVE AT-EMP-NOME TO AX-EMP-NOME
            MOVE AT-EMP-END TO AX-EMP-END
            MOVE AT-EMP-CEP TO AX-EMP-CEP
            MOVE AT-EMP-CITY TO AX-EMP-CITY
            MOVE AT-EMP-UF TO AX-EMP-UF
            WRITE REG-CADFINAL FROM AUX-CADASTRO.
       3200-WRITE-CADASTRO.
            MOVE WS-CADASTRO TO AUX-CADASTRO
            MOVE AX-DATA-OK TO AX-DATA-FIM
            MOVE CD-EMP-CODE TO AX-EMP-CODE
            MOVE CD-EMP-NOME TO AX-EMP-NOME
            MOVE CD-EMP-END TO AX-EMP-END
            MOVE CD-EMP-CEP TO AX-EMP-CEP
            MOVE CD-EMP-CITY TO AX-EMP-CITY
            MOVE CD-EMP-UF TO AX-EMP-UF
            WRITE REG-CADFINAL FROM AUX-CADASTRO.
       3300-WRITE-ATUALIZA.
            MOVE WS-CADASTRO TO AUX-CADASTRO
            MOVE AT-EMP-CODE TO AX-EMP-CODE
            MOVE AT-EMP-NOME TO AX-EMP-NOME
            MOVE AT-EMP-END TO AX-EMP-END
            MOVE AT-EMP-CEP TO AX-EMP-CEP
            MOVE AT-EMP-CITY TO AX-EMP-CITY
            MOVE AT-EMP-UF TO AX-EMP-UF
            WRITE REG-CADFINAL FROM AUX-CADASTRO.
       4000-CLOSE.
            CLOSE CADASTRO
            CLOSE ATUALIZA
            CLOSE CADFINAL.


SYSOUT
CEE3201S The system detected an operation exception (System Completion Code=0C1)
From compile unit BLNCLN at entry point BLNCLN at compile unit offset -EE8FF0F0 at entry offset -EE8FF0F0 at address 00000048.                                                     
GUI1504
 
Posts: 28
Joined: Fri Sep 03, 2010 10:40 pm
Location: Campinas, SP - Brazil
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND S0C1 REASON=00000001

Postby Robert Sample » Thu Oct 14, 2010 7:23 pm

The S0C1 abend is raised when a program attempts to execute a machine instruction that is not legal. This is typically caused by table overflows (aka storage overlay), I/O to an unopened or closed DCB, or amode / rmode problem. If you got a dump in your output, analyze it to determine the precise problem.
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: ABEND S0C1 REASON=00000001

Postby steve-myers » Thu Oct 14, 2010 7:29 pm

The address in the CEE3201S message is very typical of trying to do I/O to an unopened data set.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: ABEND S0C1 REASON=00000001

Postby GUI1504 » Thu Oct 14, 2010 11:05 pm

I'm just using 3 datasets and open them into 1000-OPEN
GUI1504
 
Posts: 28
Joined: Fri Sep 03, 2010 10:40 pm
Location: Campinas, SP - Brazil
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND S0C1 REASON=00000001

Postby Robert Sample » Thu Oct 14, 2010 11:20 pm

You say
PERFORM 3000-PERFORM UNTIL WS-FLAG = 'SIM'.
yet nowhere in the code section 3000-PERFORM do you actually set WS-FLAG. There's only one spot in your entire program that you set WS-FLAG. The S0C1 is probably because you're reading the files, even after hitting end of file (another good reason to actually use the file status codes), until the S0C1 occurs.
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: ABEND S0C1 REASON=00000001

Postby dick scherrer » Fri Oct 15, 2010 12:26 am

Hello,

At a quick look, it appears that reads to either/both input files can happen after end of file. . . Which will cause lots of problems.

Near the top of the COBOL part of the forum is tested code for a 2-file match/merge sample code.

Suggest you compare how this is written versus how BLNCLN is written.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: ABEND S0C1 REASON=00000001

Postby Ferrari2010 » Sat Oct 16, 2010 1:14 am

Hi,

From looking at the code, as Robert mentioned program is reading the file apart EOF.
I rewrite the below piece of code, take a look.

       0000-MAIN.
           PERFORM 1000-OPEN
           PERFORM 1500-INITIAL
      PERFORM 2000-ROTINA UNTIL <GIVE BASED ON UR REQUIREMENT>
           PERFORM 4000-CLOSE
           STOP RUN.
       1000-OPEN.
           OPEN INPUT CADASTRO
           OPEN INPUT ATUALIZA
           OPEN OUTPUT CADFINAL.
       1500-INITIAL.
           INITIALIZE AUX-CADASTRO
      READ CADASTRO INTO WS-CADASTRO
           IF FILE-STATUS = 10
              <AS PER REQUIREMENT>
           ELSE IF FILE-STATUS <> 00
              <AS PER REQUIREMENT>
           END-IF
           READ ATUALIZA INTO WS-ATUALIZA
           IF FILE-STATUS = 10
              <AS PER REQUIREMENT>
           ELSE IF FILE-STATUS <> 00
              <AS PER REQUIREMENT>
           END-IF
      IF CD-EMP-CODE = 99999999999 AND AT-EMP-CODE = 99999999999
              MOVE 'SIM' TO WS-FLAG         
           END-IF
       
        2000-ROTINA.
            IF AT-EMP-CODE < CD-EMP-CODE
               EVALUATE TRUE
                   WHEN AT-FLAG = 'A'
                        PERFORM 3100-WRITE-CADATT
                        READ ATUALIZA INTO WS-ATUALIZA
                   WHEN AT-FLAG = 'D'
                        ACCEPT AX-DATA-EDIT FROM DATE
                        MOVE AX-DIA TO AX-DIA-OK
                        MOVE AX-MES TO AX-MES-OK
                        MOVE AX-ANO TO AX-ANO-OK
                        PERFORM 3200-WRITE-CADASTRO
                        READ ATUALIZA INTO WS-ATUALIZA
                   WHEN AT-FLAG = 'I'
                        PERFORM 3300-WRITE-ATUALIZA
                        PERFORM 3200-WRITE-CADASTRO
                        READ ATUALIZA INTO WS-ATUALIZA
               END-EVALUATE
            ELSE
               IF AT-EMP-CODE = CD-EMP-CODE
                  PERFORM 3100-WRITE-CADATT
                  READ CADASTRO INTO WS-CADASTRO
                  READ ATUALIZA INTO WS-ATUALIZA.
               ELSE
                  WRITE REG-CADFINAL FROM WS-CADASTRO
                  PERFORM 3300-WRITE-ATUALIZA
                  READ CADASTRO INTO WS-CADASTRO
               END-IF
            END-IF.
Ferrari2010
 
Posts: 6
Joined: Fri Oct 08, 2010 8:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND S0C1 REASON=00000001

Postby dick scherrer » Sat Oct 16, 2010 3:09 am

Hello,

Did you test this before posting . . . ?

Suggest you now actually look at the working sample code from the "Sticky" that was mentioned before.

Notice how the newest code posted and the tested code that works differ. . .

Please post only code that has been successfully tested and meets the topic requirement.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: ABEND S0C1 REASON=00000001

Postby Ferrari2010 » Sat Oct 16, 2010 3:31 am

Noted.
Will follow going forward.

Thanks,
Ferrari2010
 
Posts: 6
Joined: Fri Oct 08, 2010 8:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ABEND S0C1 REASON=00000001

Postby dick scherrer » Sat Oct 16, 2010 9:01 am

You're welcome :)

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