View previous topic :: View next topic
|
Author |
Message |
karthick Ramesh
New User
Joined: 19 Mar 2008 Posts: 12 Location: India
|
|
|
|
Hi all,
Im Trying to write a VSAM file with Variable record length is that possible. If possible i tried various scenarios which was not working and its erroring with status=44.
In my program i have to read a PS file and Write a VSAM of variable record length. -> we wil using this as a DB so inorder to save space we are writing in the VB format.
In code:-
Code: |
FD VSAM-FILE
RECORD IS VARYING IN SIZE
FROM 1 TO 2760 CHARACTERS DEPENDING ON VALUE-LEN
DATA RECORD IS VSAM-RECORD.
01 VSAM-RECORD.
03 VSAM-REC-KEY PIC X(60).
03 VSAM-DATA PIC X(2700).
01 WW-INP-REC.
03 WW-INP-KEY PIC X(15).
03 WW-INP-DATA PIC X(65).
READ-FILE SECTION.
READ INPUT-IFILE INTO WW-INP-REC AT END
MOVE 'Y' TO WS-END-OF-INP-FILE
END-READ
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
WRITE-VSAM-RECORD.
MOVE WW-INP-KEY TO VSAM-REC-KEY
MOVE WW-INP-DATA(1:VALUE-LEN) TO VSAM-DATA
WRITE VSAM-RECORD END-WRITE
IF WL-VSAM-STATUS = '00'
DISPLAY 'WRITTEN - 'VSAM-REC-KEY
ELSE
DISPLAY 'WRITE-ERROR ' |
VSAM format:-
Dataset type ===> KSDS
Key length ===> 60
Key position ===> 0
Average Recordsize ===> 2764
Maximum Recordsize ===> 2764
when i run this code im getting VSAM Status 44. Please advise me.
Firstly im not sure if VSAM can be written in VB format. If Yes what might be the reason for my error. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Following up on Dicks most helpfull link - you really should make the time to read that document - You need to look at the VSAM definition. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
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. |
|
Back to top |
|
|
|