View previous topic :: View next topic
|
Author |
Message |
vbhat
New User
Joined: 29 Apr 2005 Posts: 38
|
|
|
|
1) why 49 level no is used for Varchar? any reason for this |
|
Back to top |
|
|
priya
Moderator
Joined: 24 Jul 2003 Posts: 568 Location: Bangalore
|
|
|
|
So you cannot create any sub groups in future... |
|
Back to top |
|
|
i413678 Currently Banned Active User
Joined: 19 Feb 2005 Posts: 112 Location: chennai
|
|
|
|
Hi Priya,
Please can you explan clearly the above mentioned...........
Regards,
Pavan |
|
Back to top |
|
|
shymalasridevi
New User
Joined: 03 May 2005 Posts: 16
|
|
|
|
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 |
|
|
shaik Madar vali
New User
Joined: 28 Apr 2005 Posts: 8
|
|
|
|
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 |
|
|
sudheer648
New User
Joined: 23 May 2005 Posts: 97 Location: Chennai
|
|
|
|
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 |
|
|
eashwar
New User
Joined: 21 May 2005 Posts: 26 Location: Bangalore
|
|
|
|
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 |
|
|
sudheer648
New User
Joined: 23 May 2005 Posts: 97 Location: Chennai
|
|
|
|
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 |
|
|
naanu
New User
Joined: 02 Jun 2005 Posts: 3
|
|
|
|
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 |
|
|
|