Instruction of the week -- EDMK 
Author Message
 Instruction of the week -- EDMK

* The EDMK instruction is one of the more useful "complex" commands
* in the OS/390 instruction set.  And, sad to say, it is very complex.
* The best thing about EDMK is that if you understand EDMK, you also
* will understand ED, since ED is just a trivial subset of EDMK.
*
* The base idea of ED and EDMK is to translate a packed decimal number
* to decimal digits using a mask that defines the output.  Unlike the
* usual packed decimal instructions, ED and EDMK are single length
* instructions.  They run until they have processed every byte in the
* mask.
*
* The mask.
*
* A mask for the EDMK instruction contains three kinds of characters:
* the fill character, which is always the first character in the mask,
* field characters, which is any subsequent character, and digit select
* characters.  There is one more option, a field separator character,
* but it is so rarely used I won't talk about it.
*
* There are two kinds of digit select characters: an ordinary digit
* select character, and a significance start digit select character.
* Whenever the instruction encounters a digit select character, it
* loads one digit from the numeric field, converts it to an EBCDIC
* numeric character, and replaces the data in the mask with the digit.
* There is one exception to this rule.  If the digit is 0, and the
* significance start digit select character has not been encountered,
* ED and EDMK replace the mask character with the fill character.
*
* Enough of all the high falutin' talk.  Lets get down and boogey.
*
* Convert a 2 byte (3 digit) packed decimal number to decimal.
*
*          ED    MASK,NUMBER
*
*                  -------> Fill character
*                  | -----> Digit select
*                  | | ---> Significance start digit select
*                  | | | -> Digit select
*                  | | | |
* MASK     DC    X'40202120'
* NUMBER   DC    PL2'3'    (X'003C')
*
* The first thing you will notice is there is a digit select
* character in the mask for every digit in the data.
*
* So, what happens when the instruction executes.
*
*   Set fill character from first character in mask
*   Set significance flag off
*   For each character in the mask (starting with first character)
*     If charcter is a digit select
*       If digit is non-zero, or significance flag is on
*         Convert digit to numeric character.
*       If digit is non-zero,
*         Turn significance flag on.
*       If character is a signifance start charcter
*         Turn significance flag on.
*     Else
*       If significance flag is off
*         Replace mask character with fill character
*
* The pseudo program is much simpler than what actually happens,
* because complicated things happen to the significance flag when a
* packed decimal sign is encountered, but that capability is not
* often used.
*
* Now, let's step through the pseudo-code for our simple example.
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         40          0         0    Fill -> mask
*      20         40          0         0    Fill -> mask
*      21         40          0         0    Fill -> mask
*      20         40          1         3    C'3' -> mask
*
* The instruction converted MASK to C'   3'
*
* If the data is PL2'123', this is what happens.
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         40          0         0    Fill -> mask
*      20         40          0         1    C'1' -> mask
*      21         40          1         2    C'2' -> mask
*      20         40          1         3    C'3' -> mask
*
* If the data is PL2'0', this is what happens.
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         40          0         0    Fill -> mask
*      20         40          0         0    Fill -> mask
*      21         40          0         0    Fill -> mask
*      20         40          1         0    C'0' -> mask
*
* Now, let's change the data to PL4'1234567', and the mask to
* 0C' nn,nnn.nn',C' ',X'2020',C',',X'202120',C'.',X'2020'
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         40          0         0    Fill -> mask
*      20         40          0         1    C'1' -> mask
*      20         40          1         2    C'2' -> mask
*      6B (,)     40          1         3    Mask not changed
*      20         40          1         3    C'3' -> mask
*      21         40          1         4    C'4' -> mask
*      20         40          1         5    C'5' -> mask
*      4B (.)     40          1         6    Mask not changed
*      20         40          1         6    C'6' -> mask
*      20         40          1         7    C'7' -> mask
*
* Now, let's change the data to PL4'0'.
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         40          0         0    Fill -> mask
*      20         40          0         0    Fill -> mask
*      20         40          0         0    Fill -> mask
*      6B (,)     40          0         0    Fill -> mask
*      20         40          0         0    Fill -> mask
*      21         40          0         0    Fill -> mask
*      20         40          1         0    C'0' -> mask
*      4B (.)     40          1         0    Mask not changed
*      20         40          1         0    C'0' -> mask
*      20         40          1         0    C'0' -> mask
*
* Now, let's change the data to PL4'151', and the mask to
* 0C'*nn,nnn.nn',C'*',X'2020',C',',X'202120',C'.',X'2020'
*
*     MASK       FILL    SIGNIFICANCE
*  CHARACTER  CHARACTER      FLAG     DIGIT  Action
*      40         5C          0         0    Fill -> mask
*      20         5C          0         0    Fill -> mask
*      20         5C          0         0    Fill -> mask
*      6B (,)     5C          0         0    Fill -> mask
*      20         5C          0         0    Fill -> mask
*      21         5C          0         0    Fill -> mask
*      20         5C          1         1    C'1' -> mask
*      4B (.)     5C          1         5    Mask not changed
*      20         5C          1         5    C'5' -> mask
*      20         5C          1         1    C'1' -> mask
*
* The output is ******1.51
*
* Now, I said that ED is a nearly trivial subset of EDMK.  What is
* the difference?
*
* EDMK stores the address of the first digit it stores in the mask
* in register 1.  In AMODE 24, only the 3 low order bytes of
* register 1 are changed.  In AMODE 31, the 31 low order bits of
* register 1 are changed, and the high order bit is set to 0.  The
* instruction does not change the register if only 0 digits are
* are stored in the mask.  For this reason, most programmers prime
* register 1 with the address of the appropriate digit before
* starting the instruction; for this reason the wierd decision to
* not alter the high order byte in AMODE 24 does not really apply.
*
* What is the importance of this?
*
* There are two possible uses.
*
*   - You can insert something in front of the field.
*   - You can use this information to copy just the digits to
*     another data area.  This can be useful when constructing
*     messages.
*
* Like most things, ED and EDMK have significant problems.
*
* First, the instruction always nucs the mask.  In other words,
* you have to keep moving a {*filter*} mask into the output area
* unless you really want to cobber the mask.
*
* Second, the instruction requires a fill character as the first
* character in the mask.  There is simply no room for a fill
* character in the instruction, so it has to be somewhere.  The only
* bad thing is the mask is generally one byte larger than it has to
* be.
*
* Third, the instruction really seems to want an odd number of
* digit select characters.  This can be real annoying.  The reason,
* of course, is a packed decimal number always has an odd number of
* digits because the last digit position has a coded sign rather than a
* digit.
*
* The following sample program performs the following functions --
* - Format several numbers using EDMK to locate the first digit
*   so a - sign can be placed before the number if the number is
*   negative
* - Format an output line in an ad hoc fashion
* - Format an output line using an extremely simple format
*   The format contains string and data entries.  A data entry is just
*   a four byte address constant with the high order bit set on.  A
*   string entry is a 1 byte length field following by a string.  The
*   end of the format is indicated by X'FF'.
         EJECT
         MACRO
         SETR
         LCLA  &A
