Trouble with Edit/Ed (Assembler)



High Level Assembler(HLASM) for MVS & VM & VSE

Trouble with Edit/Ed (Assembler)

Postby RISCCISCInstSet » Wed Nov 16, 2011 1:10 am

Apparently in IBM assembler if I apply "ED MASK1,DATA1" with MASK1 = x'402020212060' and DATA1 = x'00000C'. MASK1 then prints: bbbbb0b.

I know an edit mask is made of

− A fill byte
− Digit select characters (x’20’)
− Significance start characters (x’21’)
− Field separator characters (x’22’)
− Message bytes (anything else)

The first byte is the "fill byte".

:arrow: What I want here is some clarification such that I can properly understand why I get the result I do.
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with Edit/Ed (Assembler)

Postby dick scherrer » Thu Nov 17, 2011 12:17 pm

Hello,

See if this helps - it is part of a dialog from elsewhere that i was involved with a few years ago:

CODE SNIPPET:

ED MASK,NUM1
MVC OUTREC,MASK
PUT OUTFILE,OUTAREA


NUM1 DC P'0012345'
MASK DC 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

From me:
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.


From another:
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.


You may want to review your understanding of the edit mask.

Also, your topic has been moved to the Assembler part of the forum - which may cause additional replies :)
Hope this helps,
d.sch.

These users thanked the author dick scherrer for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Trouble with Edit/Ed (Assembler)

Postby steve-myers » Thu Nov 17, 2011 5:29 pm

The first problem is you have an even number of digit select characters (20 and 21) in your mask.Until you learn ED/EDMK really well, you should always specify an odd number of digit select characters. The second problem is you ran out of digit select characters before you ran into a non-zero digit in the data, so ED replaced all the digit selects and the 60 character at the end of your mask with the fill character.

Read the description of ED in Principles of Operation very carefully/ It's very hard going, but everything you need to know is there.

These users thanked the author steve-myers for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Trouble with Edit/Ed (Assembler)

Postby RISCCISCInstSet » Thu Nov 17, 2011 10:13 pm

Thank you for your help. I'll get back to you if I have trouble. :)
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with Edit/Ed (Assembler)

Postby RISCCISCInstSet » Sat Nov 19, 2011 4:04 am

:!: It looks like I had a typo - it looks like MASK1 should have been x'40202020212060. :oops:
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with Edit/Ed (Assembler)

Postby steve-myers » Sat Nov 19, 2011 6:55 am

Agreed.

These users thanked the author steve-myers for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Trouble with Edit/Ed (Assembler)

Postby RISCCISCInstSet » Sun Nov 20, 2011 12:09 am

I should have made a request for information.
The first problem is you have an even number of digit select characters (20 and 21) in your mask.Until you learn ED/EDMK really well, you should always specify an odd number of digit select characters. The second problem is you ran out of digit select characters before you ran into a non-zero digit in the data, so ED replaced all the digit selects and the 60 character at the end of your mask with the fill character.
I made a typographical error, which changes how one must look at the information. How does the edit instruction respond to this new parameter? Should I just RTFM?
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with Edit/Ed (Assembler)

Postby enrico-sorichetti » Sun Nov 20, 2011 12:25 am

How does the edit instruction respond to this new parameter? Should I just RTFM?


since You said somewhere in Your other topics that You had solved the z390 issues
why not test on Your own.

on the other side the description and the examples of the EDIT and EDIT_AND_MARK instructions in the POP
are pretty clear and explanatory themselves

for the latest POP see here
http://publib.boulder.ibm.com/infocente ... /index.jsp
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Trouble with Edit/Ed (Assembler)

Postby steve-myers » Sun Nov 20, 2011 3:28 am

RISCCISCInstSet wrote:... How does the edit instruction respond to this new parameter? Should I just RTFM?
What new parameter? I dob't think ED has ever chamged. There was a minor change to EDMK for AMODE 31 operation.

These users thanked the author steve-myers for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Trouble with Edit/Ed (Assembler)

Postby steve-myers » Sun Nov 20, 2011 8:43 am

Here is one of the few times it is valid to specify an even number of digit selexct bytes in an ED/EDMK mask
EDTIME   CSECT
         USING *,12
         SAVE  (14,12),,*
         LR    12,15
         TIME  DEC
         ST    0,PDTIME
         ED    DISPTIME,PDTIME
         LA    0,L'MSG
         LA    1,MSG
         TPUT  (1),(0),R
         RETURN (14,12),T,RC=0
         DC    0F'0'
PDTIME   DC    PL4'0'
MSG      DC   0C'IT IS NOW HH:MM:SS.TH'
         DC    C'IT IS NOW'
DISPTIME DC   0C' HH:MM:SS.TH'
         DC    C' ',X'2120',C':',X'2020',C':'
         DC    X'2020',C'.',X'2020'
         END   EDTIME
The reason this works is the TIME DEC macro returns the time of day as 8 packed decimal digits. The ED instruction converts all 8 digits to EBCDIC numeric characters..

Notice, too, how I form the edit mask. The 0C' HH:MM:SS.TH' does not generate any storage. It just documents what I want the edit mask to look like. The C' ',X'2120',C':',X'2020',C':' and the next line are the actual edit mask. In real programs I usual form the three line in one long line, but because of the restricted width of the code block here I wrote 3 shorter lines. My method also means I do not need to knowthe EBCDIC codes for the non digit select characters.

The program does not use a new save area. The TIME and TPUT macros generate an SVC and does not require a save area

These users thanked the author steve-myers for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:57 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Next

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post