Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

can we read records in a file from botom to top. if
possible how can we read

Answer Posted / ch. ranveer singh gurjar

New update..by Ch. Ranveer Singh(ACS A XEROX)
WE CAN TAKE INPUT AND OUT PUT FILE
AS

INPUT-
10
20
30

OUTPUT-
30
20
10

USE THIS PROGRAM


IDENTIFICATION DIVISION.
PROGRAM-ID. 'OCCURS'.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO DD1.
SELECT OUTFILE ASSIGN TO DD2.
DATA DIVISION.
FILE SECTION.
FD INFILE.
01 INREC.
05 IN-EMP-ID PIC X(5).
05 IN-EMP-NAME PIC X(10).
05 FILLER PIC X(65).
FD OUTFILE.
01 OUTREC.
05 OUT-EMP-ID PIC X(5).
05 OUT-EMP-NAME PIC X(10).
05 FILLER PIC X(65).
WORKING-STORAGE SECTION.
01 WS-COUNT PIC 9(4).
01 EOF PIC X(1) VALUE 'N'.
01 ARRAY1.
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).
PROCEDURE DIVISION.
MOVE 1 TO WS-COUNT.
OPEN INPUT INFILE.
OPEN OUTPUT OUTFILE.
PERFORM MOVE-RECORD UNTIL EOF = 'Y'.
PERFORM PARA1 UNTIL WS-COUNT = ZEROS
CLOSE INFILE.
CLOSE OUTFILE.
STOP RUN.
MOVE-RECORD.
READ INFILE AT END MOVE 'Y' TO EOF
NOT AT END
MOVE INREC TO ARREC(WS-COUNT)
ADD 1 TO WS-COUNT.
PARA1.
MOVE ARREC(WS-COUNT) TO OUTREC
WRITE OUTREC
SUBTRACT 1 FROM WS-COUN

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between comp and comp-3?

1130


Write the code to count the sum of n natural numbers.

1141


how do you define single dimensional array and multidimensional array in your cobol?

1044


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

3205


Can we change the password using ALTER? anyone tried and changed?

1948


how do you reference the rrds file formats from cobol programs

1493


What is cobol?

1190


Which Search verb is equivalent to PERFORM…VARYING?

999


How do u write test cases?

2011


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

5313


what happens if parmparameter passes zero bytes to the program

2081


What is link edit in cobol?

1148


write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

1169


How can you get the ksds file records into your cobol program?

1025


IF I mention stop run in CICS what happens?

2303