.L       AIF   (&A GT 15).X
R&A      EQU   &A
&A       SETA  &A+1
         AGO   .L
.X       MEND
         EJECT
EDMK     CSECT                     Define program CSECT
         USING *,R12               Establish program addressability
         SAVE  (14,12),,*          Save caller's registers
         LR    R12,R15             Copy EP address to R12
         LA    R15,S               Load addr of the new save area
         ST    R15,8(,R13)         Add new save area to the
         ST    R13,4(,R15)          save area chain
         LR    R13,R15             Establish a new save area pointer
         LM    R3,R5,=A(TABLE,TABLEL,TABLEE)  Load table limits
LOOP     MVC   LINE(L'MASK),MASK   Copy mask to the output line
*        LA    R1,LINE+L'MASK-1    NON-CURRENCY
         LA    R1,LINE+L'MASK-4    CURRENCY
         EDMK  LINE(L'MASK),0(R3)  Convert packed decimal to decimal
         CP    0(8,R3),=P'0'       Compare number w/ 0
         BNM   NOSIGN              br if >= 0
         BCTR  R1,0                Backup saved position by 1 byte
         MVI   0(R1),C'-'          Store - sign
NOSIGN   LA    R0,L'MASK           Load length of the output line
         LA    R1,LINE             Load start of the output line
         TPUT  (1),(0),R           Write
...

read more »



Sun, 10 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

I think these "Instruction of the week" messages are GREAT!

When I took S360 Assembler in a class taught at the community college, we were
told that EDMK will not load an address in register 1 if the first character
(digit or otherwise) printed was after significance select. Therefore we were
taught to always pre-load register 1 with the address of the first character
_after_ the address of X'21'. That way, if we were floating a dollar sign, for
example, the sequence would always be

  LA R1,address of X'21'+1 as it would be in outfield.
  MVC outfield,mask
  EDMK outfield,packednum
  BCTR R1,0
  MVI   R1,C'$'

There is another use of ED--one doesn't have to use ED or EDMK on numbers,
though it always have to be packed fields. I have used ED to take a packed time
and convert it to a displayable field, e.g.,

   AR    R0,R15                  R0 = F'HHMMSSHH'
   CVD   R0,WORKD                BINARY -> PACKED TIME
   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

(Of course the above code overwrites the two bytes preceding TS$TIME. The above
code is from a program that moves the date into the field before TS$TIME
_after_ the time has been formatted by the above code.)

Mark A. Young



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

The only requirement for the numeric data seen by the instruction, unless
field separators are being used, is that the digits seen by ED/EDMK are
packed decimal.

         TIME DEC
         ST    R0,12(,R13)
         ED    MASK,12(R13)
         ,
MASK     DC   0C' HH:MM:SS:TH',C' ',X'2120',C':',X'2020',C':'
         DC    X'2020',C'.',X'2020'

works fine.  Since I tend to isolate the mask from the output line
and move the result into the output line, I think I'd use C'0' as
the fill character, and just move the last 11 bytes of the 12 byte
mask to the final output.  This makes the result 09:36:12.45, which
is closer to what most people expect when the time of day is less
than 10 AM.


Quote:
>I think these "Instruction of the week" messages are GREAT!

>When I took S360 Assembler in a class taught at the community college, we were
>told that EDMK will not load an address in register 1 if the first character
>(digit or otherwise) printed was after significance select. Therefore we were
>taught to always pre-load register 1 with the address of the first character
>_after_ the address of X'21'. That way, if we were floating a dollar sign, for
>example, the sequence would always be

>  LA R1,address of X'21'+1 as it would be in outfield.
>  MVC outfield,mask
>  EDMK outfield,packednum
>  BCTR R1,0
>  MVI   R1,C'$'

>There is another use of ED--one doesn't have to use ED or EDMK on numbers,
>though it always have to be packed fields. I have used ED to take a packed time
>and convert it to a displayable field, e.g.,

>   AR    R0,R15                  R0 = F'HHMMSSHH'
>   CVD   R0,WORKD                BINARY -> PACKED TIME
>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

>The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

>(Of course the above code overwrites the two bytes preceding TS$TIME. The above
>code is from a program that moves the date into the field before TS$TIME
>_after_ the time has been formatted by the above code.)

>Mark A. Young

-- Steve Myers

The E-mail addresses in this message are private property.  Any use of them
to  send  unsolicited  E-mail  messages  of  a  commerical  nature  will be
considered trespassing,  and the originator of the message will be  sued in
small claims court in Camden County,  New Jersey,  for the  maximum penalty
allowed by law.



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:

>This makes the result 09:36:12.45, which
>is closer to what most people expect when the time of day is less
>than 10 AM.

My way will also print a leading zero for before 10am because the significance
indicator is encountered just before the high-order digit of the hour will be
edited.

Mark A. Young



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:

>There is another use of ED--one doesn't have to use ED or EDMK on numbers,
>though it always have to be packed fields. I have used ED to take a packed time
>and convert it to a displayable field, e.g.,
>   AR    R0,R15                  R0 = F'HHMMSSHH'
>   CVD   R0,WORKD                BINARY -> PACKED TIME
>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING
>The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

Wouldn't it be nice if IBM would invent a new constant type for use
in literals, DC, etc, especially designed for ED masks.  Instead of
using X'402120207A20207A20204B2020' you might be able to use
something like K' V999:99:99.99' and have the assembler convert it
for you.


Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:


> >There is another use of ED--one doesn't have to use ED or EDMK on numbers,
> >though it always have to be packed fields. I have used ED to take a packed time
> >and convert it to a displayable field, e.g.,

> >   AR    R0,R15                  R0 = F'HHMMSSHH'
> >   CVD   R0,WORKD                BINARY -> PACKED TIME
> >   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
> >   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

> >The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

> Wouldn't it be nice if IBM would invent a new constant type for use
> in literals, DC, etc, especially designed for ED masks.  Instead of
> using X'402120207A20207A20204B2020' you might be able to use
> something like K' V999:99:99.99' and have the assembler convert it
> for you.

Yeah, that would be cool. (J, are you listening?) Seriously, doing
something on that order would probably violate the *intent* of an
assembler and turn it into something more like a compiler. Ewwwwww!

Write a macro. Shouldn't be too difficult...

--
Bill



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:


>>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

>>The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

>Wouldn't it be nice if IBM would invent a new constant type for use
>in literals, DC, etc, especially designed for ED masks.  Instead of
>using X'402120207A20207A20204B2020' you might be able to use
>something like K' V999:99:99.99' and have the assembler convert it
>for you.

No need to invent a new constant type.  It won't work in a literal, but
you can do:

     MVC TARGET,MASK
     ED  TARGET, . . .

MASK   DC  C' ',X'212020',C':',X'2020',C':',X'2020',C'.',X'2020'

This works on HLASM, don't know about earlier assemblers.  I tried the
same thing in a literal, and HLASM complained:

 ASMA177S *** ERROR *** Delimiter error, expected blank or lefparenthesis

John?  Suggested enhancement?
--
Rich Greenberg    Work:  PM0RMG atsign WSPVM1.worldspan.com   +1 770-563-6656
N6LRT   Marietta, GA, USA   Play: richgr atsign netcom.com    +1 770-321-6507
Eastern time.    I speak for myself & my dogs only.        VM'er since CP-67
Canines:Val(Chinook,CGC,TT),Red(Husky,(RIP)),Shasta(Husky,TT) Owner:Chinook-L



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Hate to upset your applecart Mark, but ...

The 0 insert does not start until the digit select after the start
significance character.  Your fill character is C' ', so an hour
before 9 am will generate C' x...'

Quote:

>There is another use of ED--one doesn't have to use ED or EDMK on numbers,
>though it always have to be packed fields. I have used ED to take a packed time
>and convert it to a displayable field, e.g.,

>   AR    R0,R15                  R0 = F'HHMMSSHH'
>   CVD   R0,WORKD                BINARY -> PACKED TIME
>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

>The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

>(Of course the above code overwrites the two bytes preceding TS$TIME. The above
>code is from a program that moves the date into the field before TS$TIME
>_after_ the time has been formatted by the above code.)

>Mark A. Young

-- Steve Myers

The E-mail addresses in this message are private property.  Any use of them
to  send  unsolicited  E-mail  messages  of  a  commerical  nature  will be
considered trespassing,  and the originator of the message will be  sued in
small claims court in Camden County,  New Jersey,  for the  maximum penalty
allowed by law.



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK


Quote:

>When I took S360 Assembler in a class taught at the community college, we were
>told that EDMK will not load an address in register 1 if the first character
>(digit or otherwise) printed was after significance select. Therefore we were
>taught to always pre-load register 1 with the address of the first character
>_after_ the address of X'21'. That way, if we were floating a dollar sign, for
>example, the sequence would always be

>  LA R1,address of X'21'+1 as it would be in outfield.
>  MVC outfield,mask
>  EDMK outfield,packednum
>  BCTR R1,0

In one of my routines I found another case where you need to preload R1.

If the value is zero and your pattern is  . . . 202120 (a value of zero
was an unexpected value here, and was due to another error), the result
is a zero with R1 never getting set.  From the POO, R1 is not set if the
21 hits a zero digit.
--
Rich Greenberg    Work:  PM0RMG atsign WSPVM1.worldspan.com   +1 770-563-6656
N6LRT   Marietta, GA, USA   Play: richgr atsign netcom.com    +1 770-321-6507
Eastern time.    I speak for myself & my dogs only.        VM'er since CP-67
Canines:Val(Chinook,CGC,TT),Red(Husky,(RIP)),Shasta(Husky,TT) Owner:Chinook-L



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:


> writes:

> >MASK   DC  C' ',X'212020',C':',X'2020',C':',X'2020',C'.',X'2020'

> >This works on HLASM, don't know about earlier assemblers.

> Yes, that does work with the old assembler in VSE, even back in DOS/VS code, so
> it should work just fine in MVS's earlier assembliers.

> The only catch is that the length associated with MASK will be the length of
> the first constant (the C' ', i.e., lenght = 1), so one wouldn't be able to use
> L'MASK to find the real length of MASK. But if the length is needed, one could
> code

> MASK   DC  C' ',X'212020',C':',X'2020',C':',X'2020',C'.',X'2020'
> MASKLEN EQU *-MASK

> then use MASKLEN instead of L'MASK.

Thanks, Mark, for bringing up the issue of length. I was unhappy with:

Quote:
>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

because of the explicit lengths. IMHO, it's much better to use Mark's
technique for the proper length.

Bill {*filter*}

- Show quoted text -

Quote:
> Mark A. Young



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:


> >There is another use of ED--one doesn't have to use ED or EDMK on numbers,
> >though it always have to be packed fields. I have used ED to take a packed time
> >and convert it to a displayable field, e.g.,

> >   AR    R0,R15                  R0 = F'HHMMSSHH'
> >   CVD   R0,WORKD                BINARY -> PACKED TIME
> >   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
> >   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

> >The result is hh:mm:ss.th (the C':' being the X'7A' in the edit mask).

> Wouldn't it be nice if IBM would invent a new constant type for use
> in literals, DC, etc, especially designed for ED masks.  Instead of
> using X'402120207A20207A20204B2020' you might be able to use
> something like K' V999:99:99.99' and have the assembler convert it
> for you.

Sounds like a job for MacroMan (c).

Bill {*filter*} :-)



Mon, 11 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK


writes:

Quote:
>MASK   DC  C' ',X'212020',C':',X'2020',C':',X'2020',C'.',X'2020'

>This works on HLASM, don't know about earlier assemblers.

Yes, that does work with the old assembler in VSE, even back in DOS/VS code, so
it should work just fine in MVS's earlier assembliers.

The only catch is that the length associated with MASK will be the length of
the first constant (the C' ', i.e., lenght = 1), so one wouldn't be able to use
L'MASK to find the real length of MASK. But if the length is needed, one could
code

MASK   DC  C' ',X'212020',C':',X'2020',C':',X'2020',C'.',X'2020'
MASKLEN EQU *-MASK

then use MASKLEN instead of L'MASK.

Mark A. Young



Tue, 12 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:

>Hate to upset your applecart Mark, but ...

>The 0 insert does not start until the digit select after the start
>significance character.  Your fill character is C' ', so an hour
>before 9 am will generate C' x...'

Take another look at my code:

     STCK  WORKD                   GET SYSCLOCK
     LM    R0,R1,WORKD             PLACE CLOCK IN R0,R1
     GETIME TU,CLOCK=YES           CONVERT CLOCK TO CURRENT DT&TIME
     STM   R14,R15,SAVEDATE        SAVE THE DATE (MMDD,YYCC)
     XR    R0,R0                   ZERO HIGH-ORDER PART
     D     R0,=A(3)                DIVIDE OUT TU'S
     XR    R0,R0                   ZERO HIGH-ORDER PART
     D     R0,=A(100)              DIVIDE OUT HUNDREDTHS OF A SEC.
     LR    R15,R0                  SAVE HUNDREDTHS OF A SECOND
     XR    R0,R0                   ZERO HIGH-ORDER PART
     D     R0,=A(60)               DIVIDE OUT SECONDS
     MH    R0,=H'100'              R0 = F'0000SS00'
     AR    R15,R0                  RF = F'0000SSHH'
     XR    R0,R0                   ZERO HIGH-ORDER PART
     D     R0,=A(60)               DIVIDE OUT MINUTES
     MH    R1,=H'100'              R1 = F'0000HH00'
     AR    R0,R1                   R0 = F'0000HHMM'
     MH    R0,=H'10000'            R0 = F'HHMM0000'
     AR    R0,R15                  R0 = F'HHMMSSHH'
     CVD   R0,WORKD                BINARY -> PACKED TIME
     MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
     ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING
     MVC   TS$DATE(10),=X'00010802030806070405'
     TR    TS$DATE,SAVEDATE        BUILD DATE: MMDDYYCC/ ->
*                                              MM/DD/CCYY
*                                              (SAVEDATE is immediately
followed by C'/')

Notice that the mask is 13 bytes long and contains 9 digit selects (the first
of which is also the significance select). Notice also that I start editing
WORKD at an offset of 3 bytes, meaning that I will be processing 5 bytes of
WORKD. At the point in time when the ED instruction is executed, WORKD contains
XL8'0000000hhmmsshhF', or effectively WORKD+3 has XL5'0hhmmsshhF'.

Applying the mask of XL13'402120207A20207A20204B2020' to that number will
result with 40 (space) as the fill character, X'21' pulling in the zero in
front of the hours so this zero will be replaced by the fill character (space),
but at this time the significance indicator will be turned on for the next
digit because this is X'21' instead of an ordinary X'20'. The next digit, the
first digit for which we are not substituting the fill charcter, is the first
digit of the hour, so the first digit of the hour will print, no matter what
value it is. That means if the hours are less than 10 (the first digit of the
hour is zero), the first digit will print because X'21' had previously been
encountered by the "throw away zero" that preceded the first digit of the hour.

The net result is that with a mask of XL13'402120207A20207A20204B2020' will
edit to CL13'  HH:MM:SS.HH' (where there are two spaces in front of the hours,
and the part after the decimal point represent hundredths of a second).

Mark A. Young



Tue, 12 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK


Quote:

>Thanks, Mark, for bringing up the issue of length. I was unhappy with:

>>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
>>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

>because of the explicit lengths. IMHO, it's much better to use Mark's
>technique for the proper length.

This is ironic--Mark did not use Mark's technique for lengths of the edit mask
but instead hard-coded lengths after counting out the mask five times. However,
he did code an explicit length in the literal as well as a length in the
receiving field so it was obvious from the (13) and L13 in the MVC and (13) in
the ED instruction that he had intended to use 13 bytes as an edit mask.

I _do_ use Mark's technique for lengths of DSECTs, and I know he got that from
looking at IBM code. 8)

