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 |
Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?
where do we use dyanamic call ? and where do we use static call pls give any example pls ?
what are the working storage fields in BMS macro?
IF there 5 to 6 files in a JCL and there is some space abends, how can we identify which file has space abend and what can be done to get off that abend or rectify that abend.
What are ISOLATION LEVELS? Where do we need to specify them in compiling JCL (Exactly which statement and what is syntax for it)?
Difference between next and continue clause
is this below syntax correct? CALL 'subprg' using A,B Please help
What are the different rules to perform a Search?
what is the difference between external and global variables?
What is the significance of 'above the line' and 'below the line'?
how many bytes does a s9(12)COMP-4 field occupy?? a.2 b.4 c.8 d.1 ans with reason please
What is an in-line perform ?