Read RDW Values of a VB file.
Read RDW Values of a VB file.
Hi,
I have file which is varuiable-blocked (VB) file. It's LRECL is 3000. In this, first record is of length is 100 bytes, 2nd, 5th record length is 300 bytes etc.
How to identify the length of the each Record in that VB file using COBOL? Is it possible to read the file using COBOL and get the record length? Can there be an alternate solution too?
I have file which is varuiable-blocked (VB) file. It's LRECL is 3000. In this, first record is of length is 100 bytes, 2nd, 5th record length is 300 bytes etc.
How to identify the length of the each Record in that VB file using COBOL? Is it possible to read the file using COBOL and get the record length? Can there be an alternate solution too?
Thanks,
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Read RDW Values of a VB file.
Look at RECORD IS VARYING DEPENDING ON .... For reading, it the DEPENDING ON value will contain the record-length read.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Read RDW Values of a VB file.
There are a couple of topics here on getting the record-length in SORT, so that would be an alternative.
Re: Read RDW Values of a VB file.
Thanks William.
I have declared the FD section as,
Each time I read the record, length of the record, is captured in CUST-RECORD-RDW.
Someone suggested that SSRANGE can also be s use in knowing the length of the records, how can that be possible, do you know?
I have declared the FD section as,
Code: Select all
FD CUST-RECORD-IN
DATA RECORD IS CUST-REC-IN
RECORDING MODE IS V
RECORD IS VARYING IN SIZE FROM 1 TO 2021 CHARACTERS
DEPENDING ON CUST-RECORD-RDW.
Someone suggested that SSRANGE can also be s use in knowing the length of the records, how can that be possible, do you know?
Thanks,
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Read RDW Values of a VB file.
I suggest you ask that someone how to use SSRANGE for that.
The above code gives you the length of each record as it is read. Why would you want to consider something which would obviously be more complex, more obscure, and wouldn't work (which you'd know, from reading the documentation of SSRANGE in the Programming Guide).
The above code gives you the length of each record as it is read. Why would you want to consider something which would obviously be more complex, more obscure, and wouldn't work (which you'd know, from reading the documentation of SSRANGE in the Programming Guide).
Re: Read RDW Values of a VB file.
Thanks. SSRANGE can be used to chekc the array bounds, that's what I know but to use in this situation is a different matter and was surprised with this suggestion.
Thanks,
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Read RDW Values of a VB file.
Well, the suggestion by your someone was indeed nonsense :-)
SSRANGE doesn't check "array" bounds (even ignoring that COBOL doesn't have arrays, it has tables). SSRANGE simply ensures that the data-references resolved from subscripting or reference-modification is within the bounds of the table or field, respectively.
You could look at it as "bounds checking" for a one-dimensional table, but for a multi-dimensional table you can "bust" a subscript but still reference data within the table, without SSRANGE even squeaking.
SSRANGE doesn't check "array" bounds (even ignoring that COBOL doesn't have arrays, it has tables). SSRANGE simply ensures that the data-references resolved from subscripting or reference-modification is within the bounds of the table or field, respectively.
You could look at it as "bounds checking" for a one-dimensional table, but for a multi-dimensional table you can "bust" a subscript but still reference data within the table, without SSRANGE even squeaking.
Re: Read RDW Values of a VB file.
My view on this is as yours, I agree!William Collins wrote:Well, the suggestion by your someone was indeed nonsense :-)
Thanks,
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