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

What are the rules of the move verb?

0 Answers  


How can you display the SPOOL information ?

2 Answers  


.How to add one input & one Out file in existing cobol program. how approach tell me step by step.

2 Answers   Syntel,


Whtz the specialty of 77 level number ?

2 Answers   Infosys,


I have a PS file and I would like to manually insert the binary values (like a COMP format) into the file. How can i do that? the way do in COMP-3 format.. suppose i want to insert -12345 in to file in comp-3 format. simply we can open a file in edit mode and do HEX-ON and insert the value . SEE BELOW-- 135 24D in 3 bytes - this will be COMP-3 presenatation of -12345.

1 Answers  






In COBOL CALL-CALLING,if a program A is calling 3 sub- programs, dynamically, then it is said sub-programs will always will always in Initial Mode. My question is : Do we need to code CANCEL or (IS INITIAL) for dynamically called sub-programs or it is the property of Dynamically called pgms so every time sub-pgms are called they will be in initial mode. ***This question is only Dynamic call****, Please reply. Thank you in advance.

4 Answers   Wipro,


How can i write a comp-3 variable into a sequential file should i declara the field in the file description as comp- 3?

1 Answers  


can we write paragraph in area B .....

4 Answers   L&T,


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

2 Answers  


Write a program to explain size error.

0 Answers  


what is the difference between perform varying and perform until

4 Answers   TCS,


What is sqlca and why is it needed in any cobol-db2 program?

1 Answers  


Categories