Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
conditional variable 88 clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 118

PostPosted: Fri Sep 21, 2012 10:55 am    Post subject: conditional variable 88 clause
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

Moderator


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

PostPosted: Fri Sep 21, 2012 11:07 am    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Sep 21, 2012 11:21 am    Post subject:
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: 118

PostPosted: Fri Sep 21, 2012 12:01 pm    Post subject: Reply to: conditional variable 88 clause
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Sep 21, 2012 12:07 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us