Program to find the smallest quotation for the given item.
Identification Division. Program-Id. Quotations. Environment Division. Input-output section. File-control. Select Infile assign to disk Organization is line sequential. Select outfile1 assign to disk Organization is line sequential. Select outfile2 assign to disk Organization is line sequential. Select sortfile assign to disk. Data Division. File Section. Fd infile Label records are standard Value of File-id is"Ass11.dat". 01 in-rec. 02 Filler pic xx. 02 Icode pic x(5). 02 Filler pic xx. 02 SupName pic x(20). 02 Filler pic xx. 02 Price pic 9(4)v99. Fd outfile1 Label Records are standard Value of File-id is"ass11.srt". 01 Out1-rec. 02 Filler pic xx. 02 Icode pic x(5). 02 Filler pic xx. 02 Supname pic x(20). 02 Filler pic xx. 02 Price pic 9(4)v99. Fd outfile2 Label records are standard Value of File-Id is"ass11.res". 01 Out-rec. 02 Filler pic xx. 02 Icode pic x(5). 02 Filler pic xx. 02 Supname pic x(20). 02 Filler pic xx. 02 Price pic zzz9.99. SD sortfile. 01 sort-rec. 02 Filler pic xx. 02 Icode pic x(5). 02 Filler pic xx. 02 Supname pic x(20). 02 Filler pic xx. 02 Price pic 9(4)v99. Working-Storage Section. 01 Head pic x(38) Value all spaces. 01 Head1 pic x(38) Value all "~". 01 Head2 pic x(38) Value " List of all the Quotations". 01 Head3. 02 Filler pic x(7) Value " Item". 02 Filler pic x(22) Value " Supplier Name". 02 Filler pic x(9) Value " Price". 01 Temp-rec. 02 Filler pic xx. 02 Icode pic x(5). 02 Filler pic xx. 02 Supname pic x(20). 02 Filler pic xx. 02 Price pic 9(4)v99. 77 EOF pic x value"N". 77 n pic 99 value 1. Procedure division. Main-Para. Sort sortfile on Ascending Key Icode of Sort-rec Ascending Key Price of Sort-rec Using infile giving outfile1. Open input outfile1 output outfile2. Read outfile1 at End Move "Y" to EOF. Write out-rec from Head. Write out-rec from Head2. Write out-rec from Head. Write out-rec from Head1. Write out-rec from Head3. Write out-rec from Head1. Move spaces to out-rec. Perform Process-para until EOF = "Y". Write out-rec from Head1. Move "The total No. of quotations received" to out-rec. Write out-rec. Move spaces to out-rec. Move n to price of out-rec. Write out-rec. Close outfile1 outfile2. Stop Run. Process-para. Compute n = n + 1. If (Icode of out1-rec not = Icode of temp-rec) Move corr out1-rec to out-rec write out-rec. Move out1-rec to temp-rec. Read outfile1 at end move "Y" to EOF.