IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to validate every character in the above variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Tue Oct 10, 2006 2:53 pm
Reply with quote

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
View user's profile Send private message
shanthikiran

New User


Joined: 31 May 2005
Posts: 7
Location: India

PostPosted: Tue Oct 10, 2006 4:19 pm
Reply with quote

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
View user's profile Send private message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Tue Oct 10, 2006 4:33 pm
Reply with quote

I will try this and let you know..thnx for the response Shashi!! icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top