IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Writing on to GSAM variable length


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 201
Location: Globe, India

PostPosted: Fri Mar 03, 2017 7:46 pm
Reply with quote

I am working on one migration where we are writing a record on GSAM variable blocked file.
Output layout has below layout -
Code:
01 DATA.
     05  DATA-LENGTH PIC S9(4) COMP.
     05  DATA-RECORD PIC X(5000).

We are using DATA variable mentioned above while writing into GSAM after moving some length like +104 into DATA-LENGTH and some text value onto DATA-RECORD.

On output file, we can see first 2 bytes of data is getting truncated.

e.g.
Code:
HELLOW WORLD is seen as LLOW WORLD
.

Any idea on what special arrangement is required while working GSAM variable blocked files ? I remember first 4 bytes are getting allocated to length in variable blocked file.

No issues are observed in fixed blocked GSAM. All is well there..
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Mar 03, 2017 8:05 pm
Reply with quote

Are you including the length of DATA-LENGTH itself in the data length?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Mar 03, 2017 8:42 pm
Reply with quote

The (R)ecord (D)escriptor (W)ord of a VB data set is 4 bytes long. S9(4) COMP is only 2 bytes.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Fri Mar 03, 2017 9:19 pm
Reply with quote

The RDW is 4 bytes, but the record length is the first 2 bytes of it -- the second two bytes are reserved (and used with VBS records). You need to add a 2-byte filler after your record length variable.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 201
Location: Globe, India

PostPosted: Sat Mar 04, 2017 1:34 am
Reply with quote

Seems right, i was trying to increase S9(4) COMP to S9(8) COMP.
But it was still failing.

Let me add 2 bytes of FILLER after S9(4) COMP length variable.
Will keep you posted.

Thanks for your response.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 201
Location: Globe, India

PostPosted: Mon Mar 06, 2017 12:32 pm
Reply with quote

We updated code as per above thought but its new problem.
Its causing last 2bytes getting truncated.

Do I need to increase length of record by 2 byes as we added FILLER of 2 bytes after length ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Mar 06, 2017 2:11 pm
Reply with quote

Are you doing the write from a COBOL program? You don't need the RDW, in fact you can't have the RDW.

There are several techniques to write variable-length records. If for yours you are just writing data of a particular length, structure unimportant to your program, then probably RECORD IS VARYING DEPENDING ON will be the most suitable.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FILE STATUS - 39 ON VARIABLE LENGTH V... COBOL Programming 2
No new posts BMS map length field greater than zero CICS 3
No new posts Unable to display comp variable COBOL Programming 4
No new posts SARBCH REPORT DD writing error CA Products 1
No new posts IWS/TWS build dinamic or variable APp... IBM Tools 0
Search our Forums:

Back to Top