I have 100 records in a file.. i want to sort the records from
5 to 5o... give the syntax...

Answers were Sorted based on User's Feedback



I have 100 records in a file.. i want to sort the records from 5 to 5o... give the syntax.....

Answer / seema dawlekar

This can be done in two steps
in the step1 copy the the selective records by giving the
syntax as
skiprec = 4 -
stopaft = 50

this will copy only the selected records, now in the step2
we can perform sort
syntax is
sort fields=(starting position,length,type,A/D)
A--ascending and D--descending order

correct me if I am wrong

Is This Answer Correct ?    17 Yes 0 No

I have 100 records in a file.. i want to sort the records from 5 to 5o... give the syntax.....

Answer / anand

Follow the workaround below,
1.split the file into 3 files using IDCAMS
file1 1-4
file2 5-50
file3 51-100

2.Sort the mid file file2.

3.Finally merge all the 3 files using concatenation.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More COBOL Interview Questions

Name the divisions in a COBOL program ?

7 Answers  


what is the difference between start and startbr?

2 Answers  


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

0 Answers  


Can we use icetool in cobol program?

3 Answers  


How to read the last 100 records from a COBOL file. The file contains N number of records.

11 Answers   IBM,






If i have a variable A pic 9(2) value 10 Compute A = a - 100 what will be the value of A and will there be any error becoz of the Negative value

3 Answers   CTS,


which generation language is cobol

4 Answers   Kanbay,


9(2).99 how many bytes take? Why . consider as a byte?

2 Answers  


PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B>2 AFTER C FROM 2 BY -1 UNTIL C<2 How many times the paragraph ACCUMULATE-TOTALS would be exicuted?

5 Answers   TCS,


what is soc7 abend?how u can trace it?

4 Answers   Accenture,


What is reference modification? What is UNION in sql and syntax? What is the difference between GDGS and VSAM? Which is prefer one? What is processing groups in endevor?

1 Answers   Kuwait Oil Company,


How many bytes will be allocated for the following record description entries? 01 REC-A. 05 A PIC S9(4). 05 B PIC XXXBXXX. 05 C PIC ____9.99. 05 D PIC S9(5) COMP-3. 05 E PIC 9(3) COMP.

16 Answers   IBM, TCS,


Categories