View previous topic :: View next topic
|
Author |
Message |
Novice
New User
Joined: 27 Oct 2004 Posts: 8 Location: Bangalore,INDIA
|
|
|
|
what does level number 88 does?? |
|
Back to top |
|
|
chandrasekhar
New User
Joined: 29 Sep 2004 Posts: 35 Location: bangalore
|
|
|
|
lEVEL NO 88 USED FOR CONDITIONAL NAMES.
You can use a level 88 to set up condition names that can be used to simplify
IF and UNTIL tests.
Level 88 is a special level number used to improve the readability of COBOL
programs and to improve IF tests.
A level 88 looks like a level under another variable, but it's not.
It does not have a PICTURE, but it does have a value.
A level 88 is always associated with another variable and is a condition name
for that variable. |
|
Back to top |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
Novice wrote: |
what does level number 88 does?? |
Great Day!
Here is an example:
01 day-of-week pic x(02) value spaces.
88 day-sunday value 'SU'.
88 day-monday value 'MO'
..
Now in your program you can code your if statement like
IF day-sunday
perfrom sunday-process
end-if. |
|
Back to top |
|
|
muthukumarapandian
New User
Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
Hi,
u have to code as shown below.
Code: |
working-storage section.
01 a pic x value spaces.
88 male value 'm'.
88 female value 'f'.
procedure division.
Accept a.
If male perform p1
end-if.
if female perform p2
end-if. |
Here condition names are used to improve self documentation. |
|
Back to top |
|
|
kanak
Moderator
Joined: 12 Mar 2005 Posts: 252 Location: India
|
|
|
|
this is used for conditional variable.The parent level of this variable will get the value assigned to the conditional level.E.G.
01 taste pic x(1) value space.
88 sweet value 's'.
88 sour value 'o'.
so if sweet is set to tru then the value of taste variable will be s.if sour is set to tru then the value of taste will be o, otherwise it will be space. |
|
Back to top |
|
|
Vijay Bhadauria
New User
Joined: 28 Mar 2005 Posts: 8
|
|
|
|
Hi,
You can also use 88 level with thru clause or multiple values.
E.g.
01 Char PIC X.
88 Vowel VALUE "a", "e", "i", "o", "u".
88 Digit VALUE "0" THRU "9".
88 Consonant VALUE "b", "c", "d", "f", "g", "h"
"j" THRU "n", "p" THRU "t", "v" THRU "z".
88 ValidCharacter VALUE "a" THRU "z", "0" THRU "9".
In the above case,
Vowel will be true if any of the mentioned values (i.e. a,e,i,o,u) will be assigned to Char.
Digit will be true if any number between 0 and 9 will be assigned to Char.
Same is the case with Consonant and ValidCharacter
|
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
PLEASE EXPLAIN HOW TO USE SET TO TRUE USING CONDITION NAMES(LEVEL 88) |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Suppose i am declaring a variable like that
EXEC SQL
DECLARE SOICUR FOR
SELECT POLICY_NUMBER
FROM ILF010VW
END-EXEC
10 WS-DB2-ILF010-RECORDS PC X(1) VALUE 'N'.
88 WS-DB2-ILF010-OVER VALUE 'Y'.
PROCEDURE DIVISION.
....
PERFORM A1000-OPEN-CURSOR.
PERFORM A2000-FETCH-CURSOR UNTIL WS-DB2-ILF010-OVER
PERFORM A300-CLOSE-CURSOR.
A1000-OPEN-CURSOR SECTION.
A1000-START.
EXEC SQL
OPEN SOICUR
END-EXEC.
EVALUATE SQLCODE
WHEN +0
CONTINUE
WHEN OTHER
RAISE AN ERROR
END-EVALUATE.
A1099-EXIT.
A2000-FETCH-CURSOR SECTION.
A2000-START.
EXEC SQL
FETCH SOICUR INTO :WS-POLICY-NUMBER
END-EXEC.
EVALUATE SQLCODE
WHEN +0
CONTINUE
WHEN +100
SET WS-DB2-ILF010-OVER TO TRUE
WHEN OTHER
RAISE AN ERROR
END-EVALUATE.
A2099-EXIT.
EXIT.
A3000-CLOSE-CURSOR SECTION.
A3000-START.
EXEC SQL
CLOSE SOICUR
END-EXEC.
EVALUATE SQLCODE
WHEN +0
CONTINUE
WHEN OTHER
RAISE AN ERROR
END-EVALUATE.
A3099-EXIT.
EXIT.
In this we declare avariable to identify there is no more row to fetch so whenever it got sqlcode +100 it is setting a flag which is used for looping
Hope it will be helpful |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
thanks for the help |
|
Back to top |
|
|
|