View previous topic :: View next topic
|
Author |
Message |
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
Hi,
I am writting COBOL program of file and displaying that file contents on screen. for this I wrote JCL stmt . Prog is executing properly but o/p it is displaying is not complete. It means file contains records like,
abcdefghijklmnopqrstuvwxyz
12345678901234567890123
O/P on screen is :
abcdefghijklmnopqrstuvwxyz
It is not displaying complete o/p . I have mentioned EOF also.
Regards,
Nutan |
|
Back to top |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
HI ,
I tried using 2 read stmts also. But it is noe displaying 2nd o/p .
COBOL prog is :
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. CHINU .
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO IN1
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INFILE
LABEL RECORD ARE STANDARD
VALUE OF FILE-ID IS 'IN1.TXT'.
01 IN-REC PIC X(80).
WORKING-STORAGE SECTION.
01 EOF PIC X VALUE IS 'N'.
01 NUM PIC X(80).
PROCEDURE DIVISION.
OPEN INPUT INFILE.
READ INFILE AT END MOVE 'Y' TO EOF.
MOVE IN-REC TO NUM.
DISPLAY NUM.
STOP RUN.
|
JCL stmt is :
Code: |
//JOB1 JOB
//STEP1 EXEC PGM=CHINU
//IN1 DD DSN=IN1.TXT,DISP=(SHR,CATLG,CATLG)
|
Regards,
Nutan |
|
Back to top |
|
|
MichaelKBS
New User
Joined: 10 Jan 2006 Posts: 24 Location: Germany
|
|
|
|
Where is the loop in your program?
You have to insert a PERFORM UNTIL EOF - Routine to read and display all of the Input. |
|
Back to top |
|
|
Mane Sagar
New User
Joined: 12 Jul 2005 Posts: 41 Location: mumbai
|
|
|
|
Hi Nutan,
You can write a process para UNTIL EOF after the READ para and then again at the end in the process para can read the input file again.
This will make ur program to excute till the EOF.
Rgds,
Sagar |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
You have to add one loop in your procedure division like
OPEN INPUT INFILE.
PERFORM PARA1 UNTIL EOF = 'Y'.
PARA1.
READ INFILE AT END MOVE 'Y' TO EOF GOTO CLOSEPARA.
MOVE INREC TO NUM.
DISPALY NUM.
CLOSEPARA.
CLOSE INFILE.
STOP RUN. |
|
Back to top |
|
|
nutan
New User
Joined: 27 Jan 2006 Posts: 26
|
|
|
|
HI,
Thanks for your support. Only the thing I forgot is to add a loop which I have added into my program and now able to execute my program .
Thanks a lot .
Regards,
Nutan |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
nutan, it is not the purpose of these forums to assist you in debugging and/or testing your code. That is for you to take care of first. Please do not continue to abuse the Forums in this manner.
Also, please use the CODE tags around your code to make it easier to read and understand. |
|
Back to top |
|
|
pa1chandak Currently Banned New User
Joined: 31 Jan 2006 Posts: 55
|
|
|
|
hi nutan
the only problem is , you dint mention the NOT AT END CONDITION.
WHEN USING AT END do give NOT AT END.AND DONT PUT DOT
THAT IS TERMINATOR IN BETWEEN OK.
LIKE
OPEN INPUT INFILE.
READ INFILE AT END MOVE 'Y' TO EOF
NOT AT END
MOVE IN-REC TO NUM
DISPLAY NUM
END READ.
STOP RUN.
THIS WILL WORK SURELY
OK
PAWAN C. |
|
Back to top |
|
|
|