IBM Mainframe Discussion List <[email protected]> wrote on 
04/24/2013 11:41:53 AM:

> From: Steve Comstock <[email protected]>

> > No. The hardward does not recognize any such animal as an unsigned
> > packed decimal digit.

But clever Assembler programmers created such fields.  Just this week I 
worked on an S0C7 because some clever person introduced character data 
into a packed unsigned field.

If you have to deal with these kinds of fields in Cobol, you need:

ENVIRONMENT DIVISION. 
CONFIGURATION SECTION. 
SPECIAL-NAMES. 
    CLASS packedNosignNumeric IS X'00' THROUGH X'09'
         X'10' THROUGH X'19'
         X'20' THROUGH X'29'
         X'30' THROUGH X'39'
         X'40' THROUGH X'49'
         X'50' THROUGH X'59' 
         X'60' THROUGH X'69'
         X'70' THROUGH X'79'
         X'80' THROUGH X'89'
         X'90' THROUGH X'99'
    .

DATA DIVISION. 
WORKING-STORAGE SECTION.
        01.
          05 P4V1                           PIC 9999V9    COMP-3 
                                                          VALUE ZERO.
          05 REDEFINES P4V1.
            10 P4NS                         PIC XX.
            10                              PIC X.

If the packedNosignNumeric fails on a test, we use an Assembler subroutine 
to convert to character.  A clever programmer can do it in Cobol.

btw somewhere in this conversation, there was a statement about the 
character comparison of fields of different lengths.

Sendus interruptus

6.1.6.5.1  Alphanumeric comparisons

Operands of unequal size: If the operands are of unequal size, the 
           comparison is made as though the shorter operand were extended 
           to the right with enough spaces to make the operands equal in 
           size.

6.1.6.5.5  Group comparisons

A group comparison is a comparison of the alphanumeric character values 
of two operands. 
  
For the comparison operation, each operand is treated as though it were an 

elementary data item of category alphanumeric of the same size as the 
operand, in bytes. The comparison then proceeds as for two elementary 
operands of category alphanumeric, as described in "Alphanumeric 
comparisons" in topic 6.1.6.5.1.  

-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to