View previous topic :: View next topic
|
Author |
Message |
srinivas.cdp
New User
Joined: 22 Jun 2006 Posts: 4
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Where do you get the idea that there is a "need" of a 49 level in either COBOL or DB2? |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|