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
 

 

Writing on to GSAM variable length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


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

PostPosted: Fri Mar 03, 2017 7:46 pm    Post subject: Writing on to GSAM variable length
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: 1768
Location: UK

PostPosted: Fri Mar 03, 2017 8:05 pm    Post subject:
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    Post subject:
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: 8033
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 03, 2017 9:19 pm    Post subject:
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: 179
Location: Globe, India

PostPosted: Sat Mar 04, 2017 1:34 am    Post subject: Reply to: Writing on to GSAM variable length
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: 179
Location: Globe, India

PostPosted: Mon Mar 06, 2017 12:32 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Mar 06, 2017 2:11 pm    Post subject: Reply to: Writing on to GSAM variable length
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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