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

Converting a field in one format to another


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prasanth_urs

New User


Joined: 04 Dec 2006
Posts: 44
Location: Pune,India

PostPosted: Mon Apr 16, 2007 11:29 am
Reply with quote

Hi all,

I need some help in this issue.
Actually, there is a field called 'A' whose value is '030 10670000' which is a numberic filed with length 15.

This format has to be changed to '30+1067' format.
That means the zeros from both are to be suppressed as well as the balnk is to changed to +.

Please help me with the code for this conversion.

Many thanks in advance
Back to top
View user's profile Send private message
Anjani Kiran Mitikiri

New User


Joined: 05 Feb 2007
Posts: 6
Location: Chennai

PostPosted: Wed Apr 25, 2007 1:14 am
Reply with quote

Hi Prasanth ,
Your field 'A' , you say is numeric, then how come it is having a space in it?Nevertheless , use inspect statement.
First , INSPECT A replacing all Spaces with '+'
Then INSPECT A replacing all '0's with Spaces
Lastly INSPECT A replacing all Spaces with ''(i.e. NULL)
For all this to happen your variable A must be declared as a Character and not as a Numeric!
All the best !
Anjani
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 25, 2007 1:36 am
Reply with quote

Hello,

If i'm missing something here, please let me know, but will that "code" not replace the zeros in 30 and 1067?

Also, the "field" may be 15 in length (per the specs above) - the posted "number" is not 15 long, so i suspect that the initial space to + may generate multiple plus signs icon_confused.gif
Back to top
View user's profile Send private message
Anjani Kiran Mitikiri

New User


Joined: 05 Feb 2007
Posts: 6
Location: Chennai

PostPosted: Wed Apr 25, 2007 1:56 am
Reply with quote

Yeah u r right d.sch ! I missed that part icon_redface.gif
To avoid this for the second inspect we can try movinga character that is not expected to be normally present in 'A' may b by ^ or & and then the thrid inspect also needs to be modified accoridngly
Hope this helps
As for the second part fo ur comemnt , I wud ratehr look into the specific pattern and lenght of 'A' in general and then do something abt the +
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 25, 2007 2:29 am
Reply with quote

Hello Kiran,

Please post the modifications you propose - i'm not sure i understand this
Quote:
To avoid this for the second inspect we can try movinga character that is not expected to be normally present in 'A' may b by ^ or & and then the thrid inspect also needs to be modified accoridngly


This too
Quote:
As for the second part fo ur comemnt , I wud ratehr look into the specific pattern and lenght of 'A' in general and then do something abt the +
has me confused.

Also, (i'm not an adabas/natural person), does Natural have an INSPECT verb? I seem to recall an EXAMINE, but i don't know the syntax. I've helped people debug, but haven't written Natural code of my own. . .
Back to top
View user's profile Send private message
Anjani Kiran Mitikiri

New User


Joined: 05 Feb 2007
Posts: 6
Location: Chennai

PostPosted: Wed Apr 25, 2007 4:40 am
Reply with quote

Am really sorry if I missed this..but are we not talking acout COBOL?
Back to top
View user's profile Send private message
Anjani Kiran Mitikiri

New User


Joined: 05 Feb 2007
Posts: 6
Location: Chennai

PostPosted: Wed Apr 25, 2007 4:44 am
Reply with quote

This shud work if we are talking abt COBOL
If it is NATURAL then pls try implementing this logic

01 WS-IX PIC 9(2).
Perform varying IX from 1 by 1 until A(IX:1) > 0
If A(IX:1) = 0
Move '' to A(IX:1)
END-IF
End-perform
Perform varying IX from 15 by -1 until A(IX:1) > 0
If A(IX:1) = 0
Move '' to A(IX:1)
END-IF
End-perform
Inspect A replacing all Spaces by '+'
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 25, 2007 7:22 am
Reply with quote

Hello Kiran,

Quote:
Am really sorry if I missed this..but are we not talking acout COBOL?


I'm not positive about which language the question referred to, but this one is the Natural & MQSeries forum. Often as i look thru posts, i have to check which forum i'm in at the time icon_confused.gif

Not to worry icon_smile.gif We all get our wires crossed sometimes.

Other than the original post from prasanth_urs (back on the 15th), there has been no follow-up. . .
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 -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top