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 dynamic array in cobol? what is the difference b/w array and table in cobol?

2 Answers  


how do you reference the variable unblock file formats from cobol programs

0 Answers  


What is the difference between write & move in COBOL?

3 Answers   CSC, HHB,


What is the significance of the PROGRAM-ID paragraph? If this name doesnt match with the name of the COBOL program, does it make a difference? Is the name specified in the PROGRAM-ID paragraph used as a name for the load module or any such thing?

4 Answers   IBM,


where will we code call by content and call by reference dude pls reply soon ?

2 Answers  






which one is better among static call and dynamic call?

3 Answers  


What is the difference between comp and comp-3 usage?

0 Answers  


Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks

0 Answers  


i friends greetings to the day...!!! I face a quation like"while runnig the programe every day i have to access the previous day updates only...!! Ex:- Let last day 100 customers took bank account i have to select those customers only.."

4 Answers   CSC,


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 ?

0 Answers  


Discuss about changing dataset name in proc.

0 Answers  


what are the isolation levels and where we use it in the db2 program

3 Answers   TCS,


Categories