Sudip Akhuli
Sudip Akhuli

Reputation: 11

Error IGZ0035S when attempting to open an output dataset in COBOL

I have created two datasets PRT-DONE and PRT-LINE in output. But when I am submitting job it is showing unsuccessful opening of PRT-DONE output; PRT-LINE is working fine.

I think it cannot open the datasets PRT-DONE. Looks like opening error of the output PRTDONE. When I was removing that open statement there was only condition code error.

Error: IGZ0035S There was an unsuccessful OPEN or CLOSE of file PRTDONE in program ADDONE at relative location X'318'.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    ADDONE.
       AUTHOR.        STUDENT.
      *
       ENVIRONMENT DIVISION.
      *
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT PRT-LINE ASSIGN TO PRTLINE.
           SELECT PRT-DONE ASSIGN TO PRTDONE.

       DATA DIVISION.
       FILE SECTION.
       FD  PRT-LINE RECORD CONTAINS 80 CHARACTERS RECORDING MODE F.
       01  PRT-REC        PIC X(80) VALUE SPACES.

       FD  PRT-DONE RECORD CONTAINS 80 CHARACTERS RECORDING MODE F.
       01  PRT-REC-DONE.
           05  PRT-DATE     PIC X(8)  VALUE SPACES.
           05  FILLER       PIC X(1)  VALUE SPACES.
           05  PRT-TIME     PIC X(4)  VALUE SPACES.
           05  FILLER       PIC X(2)  VALUE SPACES.
           05  PRT-COMMENT  PIC X(27) VALUE SPACES.
           05  FILLER       PIC X(2)  VALUE SPACES.
           05  PRT-MY-NAME  PIC X(36) VALUE SPACES.

       WORKING-STORAGE SECTION.

       01  PGM-VARIABLES.
           05  PGM-COUNT    PIC 9(05).

       01  YYYYMMDD         PIC 9(8).

       01  INTEGER-FORM     PIC S9(9).

       01  REFMOD-TIME-ITEM PIC X(8).

      ****************************************************************
      *                  PROCEDURE DIVISION                          *
      ****************************************************************
       PROCEDURE DIVISION.
      *
       A000-START.
           OPEN OUTPUT PRT-LINE.
           PERFORM A000-COUNT 10 TIMES.
           PERFORM A000-DONE.
           CLOSE   PRT-LINE.
           STOP RUN.
      *
       A000-COUNT.
           ADD 1 TO PGM-COUNT.
      *    DISPLAY PGM-COUNT.
           WRITE PRT-REC FROM  PGM-COUNT.
      *
       A000-DONE.
           OPEN OUTPUT PRT-DONE.
           MOVE SPACES TO PRT-REC-DONE.
           ACCEPT REFMOD-TIME-ITEM FROM TIME.
           MOVE FUNCTION CURRENT-DATE(1:8) TO YYYYMMDD.
           MOVE YYYYMMDD         TO PRT-DATE.
           MOVE REFMOD-TIME-ITEM (1:4) TO PRT-TIME.
           MOVE "My first z/OS COBOL program" TO PRT-COMMENT.
           WRITE PRT-REC-DONE.
           CLOSE PRT-DONE.

JCL:

//ADD1JCL  JOB 1,NOTIFY=&SYSUID
//*****************/
//COBRUN  EXEC IGYWCL
//COBOL.SYSIN  DD DSN=&SYSUID..SOURCE(ADD1CBL),DISP=SHR
//LKED.SYSLMOD DD DSN=&SYSUID..LOAD(ADD1CBL),DISP=SHR
//*****************/
// IF RC = 0 THEN
//*****************/
//RUN     EXEC PGM=ADD1CBL
//STEPLIB   DD DSN=&SYSUID..LOAD,DISP=SHR
//PRTDONE   DD  DSN=Z12441.OUTPUT(PRTDONE),DISP=SHR,OUTLIM=15000
//PRTLINE   DD  DSN=Z12441.OUTPUT(PRTLINE),DISP=SHR,OUTLIM=15000
//SYSOUT    DD SYSOUT=*,OUTLIM=15000
//CEEDUMP   DD DUMMY
//SYSUDUMP  DD DUMMY
//*****************/
// ELSE
// ENDIF

Upvotes: 1

Views: 1159

Answers (1)

phunsoft
phunsoft

Reputation: 2735

I assume your output data set Z12441.OUTPUT is of type PDS not PDS/E. You're trying to write to two members in the same PDS in parallel, which is not supported. In your job's output, you probably see a message IEC143I 213-30,.... Where 213 is the ABEND code which points to a problem with the OPEN service, and 30 is the return code. The explanation of messsage IEC143I can be found here Message description. The explanation for reason code 30 sais:

An attempt was made to open a partitioned data set (PDS) for OUTPUT,DISP=SHR. The PDS is already open in this condition, and a DCB is already open for output to the data set. The data set might be on the same system or on another system that is sharing the volume. Access was not serialized before the attempt to open the data set.

You need to allocate two distinct output data sets, one for PRTDONE, and one for PRTLINE. Two members of the same PDS are not two distinct data sets.

Note that PDS/E data sets allow multiple concurrent opens for output to different members, with some restrictions. I would advise to not get used to opening for output multiple members of the same PDS or PDS/E at the same time. Rather use PS data sets than PDS members for output. One reason being the restartability of jobs. With PS data sets, you can simply delete and reallocate the data set within a job, and then rerun the job. It is more complex to handle restartability with PDS members.

Upvotes: 4

Related Questions