View previous topic :: View next topic
|
Author |
Message |
vinit_infy Warnings : 1 New User
Joined: 07 Apr 2005 Posts: 56
|
|
|
|
I am reading a VSAM file having variable length data and writing the same to VB sequential file if the record satisfies some particular condition.
Could any one tell me how can i get the length of each record from the VSAM file so that i can write the VB sequential file? |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
IDCAMS LISTCAT will give that information. |
|
Back to top |
|
|
vinit_infy Warnings : 1 New User
Joined: 07 Apr 2005 Posts: 56
|
|
|
|
Peter, I am asking in terms of COBOL ...how can i calculate the length in cobol program? Pls advise. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Why do you need to know the length of a record to be able to write it out to a VB file. |
|
Back to top |
|
|
vinit_infy Warnings : 1 New User
Joined: 07 Apr 2005 Posts: 56
|
|
|
|
because i dont want to have spaces or anything in last positions.. e.g., The maximum length is 4096 and if the record in vsam has length of 1000 , i dont want spaces in last 3096 places....and i think for writing Variable block file we have to pass the record length first..pls correct if i am wrong... |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi,
From one of Bill O'Boyle's posts...
Quote: |
After the introduction of COBOL2, version 3, you could specify -
RECORD IS VARYING IN SIZE FROM Minimum-Length TO Maximum-Length CHARACTERS DEPENDING ON WS-REC-LGTH.
03 WS-REC-LGTH PIC 9(08) BINARY.
Where WS-REC-LGTH in an unsigned WS variable. Personally, I always specify this as an unsigned binary-fullword, but it's not a mandate.
On a READ of a variable-length record, WS-REC-LGTH will contain the actual length.
On a WRITE (and before it is issued), the programmer would populate WS-REC-LGTH with the desired record-length. |
|
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Using the following clauses could do the job :
RECORDING MODE is V
RECORD is VARYING in SIZE from 1 to x
DEPENDING ON RECORD-SIZE. |
|
Back to top |
|
|
|