Page 1 of 1

How to expand field length in a COBOL program?

Posted: Sat Jul 16, 2022 3:04 pm
by Vicky Malhotra
Hi,

A COBOL program has a file in which for two fields I want to increase the size of them. One is of length 5 and needs to change to 10 while other is of length 9 and should be of 11 now. With length 5 is NUM to CHAR, second is NUM to NUM.

Can I just do it COBOL program itself than using JCL with sort or some other utility?

Doing it like:

Code: Select all

Var1 pic 9(5)
and define a new field as

Code: Select all

Var2 as pic X(10)
in a different file say FILE2 and now we move Var1 to Var2. Write FILE2 instead of FILE1?

Is it right or are there ways to do it?

Re: How to expand field length in a COBOL program?

Posted: Sat Jul 16, 2022 9:24 pm
by Robert Sample
Changing record lengths in a data set is not merely changing the COBOL source code and recompiling the program. You also have to consider the context of the data set -- where does it come from? where is it used? Other programs / utilities / JCL may require modification to support the new record length. Is the data set transferred to another platform? If so, the programs on that platform may also need to be updated for the new record length.

The preferred way to make such a change would be to analyze the data set to determine the impact of the change, coordinate all systems / programs using the data set so the new record length is implemented at a given point in time, and possibly converting existing data sets (such as backups) to use the new record length. Actually changing the variable lengths in the source code is often the smallest part of the conversion effort.