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

clarification regarding edit mask instruction in assembler


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pavan k kumar
Currently Banned

New User


Joined: 04 Feb 2007
Posts: 5
Location: andhra

PostPosted: Fri Apr 13, 2007 7:15 am
Reply with quote

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

Moderator Emeritus


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

PostPosted: Fri Apr 13, 2007 8:29 am
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
pavan k kumar
Currently Banned

New User


Joined: 04 Feb 2007
Posts: 5
Location: andhra

PostPosted: Sun Apr 15, 2007 7:30 am
Reply with quote

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
View user's profile Send private message
pavan k kumar
Currently Banned

New User


Joined: 04 Feb 2007
Posts: 5
Location: andhra

PostPosted: Sun Apr 15, 2007 7:35 am
Reply with quote

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

Moderator Emeritus


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

PostPosted: Sun Apr 15, 2007 7:41 am
Reply with quote

Hi Pavan,

You're welcome icon_smile.gif

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
View user's profile Send private message
pavan k kumar
Currently Banned

New User


Joined: 04 Feb 2007
Posts: 5
Location: andhra

PostPosted: Thu Apr 19, 2007 5:54 am
Reply with quote

hai dick

thanks a lot for helpinp me out its working
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: Thu Apr 19, 2007 6:19 am
Reply with quote

Hi Pavan,

You're welcome - thanks for letting us know icon_smile.gif
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Apr 19, 2007 5:30 pm
Reply with quote

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

New User


Joined: 28 Aug 2006
Posts: 24
Location: St. Petersburg, FL

PostPosted: Sun Apr 22, 2007 12:35 am
Reply with quote

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
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Need help to resolve a hard edit COBOL Programming 8
This topic is locked: you cannot edit posts or make replies. Need help to resolve a hard edit COBOL Programming 4
No new posts Build dataset list with properties us... PL/I & Assembler 4
Search our Forums:

Back to Top