How to remove the spaces at end of each record in the
output file Via COBOL program?
note: The file has a VB length

Answers were Sorted based on User's Feedback



How to remove the spaces at end of each record in the output file Via COBOL program? note: The fi..

Answer / rajesh

U can declare a copybook for the output file without spaces
and this will do.

Is This Answer Correct ?    2 Yes 2 No

How to remove the spaces at end of each record in the output file Via COBOL program? note: The fi..

Answer / mvramesh

I will explain this with an example. Lest assume the Maximum record length for VB file is 4000.

For every record you write, Move the actual record length value to RECORD-LENGTH, this would trim off the entire record beyond that length. If the data is populated only till 3000 bytes, move 3000 to RECORD-LENGTH which would trim off the last 1000 bytes.

I hope i answered your question.

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More COBOL Interview Questions

Can we redefine the field of x(200) to less than 200?

0 Answers  


which is better comp or comp-3 in terms of memory utilization?

6 Answers  


I need to compare two VSAM files, both having 'number' as key. If there is a matching record, write the data into another VSAM file. How will it be possible.

1 Answers   DSRC,


a. Can the OPTIONAL clause in COBOL only be coded for input files? b. If it is coded for files opened in OUTPUT, I-O or EXTEND mode, will it give a compilation error? c. If there are no compilation errors and if such files are not coded in the JCL, will the OPEN statement run fine when these files are opened? d. How will a WRITE statement work for the above files?

2 Answers  


what is a load module ?

3 Answers   TCS,






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

11 Answers   IBM,


can we declare occurs in 01 level?

2 Answers   Temenos,


How many times the loop runs here 01 a pic 9(2) value 10. perform para1 a times stop run. para1: move 20 to a.

3 Answers  


s9(18) comp-3:: What is the size of memory it takes internally?

4 Answers  


Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.

0 Answers   IBM,


Explain the configuration section of a cobol program with examples of syntax.

0 Answers  


Can anyone explain me CALL procedure in COBOL.Does it carries similarities like call by reference in C.

1 Answers  


Categories