READ INPUT-IFILE INTO WW-INP-REC AT END
MOVE 'Y' TO WS-END-OF-INP-FILE
COMPUTE VALUE-LEN1 = FUNCTION LENGTH(WW-INP-KEY)
INSPECT FUNCTION REVERSE(WW-INP-DATA)
TALLYING VALUE-LEN2 FOR LEADING SPACES
COMPUTE VALUE-LEN2 = LENGTH OF WW-INP-DATA - VALUE-LEN2
COMPUTE VALUE-LEN = VALUE-LEN1 + VALUE-LEN2
MOVE WW-INP-KEY TO VSAM-REC-KEY
MOVE WW-INP-DATA(1:VALUE-LEN) TO VSAM-DATA
Joined: 06 Jun 2008 Posts: 8055 Location: East Dubuque, Illinois, USA
Firstly im not sure if VSAM can be written in VB format. If Yes what might be the reason for my error.
Be sure -- there is absolutely no problem in COBOL, if the code is written correctly, with writing variable length VSAM records. Be aware that variable length VSAM files, unlike variable length sequential files, do not have a 4-byte record descriptor word at the beginning of each record.
Would it really be so hard to add VALUE-LEN to your display of the file status code? That would tell you what length record you are attempting to write, which could tell much.
Also, from what you have posted it does not appear that you have defined the VSAM file as having variable length records.