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
 

 

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

New User


Joined: 29 Jun 2005
Posts: 89

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: 1534
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

New User


Joined: 29 Jun 2005
Posts: 89

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: 7308

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 Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm


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