View previous topic :: View next topic
|
Author |
Message |
vin12pr Warnings : 1 New User
Joined: 14 Jun 2006 Posts: 56
|
|
|
|
I have a variable ( like ZZZZZ.ZZ).This will be populated by values in a DB2 column.
I need to validate every character in the above variable and based on values ,I need to move the corresponding values(refer NOTE below) in to the output variable
Ex: If the value is 12345.56 ,the corresponding output variable value wil be MFGYRDVX
Note: There is a table for these values like when 1 it should be M ,for 2 - F,for 3 - G etc.....like that.
Tell me some good logic which will reduce the run time.By normal method i can do but I am in search of that logic, which will reduce the run time. |
|
Back to top |
|
|
shanthikiran
New User
Joined: 31 May 2005 Posts: 7 Location: India
|
|
|
|
Hi
I think u can use the INSPECT verb for ur requirement. first u need to move the zzzz.zz value to alphanumeric variable and then use the INSPECT verb to replace the digits with the corresponding characters
Am giving the sample code here
01 WS-DATA.
03 WS-INPUT-DATA.
05 WS-DB2-DATA1 PIC zzzz.zz.
05 WS-PRG-DATA1 PIC X(7).
03 WS-OUTPUT-DATA.
05 WS-DB2-DATA2 PIC X(7).
MOVE WS-DB2-DATA1 TO WS-PRG-DATA1
INSPECT WS-PRG-DATA1 REPLACE ALL '1' BY 'M', '2' BY 'F', '3' BY 'G'
MOVE WS-PRG-DATA1 TO WS-DB2-DATA2
If Am wrong plz correct me .....
Cheers
Shanthi Kiran |
|
Back to top |
|
|
vin12pr Warnings : 1 New User
Joined: 14 Jun 2006 Posts: 56
|
|
|
|
I will try this and let you know..thnx for the response Shashi!! |
|
Back to top |
|
|
|