View previous topic :: View next topic
|
Author |
Message |
pavan k kumar Currently Banned New User
Joined: 04 Feb 2007 Posts: 5 Location: andhra
|
|
|
|
iam having value '0012345' as an input and want this no to edited and the output sholud like like
'**1234.5'
can anybody help me to do this out |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You first need to get your value into a packed-decimal field. Then you need to define your edit mask. Lastly, you need to issue the EDit instruction.
It should go something like (doing this from memory here, so i hope i'm close):
Code: |
THEAMT DC PL4'+0012345' <-- your amount field
THERSLT DS CL9 <-- where the edited result goes
MVC THERSLT(9),=X'5C202020202020xB20'
ED THERSLT,THEAMT |
The 5C is the fill character and i believe 5C is an asterisk. The xB is the decimal point (i don't remember if it is 4B or 6B, but am fairly sure it is one of those two). The 20s will be replaced with the fill character until a non-zero is encountered.
Good luck and let us know if this isn't what you want |
|
Back to top |
|
|
pavan k kumar Currently Banned New User
Joined: 04 Feb 2007 Posts: 5 Location: andhra
|
|
|
|
hai dick,
thanks for u r reply,
i've done the coding as the following,for the same quesstion above
CODE SNIPPET:
ED MASK,NUM1
MVC OUTREC,MASK
PUT OUTFILE,OUTAREA
NUM1 DS P'0012345'
MASK DS X'5C2020202020204B20'
OUTAREA DS 0CL80
OUTREC DS CL9
SET DS CL71' '
BUT THIS IS GIVING THE O/P AS "***1234.5" BUT I WANTED WAS
"**1234.5" IT IS GIVING ONE * EXTRA.IS THERE ANY PROBLEM IN MY CODING COULD U CHECK THIS OUT |
|
Back to top |
|
|
pavan k kumar Currently Banned New User
Joined: 04 Feb 2007 Posts: 5 Location: andhra
|
|
|
|
HAI DICK,
SORRY,I HAVE GIVEN
NUM1 DC P'0012345'
MASK DC X'5C2020202020204B20'
EXCEPT THAN THIS ARE THERE ANY ERRORS IN MY CODE |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Pavan,
You're welcome
I believe your code is working.
Now you need to add another MVC to move the length you want from the result of the EDit to the "final output" area.
One of the "features" of the EDit is that it has to have things "its own way" which means all of the digits need to be accounted for. Once the instruction completes, you have control of the result.
Let me know if that doesn't get the result you want. |
|
Back to top |
|
|
pavan k kumar Currently Banned New User
Joined: 04 Feb 2007 Posts: 5 Location: andhra
|
|
|
|
hai dick
thanks a lot for helpinp me out its working |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Pavan,
You're welcome - thanks for letting us know |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Pavan !
Just one additional hint. Your EditMask must have as many signs as as there are numerics in your pack-field, plus each special sign for editing the output.
Example:
Pack-Field DC PL04'4321'
This is hex 00 04 32 1C, which means 7 numeric digits
So mask could be normaly 20202020202020 without any special-sign
And now with Comma and point 20204B2020216B2020
This will result in 43,21 The mask-sign 20 doesn't print a zero but the mask-sign 21 prints it.
So now: pack-field = 7 digits = mask = 7 digits + 4B + 6B = 9 EditSigns
You could a an 5C in front for getting the floating asteriks until a non zero numerig digit. You could also add an hex 60 for getting a negative-sign printed, when the the value is less then zero.
Regards, UmeySan |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
This last posting indicates that a 20 does not print but a 21 prints it.
This is not fully correct.
You only use one 21 in an edit mask. Whereever the 21 occurs, that is the last zero to be replaced by blank if the value is all zeroes.
E.G
ZAP VALUE,=P'0'
ED MASK,VALUE
VALUE DC PL4'0'
MASK DC X'4020202021204B2020'
Would result in ' 0.00' |
|
Back to top |
|
|
|