can we read in input the file with a variable length ?
please , how ..could you help me ?

Answer Posted / kotagiriramachandra

we can read an input rec of variable length.For that u need
to declare
01 main-rec
05 rec-data pic x(m) <== m should be max length of rec
specified in file declaration(avg length, max length).
05 rec-len pic s9(4) comp
precedure div...
.
.
.
read infile at end...
else move in-rec into main-rec.
I think in this way we can do.If i'm wrong plz let me know..

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between array and sub-script ?

1381


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

860


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1412


) How do u handle errors in BMS macro?

1625


What is perform what is varying?

916


example for sub strings ? and refernce modifications whit output pls

2068


In COBOL, what is the different between index and subscript?

951


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

2879


How to know whether the module is dynamical or statistical?

870


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

1079


Why would you use find and get rather than to obtain?

904


What is comp-1 and comp-2?

944


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

2966


Write the code implementing the perform … varying.

822


What kind of error is trapped by on size error option?

960