View previous topic :: View next topic |
Author |
Message |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Tue Feb 21, 2006 9:04 am Post subject: Doubt on VB file. |
|
|
Hi,
In one of the programs at our shop, I've found the following COBOL code. If you look at the code the declared table does not have any ODO clause. The FD entry does not have any from integer-1 to interger-2. There are no multiple 01 level entries. The only things are RECORDING MODE IS V & RECORD IS VARYING in FD section that tell us that this is going to be a VB file. How and why this is considered as Variable block file I am not able to understand.
Code: |
FD O-OUTPUT-FILE
RECORDING MODE IS V
RECORD IS VARYING
BLOCK CONTAINS 0 RECORDS
LABEL RECORD ARE STANDARD
DATA RECORD IS O-OUTPUT-REC.
01 O-OUTPUT-REC PIC X(352).
.
.
.
01 W-XX-XXXXIG-RECORD.
05 W-XX-XXX-YR-NBR PIC X(04).
05 W-XX-XXXXG-XXX-NO PIC X(02).
05 W-XX-XXXXXT-CD PIC X(03).
05 W-XX-XXG-ID PIC X(06).
05 W-XX-XXXOC-XXX-CD PIC X(06).
05 W-XX-XXXXET-XXXXXXX PIC 9(10).
05 W-XX-XXG-XXXC PIC X(26).
05 W-XX-XXXR-XXXV-IND PIC X(01).
05 W-XX-XXXXH-XXXXL PIC X(07).
05 W-XX-XXC-XXXXS OCCURS 5 TIMES
INDEXED BY XXX-XXXEX.
10 W-XX-XXC-XD PIC 9(11).
10 W-XX-XXC-XXC-XD PIC 9(05).
10 W-XX-XXC-XXT-XXD PIC X(01).
05 W-XX-XXT-XXT PIC 9(02).
05 W-XX-XXT-XXXXXG.
10 W-XX-XXX-XD OCCURS 50 TIMES
INDEXED BY XXX-XXEXX
PIC X(04).
.
.
.
PROCEDURE DIVISION.
.
.
.
P8100-WRITE-OUTPUT.
WRITE O-OUTPUT-REC FROM W-XX-XXXXIG-RECORD.
|
I referred to the link provided by Kolusu after searching the forum but could not make it out why it is like that. I am interested more on the point "If you omit integer-1 and integer-2, the maximum record length is determined to be the size of the largest level-01 record description entry associated with the file." So, as per this point 356 (352+4) is the max. length of file. But still why it is called a variable block file?
Sorry for posting such a big query
Please explain. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Tue Feb 21, 2006 9:30 am Post subject: |
|
|
MF, you need to look at the files written by this program and determine whether they actually vary in size. If they do not, then you may be able to modify the program so that they do.
The alternative is to define them as fixed format.
It's your shop. You need to keep it tidy. _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Tue Feb 21, 2006 9:47 am Post subject: |
|
|
Mf_user,
The file being created in your program is indeed a variable block file. Look at the following declaration
Code: |
10 W-XX-XXX-XD OCCURS 50 TIMES
INDEXED BY XXX-XXEXX
PIC X(04).
|
Your file can have a max length of 352 and min of 1 character.
for ex:
I can only populate 2 occurrance of W-XX-XXX-XD and there by creating a record of 161 bytes.
simlarly I can create another record with 10 occurance of W-XX-XXX-XD and create a record of 193 bytes.
Whenever you create a Variable record you populate the length field in your pgm. In the above cases you populate it with 161 and 193 respectively.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Tue Feb 21, 2006 10:39 am Post subject: |
|
|
Mervyn, I need not to change the program. Because, as per Kolusu's view it must be correct and we are seeing different length records in the output dataset.
Ok Kolusu. So, it is not necessary to have a ODO along with occurs always inorder to create a VB file. This is new to me. May I ask you if there would be any similar situation where we will be creating the VB file?
Please give some more inputs. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
 |
|
|