Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Length Record Size 1

Status
Not open for further replies.
M

Member 310024

Guest
Does the FD clause of a file containing variable length records, have a facility that puts the size of the current record into a working-storage field? (for example, a bit like the file-status goes into a nominated working-storage field.)
 
When using "record is varying in size from x1 to x2 characters depending on data-name-y" when you read the record data-name-y will contain the number of characters read.

If you tell us which COBOL vendor/version you are using we may point you to the correct manual

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Thanks for responding.
Actually the COBOL vendor/version is a bit of a sore point with me.
I personally purchased Microfocus Object COBOL V4.0 (for $2000 Australian dollars!) to use on my then NT 3.51 platform. It came with a red security key which had to be plugged into the parallel port to enable it to be used. It was great - no 640K barrier - my working-storage could be bigger, no problems with calling subprograms. Then Microsoft upgraded to NT4.0 and the security key (I presume) wasn't compatible, and I was not able to get an upgraded security key from the company I purchased Object COBOL 4.0 from. The point that makes me sore is that the concept of the security key was an attempt to stop dishonest people, but as is often the case, honsest people get caught up in the war, and end up loosing out!

So anyway, I went back to using Microsoft COBOL V4.5 for DOS, which of course now leaves me in the 21st century, using XP (command line mode) ... and still having a 640K barrier to contend with.
However, I've learnt to live with it.

I actually use a hybrid system of PC & mainframe.
I develop my code on the PC because I can use the Microsoft M.EXE text editor which is nothing short of brilliant because compared to the ISPF editor and any other PC editor I have used, offers fantastic cost savings because of the features it has, and it's ease of use.
Like I presume all programmers have done, I have developed my own code generators and assortment of facilities on the PC to enable me to produce code quicker.
I FTP my code to the mainframe and the rest ... is history.

I've always tried to avoid variable length record files, because I always seemed to have trouble with them.
However, this time, there was no getting out of it.

Anyway I have just got this code to work :-

\code
FD F001-FILE
RECORD IS VARYING IN SIZE
DEPENDING ON WI-F001-RECORD-SIZE
RECORDING MODE IS V.
01 F001-RECORD.
03 F001-TYPE PIC X(04).
etc

WORKING-STORAGE SECTION.
01 WI-F001-RECORD-SIZE PIC 9(04) COMP.
01 WW-F001-RECORD-SIZE PIC 9(04).
\END-CODE

I appreciate your help, as per star!

 
Like Fredericofonseca suggested, it might be desirable to limit the maximum record size as well;

Code:
FD  F001-FILE
    RECORD IS VARYING IN SIZE FROM 1 TO [nnnn..] CHARACTERS
        DEPENDING ON WI-F001-RECORD-SIZE
    RECORDING MODE IS V.

Replace [nnnn..] with a value that is greater than than the size of the largest record.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top