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
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 |
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 |
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 |
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 |
What is link edit in cobol?
in cobol perform stmt whether it first checks the condition or not
consider the fallowing 77 stat pic 9. 88 male value 1,2,3. 88 female value 4 through7. what will be the value of stat a) set male to true. b) set female to true.
what will happen if i give program name and member name as different? program runs successful or w'll abend?
where did you see the information regarding abend codes in jcl?
can we use COPY statement in w-s section? how?
Differentiate COBOL and COBOL-II?
Which Search verb is equivalent to PERFORM…VARYING?
how many bytes does s9(15) occupy in comp1 comp2 and comp3 ?
how many subpgms we can use in a main pgm ? how do u link sub pgm to main pgm ? how can i use the parameters declared in main pgm to sub pgm ?
What is the maximum size of a 01 level item in COBOL I? in COBOL II?
when COMP-3 is preferrable?