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
 

 

Significance of level 49 with DB2 VARCHAR

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Fri Sep 17, 2010 1:46 pm    Post subject: Significance of level 49 with DB2 VARCHAR
Reply with quote

Hi.

Please let me know what's the difference between below two types of COBOL equivalent for DB2 VARCHAR data types.

Why we need to declare level 49 always for DB2 VARCHAR data type.

(I have referred some of the past posts, but it doesn't have absolute answer)


01 WS-NAME-IN
05 WS-NAME-LEN PIC S(04) COMP
05 WS-NAME PIC X(25)


01 WS-NAME-IN
49 WS-NAME-LEN PIC S(04) COMP
49 WS-NAME PIC X(25)


Thanks
Back to top
View user's profile Send private message

GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Fri Sep 17, 2010 2:30 pm    Post subject:
Reply with quote

because IBM said so:
Application Programming and SQL Guide wrote:
The number 49 has a special meaning to DB2. Do not specify another number
Back to top
View user's profile Send private message
bamohan

New User


Joined: 29 Jan 2007
Posts: 33
Location: chennai

PostPosted: Fri Sep 17, 2010 2:56 pm    Post subject: Reply to: Significance of level 49 with DB2 VARCHAR
Reply with quote

Because 49 is the maximum level beyond which variables cannot be subgrouped.

In VARCHAR, bytes will be occupied based on the Char text. If there is 05 or 10 under a varchar group variable any 15 level variable defined under it will tend to join along with the group which is Invalid.

That is why 49 is used as subgroup in VARCHAR
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 17, 2010 3:26 pm    Post subject: Re: Reply to: Significance of level 49 with DB2 VARCHAR
Reply with quote

bamohan wrote:
Because 49 is the maximum level beyond which variables cannot be subgrouped.

In VARCHAR, bytes will be occupied based on the Char text. If there is 05 or 10 under a varchar group variable any 15 level variable defined under it will tend to join along with the group which is Invalid.

That is why 49 is used as subgroup in VARCHAR



Did you wash your pants after saying this?
what i mean it the above is total BullShit.
do not persist in wasting peoples time with your inaccurate garbage.
Back to top
View user's profile Send private message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Fri Sep 17, 2010 4:46 pm    Post subject: Re: Reply to: Significance of level 49 with DB2 VARCHAR
Reply with quote

Mohan,

bamohan wrote:
it will tend to join along with the group which is Invalid.


It is not necessary that 05 or 10 under 01 level, I can put multiple 49 levels under 01 level, then according to you following statement is valid?

01 WS-NAME-IN
49 WS-NAME-LEN PIC S(04) COMP
49 WS-NAME-FIRST PIC X(10)
49 WS-NAME-MID PIC X(10)
49 WS-NAME-LAST PIC X(05)
49 FILLER PIC X(100)
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 17, 2010 11:42 pm    Post subject:
Reply with quote

As IBM quotes,
Group data items in the declare section can have any of the valid host variable types described as subordinate data items. This includes all numeric and character types, as well as all large object types. You can nest group data items up to 10 levels. Note that you must declare VARCHAR character types with the subordinate items at level 49. If they are not at level 49, the VARCHAR is treated as a group data item with two subordinates, and is subject to the rules of declaring and using group data items.
Code:
    01 staff-record.
        05 staff-id       pic s9(4) comp-5.
        05 staff-name.
            49 l          pic s9(4) comp-5.
            49 d          pic x(9).
        05 staff-info.
            10 staff-dept pic s9(4) comp-5.
            10 staff-job  pic x(5).

In the example above, staff-info is a group data item, whereas staff-name is a VARCHAR. The same principle applies to LONG VARCHAR, VARGRAPHIC, and LONG VARGRAPHIC. You may declare group data items at any level between 02 and 49
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 Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Only text from varchar Seppe DB2 8 Thu Apr 21, 2016 10:42 pm
No new posts Syncsort TPF Level Majid Hussain SYNCSORT 2 Wed Apr 13, 2016 2:22 am
No new posts Need a logic to validate the data in ... sandeep kumar302 COBOL Programming 17 Mon Feb 01, 2016 3:30 pm
No new posts Declaration of varchar in cobol s.saranya srinivasan COBOL Programming 6 Fri Sep 25, 2015 11:43 am


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