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

What is the need of 49 level in db2 as well as in cobol?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srinivas.cdp

New User


Joined: 22 Jun 2006
Posts: 4

PostPosted: Sat Dec 23, 2006 9:46 pm
Reply with quote

what is the need of 49 level in db2 as well as in cobol?

Title changed from "49 level" to "what is the need of 49 level in db2 as well as in cobol?" : Priyesh.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sat Dec 23, 2006 9:50 pm
Reply with quote

Where do you get the idea that there is a "need" of a 49 level in either COBOL or DB2?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sat Dec 23, 2006 11:22 pm
Reply with quote

Srini...

First thing I hope you are talking about COBOL, not DB2... then there is not as such "NEED" of coding 49 level #.... It is just a way of conveying that we dont need any further sub-variables undder this variable...

Kind of coding standard... not MANDATORY....

P.S. and how about giving a proper & meaningful Title of your questions, which is self explainatory.... READ FORUM RULES....
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Dec 25, 2006 1:09 am
Reply with quote

You "need" 49 levels to define host variables for VARCHAR cols in DB2. The 1st 49 contains the length of the string; the 2nd the string itself. To move the string you can use refmod or the STRING stmt, eg.:
Code:

01  varchar-fld.
    49  vf-len     pic s9(004) comp.
    49  vf-data    pic  x(00n).

move vf-data(1:vf-len) to ....
PS It's the creator's responsibility to populate vf-len when vf-data is populated. When the data is written to the DB2 table it will only occupy as many bytes as the vf-len indicates even though the PIC of the host variable may be larger.

Also note that there is no "space" fill when the col is loaded into vf-data. If vf-data was 5 bytes and conained "AAAAA" then you loaded the col containing "BB" the result would be "BBAAA"
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts How to load to DB2 with column level ... DB2 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top