i have a file which contains records like
i want to display these records in reverse order like
please give me the cobol code (do not sort the records)
Declare table , and a index variable in the working storage section.
perform para1 thru para1-exit until end-of-file.
perform display-para thru display-para-exit.
read file1 into ws-file1
set index-diff to index
not at end
move ws-file1-num to table-num(index)
set index up by 1
subtract 1 from index-diff.
perform until index-diff = 0
set index-diff down by 1
01 WS-COUNT PIC 9(4) VALUE ZEROS.
01 EOF PIC X(1) VALUE 'N'.
05 ARREC OCCURS 1 TO 50 TIMES DEPENDING ON WS-COUNT.
10 AR-EMP-ID PIC X(5).
10 AR-EMP-NAME PIC X(10).
PERFORM MOVE-RECORD UNTIL EOF = 'Y'.
PERFORM PARA1 UNTIL WS-COUNT = ZEROS
READ INFILE AT END MOVE 'Y' TO EOF
NOT AT END
MOVE INREC TO ARREC(WS-COUNT)
ADD 1 TO WS-COUNT.
MOVE ARREC(WS-COUNT) TO OUTREC
SUBTRACT 1 FROM WS-COUNT.
I hv ten records in ps file and i hv say some 15 records in
vsam file .i hv empno and age in ps file n
empno,empname,dept n desig in vsam file. i hv 2 read the ps
file n check wid matching empno in vsam file and then
insert all fields from ps and vsam into db2 table....plz
help in writin the procedure division
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):
MOVE 0 TO I.
OPEN INPUT FILE-1.
IF CHECK-KEY1 > 0
DISPLAY "OPEN ERROR FOR FILE-1, CODE IS:" CHECK-KEY1
OPEN EXTEND NEWFILE-1
IF CHECK-KEY3 > 0
DISPLAY "OPEN ERROR FOR NEWFILE-1 COD IS" CHECK-KEY3
PERFORM READ-PARA THRU EXIT-PARA UNTIL EOF-REC = 'YES'.
DISPLAY " FINALLY OUT OF LOOP"
ADD 1 TO I
AT END MOVE 'YES' TO EOF-REC
IF I > 3 AND < 10
DISPLAY "NOT IN RANGE"
WRITE NEW-REC FROM FILE1-REC.