wirte a pgm in using files in which we hav 10 ,20,30 40...100
records in inputfile and i want them to be send to outputfile
in reverse order.
PLZ HELP ME OUT .........THIS IS A RECENT QUESTION IN IGATE..

Answers were Sorted based on User's Feedback



wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them ..

Answer / quasar chunawala

However, if there are a fixed no. of records, as you have
mentioned in the question - which may not always be the
case with Production Files(They may contain millions of
records), you may follow this approach.

1. Read all the records into a COBOL array(table) A
(1,2,...10).
PERFORM VARYING I FROM 1 BY 1 UNTIL I>10
READ INPUT-FILE
MOVE INPUT-RECORD TO WS-RECORD(I)
END-PERFORM.

2. Print the data from the COBOL Array into Output-file.
PERFORM VARYING I FROM 10 BY -1 UNTIL I<1
WRITE WS-RECORD(I)
END-PERFORM.

Is This Answer Correct ?    5 Yes 1 No

wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them ..

Answer / binary logics

*hival setgt pfrec
90 doueq *on 90 is a indicator for End of file
readp pfrec
write newpfrec
enddo

Is This Answer Correct ?    1 Yes 0 No

wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them ..

Answer / siris

//SYSIN DD *
SORT FIELDS = COPY
OUTREC=(10,100,SEQNUM,4,ZD)
/*
0R
//SYSIN DD *
SORT FIELDS=(100,4,ZD,DESC)
OUT REC=(10,100)
/*

Is This Answer Correct ?    0 Yes 0 No

wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them ..

Answer / quasar chunawala

There is no such facility on Mainframe COBOL to read a
Sequential File(PS), backwards. PS(Physical Sequential)
files are meant to be read in a straight-sequential fashion
record-by-record one at a time, till you reach the Desired
record.

Is This Answer Correct ?    1 Yes 3 No

wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them ..

Answer / adarsh

just sort the input file in descending order..

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More COBOL Interview Questions

What is the local-storage section?

0 Answers  


9(2).99 how many bytes take? Why . consider as a byte?

2 Answers  


what will happen if i give program name and member name as different? program runs successful or w'll abend?

5 Answers   CTS,


01 a pic x(6) value is abcdef 01 b pic x(3) move a to b wht will be the value in b ?

3 Answers   Patni,


2)Where the Plan is located in CICS-DB2?

1 Answers   IBM,






What is amode(31)

0 Answers  


The disposition parameter in the jcl is share ( DISP+SHR ) and the program opens file in extend mode what will happen?

6 Answers   Cognizant,


wht is packed decimal in cobol

2 Answers  


Whats the difference between search & search ALL?

3 Answers   IBM,


If we use GO BACK instead of STOP RUN in cobol?

2 Answers   Temenos,


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

0 Answers  


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

0 Answers  


Categories