How to read,write records form bottom from a sequential file in cobol?

Showing Answers 1 - 14 of 14 Answers

anurag verma

  • Apr 12th, 2006
 

hi,

you can define the file as

file

  Was this answer useful?  Yes

anurag verma

  • Apr 12th, 2006
 

hi,

you can define the file as

FIL

  Was this answer useful?  Yes

anurag verma

  • Apr 12th, 2006
 

hi,

you can define the file as

READ <FILE-NAME> PRIOR RECORD.

had this been next record, you could have written

READ <FILE-NAME> NEXT RECORD.

Thank,

Anurag

  Was this answer useful?  Yes

rathi

  • Apr 27th, 2006
 

In the PD we can code as READ EOF.

  Was this answer useful?  Yes

Dinesh Shukla

  • Jul 21st, 2006
 

STEP1 start file-name key is (high val shoul use)

step 2 read prior record.

  Was this answer useful?  Yes

Mick Russell

  • Nov 28th, 2006
 

As per Dinesh regarding high-values in your access key but in Acucobol & few other flavours:READ record PREVIOUS -or- READ record BACKWARDS

  Was this answer useful?  Yes

P.Karthikkumar

  • Jan 17th, 2007
 

Hi,

 It is possible through jcl. For example if the input file contains 80 record length then

In sort, INREC=(1:1,80,81:SEQNUM,6,ZD),SORT FIELDS=(81,6,ZD,D),OUTREC=(1:1,80)

 1) Using inrec we need to generate the sequential number starts from position 81.

     For example

           1) First 1-80 bytes contains the actual record and from position 81 we need to generate sequential number using inrec i.e 000100, 000200 upto 50 records.  

           2) After generating all those numbers, sort we takes place in descending order.

           3) Using outrec we have to move the first 80 bytes to the output file.

After doing this sort in first step in jcl, you can read the output file in second step

and write it in the output file generated in second step.

Thanks

Karthikkumar.P

vijay

  • Jul 31st, 2011
 

------>Just read all records into an array....
------>Then read records in reverse order by using subscript or index from array....
------>Now write records into new file....

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions