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: 181
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: 1845
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: 8132
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: 181
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: 181
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 Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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