Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Write VSAM - Varible length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthick Ramesh

New User


Joined: 19 Mar 2008
Posts: 12
Location: India

PostPosted: Tue Jun 29, 2010 6:31 pm    Post subject: Write VSAM - Varible length
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Jun 29, 2010 6:43 pm    Post subject:
Reply with quote

VSAM Demystified
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 29, 2010 6:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 29, 2010 7:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts VSAM Space Allocation mrgnndhmk JCL & VSAM 7 Sat Apr 22, 2017 12:42 am
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us