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

Why 49 level no is used for Varchar in DB2 - COBOL Program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vbhat

New User


Joined: 29 Apr 2005
Posts: 38

PostPosted: Fri Apr 29, 2005 2:51 pm
Reply with quote

1) why 49 level no is used for Varchar? any reason for this
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Fri Apr 29, 2005 3:43 pm
Reply with quote

So you cannot create any sub groups in future...
Back to top
View user's profile Send private message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Tue May 03, 2005 2:36 pm
Reply with quote

Hi Priya,

Please can you explan clearly the above mentioned...........

Regards,
Pavan
Back to top
View user's profile Send private message
shymalasridevi

New User


Joined: 03 May 2005
Posts: 16

PostPosted: Tue May 03, 2005 2:43 pm
Reply with quote

49 level is least elementary level item
so we cannot create sub groups by using this level
we can use it to declare only elementary items only
Back to top
View user's profile Send private message
shaik Madar vali

New User


Joined: 28 Apr 2005
Posts: 8

PostPosted: Thu May 05, 2005 12:28 pm
Reply with quote

Yeah..

see the example.

01 ws-a.
05 ws-char-name pic x(20).
05 ws-varchar-name.
49 ws-varchar-name-len pic s9(4) usage comp.
49 ws-varchar-name-text pic x(20).

see the first one is declared as Char type. And Second one is declared as Varchar type. For Char type it is fixed. But where in case of Varchar its Variable length. i.e maximum is 20 char. Suppose in char type if u pass 'pavan' it takes 20 bytes and in varchar if u pass same 'pavan' it will take less than that. This is only one variable. Not a group element. And in COBOL we have upto 49 Level Number only. So if u mention 49 level means it cant have sublevels.

Hope this is wat u expected from us. Plz let me know if i am wrong..

regards,
Vali Shaik
Back to top
View user's profile Send private message
sudheer648

New User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Tue May 31, 2005 3:17 pm
Reply with quote

Hi,

If we dont give the Length Variable at 49 level for the VarChar Variable.

What will Happen.

Need inputs on this.
Back to top
View user's profile Send private message
eashwar

New User


Joined: 21 May 2005
Posts: 26
Location: Bangalore

PostPosted: Tue May 31, 2005 6:36 pm
Reply with quote

posting same message two times cannot gain more attention or is that that important to post twice

take it cool or hot

the answer is here
if you want a variable of variable length then go for the varchar
the length s9(4) comp will store the length of the varchar after a value is assigned to it. so that that much length of string is drawn for your use when ever uu use that varchar. so......

either that is a pure syntax error
or it will get the whole length x(20) if its declared so.
so we willl get garbage value .....for the rest of the characters

but i dont think this wil happen.......


and
another option is
it can be treated as a character variable and
the one with out pic cclause above this variabe declaration may be treated as error
take the above post as example to this explanation.
Back to top
View user's profile Send private message
sudheer648

New User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Wed Jun 01, 2005 10:06 am
Reply with quote

Hi,

I said what will happen if you dont declare the Length variable it would give an error.

Give me a Straight answer boss.
Back to top
View user's profile Send private message
naanu

New User


Joined: 02 Jun 2005
Posts: 3

PostPosted: Thu Jun 02, 2005 3:06 pm
Reply with quote

sudheer648 wrote:
Hi,

I said what will happen if you dont declare the Length variable it would give an error.

Give me a Straight answer boss.


i think it wont give error but your first two byte of varchar variable will be replaced by length data
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
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
Search our Forums:

Back to Top