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 the use of outrecord?
How can we increase the size of an existing PDS to include more no. of modules. I tried the answer posted by Jagan(TSO PDS 'pds name') but did not find it working. The answer posted by kamal i know very well. Please suggest me a answer so that we don't need to delete the existing PDS and still we can change the size as well.
How to resolve the soc4 & soc7 other than following answers. Soc4 can resolved using mispleed dd name and dd name is not matching with file and soc7 check the sysdump and copy the offest address then correct it in the program.
10 Answers ADP, Amdocs, Cap Gemini, Keane India Ltd, Super Value, TCS,
what is soc7 abend?how u can trace it?
I have a COBOL main program which is calling sub program, the number of calling parameters used in main program are 4 whereas in sub program it's 5. Sub program is passing 5 parameters back to main program Will there be any compilation error? Or main program parameters displays junk values?
What are ISOLATION LEVELS? Where do we need to specify them in compiling JCL (Exactly which statement and what is syntax for it)?
if someone is using my file,how can i find which user id is using?
Explain the configuration section of a cobol program with examples of syntax.
Difference between ps, esds
How include time & date in the report generation in cobol programing?
01 NAME1 PIC X(13) VALUE "COBOL PROGRAMMING". 01 NAME2 PIC X(13). now I want to display the value of NAME1 in reverse order i.e value should be displayed as "GNIMMARGORP LOBOC" HOW can I do that ??? please let me know if any one knows it.
Consider the following: 77 W-NUM PIC 9 VALUE 0 ------ MOVE 1 TO W-NUM PERFORM PARA-X UNTIL W-NUM > 9. ------ PARA-X ADD 1 TO W-NUM How many times PARA-X is executed ?