increase working storage Variable length in cobol

All sort of Mainframes Interview Questions.
Post Reply
Karthik G
New Member
Posts: 9
Joined: Wed Sep 03, 2014 4:37 pm
India

increase working storage Variable length in cobol

Post by Karthik G »

Hi

This was asked in the interview, "If I increase working storage Variable length in cobol, What need to change in jcl".

My answer was there should not be any change. Interviewer said, "Think again". But didn't really told me the answer. What's your answer, please let me know.
User avatar
zum13
Registered Member
Posts: 89
Joined: Thu May 04, 2023 12:58 am

Re: increase working storage Variable length in cobol

Post by zum13 »

Hello.

Well, I'm presuming that the variable they are talking about changing would affect the length of a record, so the LRECL of the file would have to be altered accordingly.
Karthik G
New Member
Posts: 9
Joined: Wed Sep 03, 2014 4:37 pm
India

Re: increase working storage Variable length in cobol

Post by Karthik G »

But in that it should be part of output variable definitions also, not only of working-storage, right?
User avatar
zum13
Registered Member
Posts: 89
Joined: Thu May 04, 2023 12:58 am

Re: increase working storage Variable length in cobol

Post by zum13 »

One of the common practices I've seen repeatedly is the situation where the record declaration in the FILE SECTION is essentially treated as a dummy that simply defines the record length. The declarations of the individual fields in the record are defined within WORKING STORAGE (usually as a copybook) and the record is written from there. For example,

Code: Select all

       FD  OUTPUT-FILE
           RECORDING MODE V
           BLOCK CONTAINS 0 RECORDS
           LABEL RECORDS ARE STANDARD
           RECORD IS VARYING IN SIZE FROM 1 TO 200
                  DEPENDING ON WA-RECORD-LENGTH.

       01  OUTPUT-RECORD               PIC X(200).
Records would then be written from WORKING STORAGE using the "WRITE record FROM ws-field" form of the WRITE statement.

Since the question was about what effect changing a variable definition would have on JCL and "none" is the wrong answer, then I assume that the change being referenced would be one that affects the record length. If the program is coded as above, then four changes are needed:
  • the change to the referenced variable in the WORKING STORAGE record definition;
  • the "RECORD IS VARYING IN SIZE" clause to specify the new maximum record length;
  • the "dummy" record definition in the FILE SECTION;
  • the LRECL of the file.
If the individual fields in the record are defined in the FILE SECTION then amending the record layout to extend the record will automatically change the record length (and the "WRITE record" form of the WRITE statement will be in use). For a fixed length record the "RECORD IS VARYING IN SIZE" would not be present.

Of course, if you were amending the record to use some existing FILLER space that would not affect the record length, then yes, there would be no changes to JCL required.
Karthik G
New Member
Posts: 9
Joined: Wed Sep 03, 2014 4:37 pm
India

Re: increase working storage Variable length in cobol

Post by Karthik G »

Thanks zum13 for that explanation. This is really helpful. If this is the situation then yes, a change in working-storage can make a difference in the LRECL, not sure if this is what interviewer has thought of. If yes, should have given some background of the question.
User avatar
zum13
Registered Member
Posts: 89
Joined: Thu May 04, 2023 12:58 am

Re: increase working storage Variable length in cobol

Post by zum13 »

In an interview situation, there's no harm in asking the interviewer questions. If that was the extent of the question that they asked, then my response would be "it depends on what the variable is used for" and then ask what context the variable is being used in. Sometimes, the reason for asking a question is to make sure the right question is asked in response.
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 “Interview Questions.”