Problem with OPEN/READ a table



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Problem with OPEN/READ a table

Postby GUI1504 » Thu Sep 30, 2010 11:39 pm

Hello guys, i'm an another little problem. I'm trying read a data table in a cobol program and I can't. I'm think that's a JCL problem, but I don't know what really are. In compilation, i have Return Code 0, but the file don't open (WS-Status will show).

JCL
//GUI1504J    JOB (GUI1504),GUI1504,CLASS=A,MSGCLASS=X,NOTIFY=GUI1504
//PROCLIB     JCLLIB ORDER=IBMMFS.PROC.IBMCOB
//COMPILE     EXEC IGYWCG
//ENTRADA     DD DSN=GUI1504.FINAL.ENTRADA,DISP=SHR
//COBOL.SYSIN DD DSN=GUI1504.FINAL.COBOL,DISP=SHR
//SYSPRINT    DD SYSOUT=*
/*


COBOL
IDENTIFICATION DIVISION.
       PROGRAM-ID. FNAL.
      *
       ENVIRONMENT DIVISION.
      *
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT ENTRADA
           ASSIGN TO ENTRADA
           FILE STATUS IS WS-STATUS.
      *
      *
       DATA DIVISION.
      *
       FILE SECTION.
       FD ENTRADA
           LABEL RECORD IS STANDARD
           RECORDING MODE IS F
           RECORD CONTAINS 80 CHARACTERS.
      *
       01 REG-FILE PIC X(80).
      *
       WORKING-STORAGE SECTION.
      *
       01 WS-STATUS           PIC X(02).
       01 WS-REGISTRO.
          10 WS-CODIGO        PIC 9(04).
          10 WS-NOME          PIC X(30).
          10 WS-ESTADO        PIC X(02).
          10 FILLER           PIC X(44).
       01 WS-ESTADOS          PIC X(54).
       01 WS-SIGLAS           REDEFINES WS-ESTADOS.
          10 WS-SIGLA         PIC X(02) OCCURS 27 TIMES.
       01 WS-FLAG             PIC X(03) VALUE 'NAO'.
       01 WS-CONTADOR         PIC X(02).
      *
       PROCEDURE DIVISION.
      *
       0000-MAIN.
           PERFORM 1000-START.
           PERFORM 2000-PERFORM UNTIL WS-FLAG EQUAL 'SIM'.
           PERFORM 3000-END.
           STOP RUN.
      *
       1000-START.
           INITIALIZE WS-CONTADOR.
           OPEN INPUT ENTRADA.
           IF WS-STATUS NOT EQUAL 00
              DISPLAY 'ERRO AO ABRIR O ARQUIVO!'
              DISPLAY 'STATUS = ' WS-STATUS
              STOP RUN
           END-IF.
           PERFORM 1500-READ.
           IF WS-FLAG EQUAL 'SIM'
              DISPLAY 'ARQUIVO VAZIO'
           ELSE
              DISPLAY 'ARQUIVO OK!'
           END-IF.
      *
       1500-READ.
           READ ENTRADA INTO WS-REGISTRO AT END MOVE 'SIM' TO WS-FLAG.
      *
       2000-PERFORM.
           DISPLAY 'CODIGO DO CLIENTE: ' WS-CODIGO.
           DISPLAY 'NOME DO CLIENTE ' WS-NOME.
           MOVE 'SIM' TO WS-FLAG.
      *
       3000-END.
           CLOSE ENTRADA.


ENTRADA
0001NOME-DO-CLIENTE-01------------AC
0002NOME-DO-CLIENTE-02------------AL
0003NOME-DO-CLIENTE-03------------AP
0004NOME-DO-CLIENTE-04------------AM
0005NOME-DO-CLIENTE-05------------BA
0006NOME-DO-CLIENTE-06------------CE
0007NOME-DO-CLIENTE-07------------DF
0008NOME-DO-CLIENTE-08------------ES
0009NOME-DO-CLIENTE-09------------GO
0010NOME-DO-CLIENTE-10------------MA
0011NOME-DO-CLIENTE-11------------MT
0012NOME-DO-CLIENTE-12------------MS
0013NOME-DO-CLIENTE-13------------MG
0014NOME-DO-CLIENTE-14------------PA
0015NOME-DO-CLIENTE-15------------PB
0016NOME-DO-CLIENTE-16------------PR
0017NOME-DO-CLIENTE-17------------PE
0018NOME-DO-CLIENTE-18------------PI
0019NOME-DO-CLIENTE-19------------RJ
0020NOME-DO-CLIENTE-20------------RN
0021NOME-DO-CLIENTE-21------------RS
0022NOME-DO-CLIENTE-22------------RO
0023NOME-DO-CLIENTE-23------------RR
0024NOME-DO-CLIENTE-24------------SC
0025NOME-DO-CLIENTE-25------------SP
0026NOME-DO-CLIENTE-26------------SE
0027NOME-DO-CLIENTE-27------------TO
GUI1504
 
Posts: 28
Joined: Fri Sep 03, 2010 10:40 pm
Location: Campinas, SP - Brazil
Has thanked: 0 time
Been thanked: 0 time

Re: Problem with OPEN/READ a table

Postby dick scherrer » Fri Oct 01, 2010 1:39 am

Hello,

As you were told in another of your topics:
If you continue to use inconsistent/incorrect jcl, there will be lots more problems that cannot be fixed in the code. . .


Until you fix the jcl, you will continue to have problems. . . :(
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: Problem with OPEN/READ a table

Postby NicC » Fri Oct 01, 2010 3:37 am

Suggest you read the JCL users manual. But a quick summary of overrides to a procedure (in this case IGYWCG):

Overrides default to the first step.
If a step is provided on the override all subsequent overrides default to the specified step until another step is specified.
Overrides must be in the sequence of step/DD as specified in the JCL.
If a DD does not exist the override must follow all other overrides for that step.

CHECK YOUR JCL AND OVERRIDES AND THE MESSAGES FROM THE SYSTEM!
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Problem with OPEN/READ a table

Postby NicC » Fri Oct 01, 2010 1:56 pm

I copied your source code and data to my machine and compiled the program. I then ran it WITH THE CORRECT JCL and got SYSOUT. Suggest you correct your JCL in line with recommendations made to you all over the internet and then run the program. You can then start debugging it!
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post