How to expand field length in a COBOL program?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Vicky Malhotra
Registered Member
Posts: 11
Joined: Fri Jan 17, 2014 6:57 pm

How to expand field length in a COBOL program?

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1900
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”