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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Why 49 level no is used for Varchar in DB2 - COBOL Program
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    Post subject:
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    Post subject:
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    Post subject: hai
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    Post subject: Re: Why 49 level no is used for Varchar in DB2 - COBOL Progr
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    Post subject: Re: Why 49 level no is used for Varchar in DB2 - COBOL Progr
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    Post subject: Re: Why 49 level no is used for Varchar in DB2 - COBOL Progr
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    Post subject: Re: Why 49 level no is used for Varchar in DB2 - COBOL Progr
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    Post subject: Re: Why 49 level no is used for Varchar in DB2 - COBOL Progr
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 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 pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


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