I have PS flat file with 14 records. I want to read from
4th to 9th record and want to write those 6 records (4th
record to 9th record) to another PS file (output file).
there is no key defined in the input file. I just want read
a certain Consecutive records. can any one please give me
the procedure division Coding for this. I have coded the
below coding but the READ-PARA is performing only 1 time
even though I have 14 records in my input file (i.e FILE-1):
PROCEDURE DIVISION.
A000-SECTION.
MOVE 0 TO I.
OPEN INPUT FILE-1.
IF CHECK-KEY1 > 0
DISPLAY "OPEN ERROR FOR FILE-1, CODE IS:" CHECK-KEY1
END-IF.
OPEN EXTEND NEWFILE-1
IF CHECK-KEY3 > 0
DISPLAY "OPEN ERROR FOR NEWFILE-1 COD IS" CHECK-KEY3
END-IF.
PERFORM READ-PARA THRU EXIT-PARA UNTIL EOF-REC = 'YES'.
DISPLAY " FINALLY OUT OF LOOP"
CLOSE FILE-1
CLOSE NEWFILE-1
STOP RUN.
READ-PARA.
ADD 1 TO I
READ FILE-1
AT END MOVE 'YES' TO EOF-REC
IF I > 3 AND < 10
PERFORM WRITE-PARA
ELSE
DISPLAY "NOT IN RANGE"
END-IF.
EXIT-PARA.
EXIT.
WRITE-PARA.
WRITE NEW-REC FROM FILE1-REC.
Answer Posted / mike
you are missing a period after AT END MOVE 'YES' TO EOF-REC
The if statement IF I > 3 and < 10 is considered part of
the AT END condition.
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
Define static linking and dynamic linking.
What are the rules of the move verb?
How to know whether the module is dynamical or statistical?
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
How are the next sentence and continue different from each other?
In COBOL programming, what is PERFORM? What is VARYING?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
how can i see junk values in dclgen or in hostvariable of comp ?
What do you understand by psb and acb?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
Can a Search can be done on a table with or without Index?
Name the divisions, which are available in a cobol program?