View previous topic :: View next topic
|
Author |
Message |
happyraman1
New User
Joined: 20 Aug 2003 Posts: 2
|
|
|
|
Can anyone please give me a reply advantage of 01 single item than 77 declaration
Thanx,
Venkat |
|
Back to top |
|
 |
mcmillan
Site Admin

Joined: 18 May 2003 Posts: 1211 Location: India
|
|
|
|
* The main Adv. is 01 items are defined in double-word boundary by default.
* Usually Global data items are declared on 01 level.
* It's better to define Linkage section variables on 01 Level.
* 01 level items have the Possibility of future enhancements over req. |
|
Back to top |
|
 |
mmwife
Super Moderator

Joined: 30 May 2003 Posts: 1592
|
|
|
|
01 levels can be group level items (i.e. have 05 etc. level items below it). 77s can only be elementary level items. |
|
Back to top |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
This question is regarding 77 and 01 level. I have a ocde like this -
01 ws-string.
05 ws-str-1 pic x(03) value 'abc'.
INSPECT WS-INPUT TALLYING WS-CNT FOR ALL WS-STR-1.
This code is giving wrong value of WS-CTR.
But when I used
77 ws-str-1 pic X(03) value 'abc' .
and same procedure division statement I am getting correct value of WS-CTR.
Please explain whether 77 and 01 level has some difference in this context or I am making some mistake in logic.
Regards,
Sandip. |
|
Back to top |
|
 |
mdtendulkar
Active User

Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello Sandip,
Code: |
INSPECT WS-INPUT TALLYING WS-CNT FOR ALL WS-STR-1. |
WS-INPUT is the inspected data item
WS-CNT is the count field, and must be an elementary integer item defined without the symbol P in its PICTURE character-string.
WS-STR-1 is the tallying field (the item whose occurrences will be tallied).
WS-STR-1 should be one of the following:
1) An elementary alphanumeric data item
2) A DBCS data item
3) A national data item
4) A numeric data item with USAGE DISPLAY
5) An external floating-point item
This is the reason why it did not worked with a level 05 item but worked for level 77 item.
Hope this helps.
Regards
Mayuresh Tendulkar |
|
Back to top |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Hi Mayuresh,
Just curious....
Why WS-STR-1 should be an elementary item not a 05 level variable for good result? Please explain...and I have defined WS-CNT as a 05 level variable in my original code but it works fine...
Regards,
Sandip. |
|
Back to top |
|
 |
RobertL
New User
Joined: 02 Jan 2004 Posts: 2 Location: Portugal
|
|
|
|
Hi Sandip,
I have to admit, I'm kind of curious too. Both the 77 level and 05 level items are elementary alphanumeric data items (i.e. they both contain a PICTURE clause). AFAIK, there should be no difference between them in this context.
Can you post an example of the correct and incorrect results with the values of each field before and after?
This might help in resolving the problem.
Regards,
Robert |
|
Back to top |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Hello Robert,
As discussed I have used following code -
Code: |
.
.
.
05 WS-INPUT PIC X(32) VALUE 'abc def gh'.
01 WS-STRING.
05 WS-STR-1 PIC X(03) VALUE 'abc'.
INSPECT WS-INPUT TALLYING WS-CNT FOR ALL WS-STR-1.
|
It is not giving incorrect value of WS-CNT.
But if I use following code -
Code: |
.
.
.
05 WS-INPUT PIC X(32) VALUE 'abc def gh'.
01 WS-STR-1 PIC X(03) VALUE 'abc'.
INSPECT WS-INPUT TALLYING WS-CNT FOR ALL WS-STR-1.
|
it is giving correct result of WS-CNT = 1
Please reply.
Regards,
Sandip. |
|
Back to top |
|
 |
mmwife
Super Moderator

Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Sandip,
Just curious. You don't show it in the code you supply. Do you init WS-CNT to zero before the INSPECT?
Regards, Jack. |
|
Back to top |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Yes I have initialized that counter also before INSPECT. |
|
Back to top |
|
 |
|