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

conditional variable 88 clause


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

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Fri Sep 21, 2012 10:55 am
Reply with quote

Hi,

I have field whcih is of chracter (20) and i need to check all characters whethere it is 'Y' or 'N' .

Like below

01 WS-X PIC X(20).
88 YES VALUE 'YYYYYYYYYYYYYYYYYYYY'
88 NO VALUE 'NNNNNNNNNNNNNNNNNN'.

Is that can we represent the above with below like ,

01 WS-X PIC X(20).
88 YES VALUE '(20)Y'.
88 NO VALUE '(20)N'.

In COBOL ?

I know it will not work , i want the same to specify the count of occurence of Y & N instead of specifying twenty ''Y's & 'N's .

Can any one help me ?

Thanks
Balaji K
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Sep 21, 2012 11:07 am
Reply with quote

Btw why do you want specify like 20(Y) or 20(N) ??
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Sep 21, 2012 11:21 am
Reply with quote

Code:
01  WS-X   PIC X(20).         
    88 YES  VALUE ALL 'Y'.   
    88 NO1  VALUE ALL 'N'.   

?
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Fri Sep 21, 2012 12:01 pm
Reply with quote

Thanks buddy ....
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Sep 21, 2012 12:07 pm
Reply with quote

Or:

Code:

01  WS-CUSTOMER-NUMBER-OF-LEGS   PIC X(20).         
    88 WS-CUSTOMER-HAS-TWO-LEGS  VALUE ALL 'Y'.   
    88 WS-CUSTOMER-HAS-THREE-LEGS  VALUE ALL 'N'.   



I've made a completely blind guess at what your field and 88's might mean in business terms, and I could be completely wrong.

The point is, that you can always use well thought out and accurate names for your data-names and procedure-names to not leave the next person who looks at the program making the same type of "blind guess" as to what they mean.

You'll even discover that it helps you whilst writing the code. You'll find you never write:
Code:

ADD WS-NUMBER-OF-ORANGES-THIS-CLIENT TO WS-TOTAL-APPLES-THIS-AREA


But you might well write:

Code:
ADD WS-VAR5 TO WS-TOTVAR4


and if you did write that, then you will have wasted time and money until it is found and corrected. Sometimes not so much, sometimes a lot.

You feel that it would be a terrible amount of extra typing? Learn how to use the editor effectively, please.

Even if you stick with the foolishness of short names which convey no further information, don't use single English words, ever. You never know when a new compiler will come along and use your data-name for a RESERVED WORD. Then your program no longer compiles.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top