Page 1 of 1

Switches in cobol

PostPosted: Thu Nov 18, 2010 11:35 am
by Suganya.Shanmugam
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?

Re: Switches in cobol

PostPosted: Fri Nov 19, 2010 12:14 am
by dick scherrer
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. . .

Re: Switches in cobol

PostPosted: Sun Nov 21, 2010 4:13 pm
by Nikos
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:

Re: Switches in cobol

PostPosted: Sun Nov 21, 2010 10:28 pm
by dick scherrer
Hello and welcome to the forum,

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

d