Page 1 of 1

Read RDW Values of a VB file.

Posted: Tue Sep 22, 2015 3:08 pm
by BobP
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?

Re: Read RDW Values of a VB file.

Posted: Tue Sep 22, 2015 4:35 pm
by William Collins
Look at RECORD IS VARYING DEPENDING ON .... For reading, it the DEPENDING ON value will contain the record-length read.

Re: Read RDW Values of a VB file.

Posted: Mon Sep 28, 2015 12:00 pm
by criagk
Is not it more easy in a SORT JCL?

Re: Read RDW Values of a VB file.

Posted: Mon Sep 28, 2015 12:35 pm
by William Collins
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.

Posted: Sun Oct 04, 2015 11:17 am
by BobP
Thanks William.

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. 
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?

Re: Read RDW Values of a VB file.

Posted: Sun Oct 04, 2015 2:53 pm
by William Collins
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).

Re: Read RDW Values of a VB file.

Posted: Thu Oct 22, 2015 2:14 pm
by BobP
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.

Re: Read RDW Values of a VB file.

Posted: Thu Oct 22, 2015 2:36 pm
by William Collins
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.

Re: Read RDW Values of a VB file.

Posted: Thu Nov 05, 2015 2:18 pm
by BobP
William Collins wrote:Well, the suggestion by your someone was indeed nonsense :-)
My view on this is as yours, I agree! :D