Mark A. Young



Tue, 12 Dec 2000 03:00:00 GMT  
 Instruction of the week -- EDMK

Quote:



> >Thanks, Mark, for bringing up the issue of length. I was unhappy with:

> >>   MVC   TS$TIME-2(13),=XL13'402120207A20207A20204B2020'
> >>   ED    TS$TIME-2(13),WORKD+3   EDIT THE TIME FOR VIEWING

> >because of the explicit lengths. IMHO, it's much better to use Mark's
> >technique for the proper length.

> This is ironic--Mark did not use Mark's technique for lengths of the edit mask
> but instead hard-coded lengths after counting out the mask five times. However,
> he did code an explicit length in the literal as well as a length in the
> receiving field so it was obvious from the (13) and L13 in the MVC and (13) in
> the ED instruction that he had intended to use 13 bytes as an edit mask.

Umm, good show, anyway.

Bill {*filter*} <g>

- Show quoted text -

Quote:
> I _do_ use Mark's technique for lengths of DSECTs, and I know he got that from
> looking at IBM code. 8)

> Mark A. Young



Tue, 12 Dec 2000 03:00:00 GMT  
 
 [ 24 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Instructions of the week -- LA and EX

2. Proposed D & DR instructions of the week

3. Instructions of the week -- LA and EX

4. Instruction for next week: BC

5. Instruction of the Week--LOCTR anyone?

6. Instruction of the week - BXLE

7. Week number + firstDay of week

8. DAY OF THE WEEK ROUTINE - day-week.txt (1/1)

9. DAY OF THE WEEK ROUTINE - day-week.txt (0/1)

10. Instruction Speed and instruction availability

11. emclean gone for 2 weeks

 

 
Powered by phpBB® Forum Software