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

Difference between 77 and 01


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
happyraman1

New User


Joined: 20 Aug 2003
Posts: 2

PostPosted: Thu Aug 21, 2003 2:47 am
Reply with quote

Can anyone please give me a reply advantage of 01 single item than 77 declaration

Thanx,
Venkat
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1207
Location: India

PostPosted: Thu Aug 21, 2003 8:14 am
Reply with quote

* 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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Aug 22, 2003 1:18 pm
Reply with quote

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
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Thu Dec 04, 2003 2:44 pm
Reply with quote

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
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Thu Dec 04, 2003 3:00 pm
Reply with quote

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
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Fri Dec 26, 2003 3:03 pm
Reply with quote

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
View user's profile Send private message
RobertL

New User


Joined: 02 Jan 2004
Posts: 2
Location: Portugal

PostPosted: Fri Jan 02, 2004 10:14 pm
Reply with quote

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
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Mon Jan 05, 2004 11:33 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 06, 2004 2:19 am
Reply with quote

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
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Sat Jan 10, 2004 2:01 pm
Reply with quote

Yes I have initialized that counter also before INSPECT.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
No new posts Difference between sysexec and sysproc CLIST & REXX 6
No new posts Difference between DATACLAS=MULTIVOL ... JCL & VSAM 10
No new posts Difference between CICS region bounce... CICS 3
Search our Forums:

Back to Top