Switches in cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Switches in cobol

Postby Suganya.Shanmugam » Thu Nov 18, 2010 11:35 am

hi,

can any one explain about the switches in cobol.

how to use 88 variable in cobol in until condition.

for ex: if i declare the var-1 as

88 var-1 'N'

on using in the proc division i am coding like
PERFORM PARA-1 UNTIL var-1.
until what condition the para will perform?
Suganya.Shanmugam
 
Posts: 7
Joined: Thu Nov 11, 2010 10:57 am
Has thanked: 0 time
Been thanked: 0 time

Re: Switches in cobol

Postby dick scherrer » Fri Nov 19, 2010 12:14 am

Hello,

A switch is typically a yes/no indicator that is set and/or tested within the code.

on using in the proc division i am coding like
PERFORM PARA-1 UNTIL var-1.
until what condition the para will perform?
Until var-1 = 'N' . . . :?

I suspect that i do not understand the question. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Switches in cobol

Postby Nikos » Sun Nov 21, 2010 4:13 pm

I suppose you already got an answer to this one, but I will post anyway. :oops:

Variable declaration
01 EOF-SWITCH PIC X(01) VALUE SPACE.
--->88 NOT-END-OF-FILE VALUE SPACE.
--->88 END-OF-FILE VALUE 'Y'.

You set the switch to a certain start-value, perform until other value is set.

Before process:
Set the value---> SET NOT-END-OF-FILE TO TRUE / MOVE SPACE TO EOF-SWITCH

Process:
Test for new/other value of variable

SET NOT-END-OF-FILE TO TRUE
PERFORM UNTIL END-OF-FILE
--->When you want set new/other value
--->SET END-OF-FILE TO TRUE or MOVE 'Y' TO EOF-SWITCH
END-PERFORM
processing continues here...

YIIHAAA, my first post in this forum !!! :roll:
Nikos
 
Posts: 1
Joined: Sun Nov 21, 2010 3:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Switches in cobol

Postby dick scherrer » Sun Nov 21, 2010 10:28 pm

Hello and welcome to the forum,

Thanks for your post and hopefully, you will find some things to "take away" as well :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post