View previous topic :: View next topic
|
Author |
Message |
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
I have a field s9(3) comp-3, values are linke 123, 345, 223, 222. I want to display all the number that have a ?2? in the centre. (remember it?s a comp-3 field) |
|
Back to top |
|
|
vikasc4
New User
Joined: 11 Dec 2005 Posts: 32
|
|
|
|
Hi,
First move the comp-3 fields into a numeric field. Then with the help of refrence modification move the centre no. to another field.
Compare it with 2 and if equal then dispaly the no else not.
The code will be:
DATA ....
77 A PIC S9(3) COMP-3.
77 B PIC 9(3).
77 C PIC 9.
PROCEDURE DIVISION.
MOVE A TO B.
MOVE B(2:1) TO C.
IF C = 2
DISPLAY B
ELSE NEXT SENTANCE.
REGARDS
VIKAS |
|
Back to top |
|
|
hncs
New User
Joined: 01 Mar 2006 Posts: 11
|
|
|
|
WORKING-STORAGE SECTION.
01 WS-I PIC 9(02) VALUE ZEROES.
01 A PIC S9(03) COMP-3 VALUE ZEROES.
PROCEDURE DIVISION.
DIVIDE A BY 10 GIVING A.
DIVIDE A BY 10 GIVING A REMAINDER WS-I.
IF WS-I = 2
DISPLAY 'FOUND******'
ELSE
DISPLAY 'NOT FOUND*******'
END-IF |
|
Back to top |
|
|
|