Re: Unsigned packed decimal
Charles (Chuck) Hardee said: >How do you arrive at that conclusion? >The example code moves data to the 2 bytes within the group called >UNSIGNED-PAKED-TIME-10 but never moves anything to the byte defined as FILLER. >The DIVIDE uses all 3 bytes as the numerator but the quotient is a completely >separate field so nothing is overlaid by it. You're right. I must have overlooked the GIVING clause yesterday. My bad. >Which instruction are you thinking destroys the upper nibble of the FILLER >byte? >I just don't see it. That's because it isn't there. Sorry, Jantje. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
On 24 Jul 2013 02:20:25 -0700, in bit.listserv.ibm-main you wrote: >Hello. > > >I have a input file where the data is stored in unsigned packed decimal >format, now i need the data to be moved to 9(4) field. Could someone let me >know how the data is retrived? Is this the COBOL unsigned decimal format - PIC 9(4) PACKED-DECIMAL/COMP-3 which would be 0F in 3 bytes or a special format where just is stored. If it is the former all that is needed in COBOL is a simple MOVE between field with the appropriate pictures? Otherewise the other posters have made good suggestions. Clark Morris > >Thanks, >Ron T > >-- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Huh? How do you arrive at that conclusion? The example code moves data to the 2 bytes within the group called UNSIGNED-PAKED-TIME-10 but never moves anything to the byte defined as FILLER. The DIVIDE uses all 3 bytes as the numerator but the quotient is a completely separate field so nothing is overlaid by it. Which instruction are you thinking destroys the upper nibble of the FILLER byte? I just don't see it. C- Charles (Chuck) Hardee Senior Systems Engineer/Database Administration CCG Information Technology Thermo Fisher Scientific 300 Industry Drive Pittsburgh, PA 15275 Direct: 724-517-2633 FAX: 412-490-9230 chuck.har...@thermofisher.com -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Jantje. Sent: Thursday, July 25, 2013 6:48 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Unsigned packed decimal On Wed, 24 Jul 2013 08:00:07 -0500, John McKown wrote: >01 UNSIGNED-PACKED-TIMES-10. > 05 UNSIGNED-PACKED PIC X(2). > 05 FILLER PIC X VALUE IS X'0F'. There be dragons... >01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(5) >PACKED-DECIMAL. >01 NORMAL-UNPACKED PIC 9(4) USAGE DISPLAY. > > >MOVE name-of-unsigned-packed-field TO UNSIGNED-PACKED OF >UNSIGNED-PACKED-TIMES-10. >DIVIDE NORMAL-PACKED BY 10 GIVING NORMAL-UNPACKED. This will work only the first time round. Next time the upper nibble of the FILLER will contain a sign nibble and your value will be incorrect... You have to re-initialise the UNSIGNED-PACKED-TIMES-10 with an INITIALISE or give the FILLER a proper name and MOVE ZERO to it. Cheers, Jantje. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
On Wed, 24 Jul 2013 08:00:07 -0500, John McKown wrote: >01 UNSIGNED-PACKED-TIMES-10. > 05 UNSIGNED-PACKED PIC X(2). > 05 FILLER PIC X VALUE IS X'0F'. There be dragons... >01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(5) >PACKED-DECIMAL. >01 NORMAL-UNPACKED PIC 9(4) USAGE DISPLAY. > > >MOVE name-of-unsigned-packed-field TO UNSIGNED-PACKED OF >UNSIGNED-PACKED-TIMES-10. >DIVIDE NORMAL-PACKED BY 10 GIVING NORMAL-UNPACKED. This will work only the first time round. Next time the upper nibble of the FILLER will contain a sign nibble and your value will be incorrect... You have to re-initialise the UNSIGNED-PACKED-TIMES-10 with an INITIALISE or give the FILLER a proper name and MOVE ZERO to it. Cheers, Jantje. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Thanks a lot to everyone to make me understand this :) -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Yes, so long at the upper nybble of the UNSIGNED-PACKED is zero. I.e. your unsigned packed is in the range x'00' to x'09'. If the first digit is not 0, then you will end up with the wrong value. Which is what I guess the "9(05)" is indicating. As Bernd indicated, it might be more efficient to say: 01 NORMAL-PACKED REDEFINES UNSIGNEG-PACKED-TIMES-10 PIC S9(6)V9 PACKED-DECIMAL. ... MOVE NORMAL-PACKED TO NORMAL-UNPACKED. The MOVE from a S9(6)V9 PACKED-DECIMAL to a S9(5) DISPLAY will simply drop the ending digit, effectively doing what the divide by 10 did in the original. On Wed, Jul 24, 2013 at 9:21 AM, Ron Thomas wrote: > Thank John for the explantion. so if suppose it is 9(05) then is the > below correct? > > 01 UNSIGNED-PACKED-TIMES-10. > 05 UNSIGNED-PACKED PIC X(3). > 05 FILLER PIC X VALUE IS X'0F'. > 01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(7) > PACKED-DECIMAL. > 01 NORMAL-UNPACKED PIC 9(5) USAGE DISPLAY. > > > Thanks, > Ron T > > > > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- This is a test of the Emergency Broadcast System. If this had been an actual emergency, do you really think we'd stick around to tell you? Maranatha! <>< John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Great idea to avoid the division. Hopefully the COBOL compiler would be intelligent enough to do an SRP instead of a DP to get rid of the extra digit. On Wed, Jul 24, 2013 at 9:54 AM, Bernd Oppolzer wrote: > John, thanks for the COBOL code; my COBOL experience dates from > the 90s, so I'm not very good in providing COBOL source examples. > > Yes, I think, this will be ok for 6 digit unsigned packed, giving a 7 digit > signed result. > > Things can be made a little easier if you define the overlaying field > (called NORMAL_PACKED in this case) having one digit after the > decimal point; then it does not have to be divided by 10 to get the > desired value. > > (in PL/1 this would be: DCL NORMAL_PACKED DEC FIXED (7,1); > don't know the correct syntax for COBOL). > > I even don't know PACKED-DECIMAL; in my times we called it > USAGE COMP-3. > > Kind regards > > Bernd > > > > Am 24.07.2013 16:21, schrieb Ron Thomas: > > Thank John for the explantion. so if suppose it is 9(05) then is the >> below correct? >> >> 01 UNSIGNED-PACKED-TIMES-10. >>05 UNSIGNED-PACKED PIC X(3). >>05 FILLER PIC X VALUE IS X'0F'. >> 01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(7) >> PACKED-DECIMAL. >> 01 NORMAL-UNPACKED PIC 9(5) USAGE DISPLAY. >> >> >> Thanks, >> Ron T >> >> >> >> --**--** >> -- >> For IBM-MAIN subscribe / signoff / archive access instructions, >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >> >> > --**--**-- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- This is a test of the Emergency Broadcast System. If this had been an actual emergency, do you really think we'd stick around to tell you? Maranatha! <>< John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
John, thanks for the COBOL code; my COBOL experience dates from the 90s, so I'm not very good in providing COBOL source examples. Yes, I think, this will be ok for 6 digit unsigned packed, giving a 7 digit signed result. Things can be made a little easier if you define the overlaying field (called NORMAL_PACKED in this case) having one digit after the decimal point; then it does not have to be divided by 10 to get the desired value. (in PL/1 this would be: DCL NORMAL_PACKED DEC FIXED (7,1); don't know the correct syntax for COBOL). I even don't know PACKED-DECIMAL; in my times we called it USAGE COMP-3. Kind regards Bernd Am 24.07.2013 16:21, schrieb Ron Thomas: Thank John for the explantion. so if suppose it is 9(05) then is the below correct? 01 UNSIGNED-PACKED-TIMES-10. 05 UNSIGNED-PACKED PIC X(3). 05 FILLER PIC X VALUE IS X'0F'. 01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(7) PACKED-DECIMAL. 01 NORMAL-UNPACKED PIC 9(5) USAGE DISPLAY. Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Thank John for the explantion. so if suppose it is 9(05) then is the below correct? 01 UNSIGNED-PACKED-TIMES-10. 05 UNSIGNED-PACKED PIC X(3). 05 FILLER PIC X VALUE IS X'0F'. 01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(7) PACKED-DECIMAL. 01 NORMAL-UNPACKED PIC 9(5) USAGE DISPLAY. Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
01 UNSIGNED-PACKED-TIMES-10. 05 UNSIGNED-PACKED PIC X(2). 05 FILLER PIC X VALUE IS X'0F'. 01 NORMAL-PACKED REDEFINES UNSIGNED-PACKED-TIMES-10 PIC S9(5) PACKED-DECIMAL. 01 NORMAL-UNPACKED PIC 9(4) USAGE DISPLAY. MOVE name-of-unsigned-packed-field TO UNSIGNED-PACKED OF UNSIGNED-PACKED-TIMES-10. DIVIDE NORMAL-PACKED BY 10 GIVING NORMAL-UNPACKED. In the above, I assumed that the "unsigned packed" field is 2 bytes or 4 decimal digits. The smallest packed field is 3 bytes or 5 decimal digits with a sign. The move places the 4 decimal digits in front of a packed zero with a sign. This implicitly multiplies it by 10. So you divide by 10 and use the GIVING phrase to get rid of the trailing zero, retaining a valid sign. On Wed, Jul 24, 2013 at 7:38 AM, Ron Thomas wrote: > I am a bit confused, can you put the same in a cobol code so that i can > have a look ? > > Thanks, > Ron T > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- This is a test of the Emergency Broadcast System. If this had been an actual emergency, do you really think we'd stick around to tell you? Maranatha! <>< John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
I am a bit confused, can you put the same in a cobol code so that i can have a look ? Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
the code is in cobol -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Which language? As you are talking about 9(4), I guess it may be COBOL. Then: put a field pic 9 usage comp-3 just behind the field with the unsigned decimal data, initialized with zero. Then you have an additional zero halfbyte and a valid sign. Then you overlay the original field by a pic 9 usage comp-3 field, which is 1 byte longer than the original field. There you will find a value which is ten times larger than the original value (because of the additional zero digit). You use this value in the normal way. Kind regards Bernd Am 24.07.2013 11:20, schrieb Ron Thomas: Hello. I have a input file where the data is stored in unsigned packed decimal format, now i need the data to be moved to 9(4) field. Could someone let me know how the data is retrived? Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Unsigned packed decimal
Ron, I assume you mean that you have a field which looks like this: X'1234' And you want to move it to a field so that it looks like this" X'F1F2F3F4' Assume: X DS XL2 Y DS XL4 TEMP DS XL5 UNPK TEMP(5),X(3) MVC Y,TEMP This will unpack the 2 bytes of unsigned packed decimal, plus the single "we don't care" byte that follows it, into the field TEMP. The UNPK will unpack the 2 bytes of packed decimal into the unpacked or zoned format, and will "flip" the zone and decimal nibbles of the 3rd byte, which we don't care about. Once unpacked, you simply move what you want from the unpacked field. Hope this helps, Chuck Charles (Chuck) Hardee Senior Systems Engineer/Database Administration CCG Information Technology Thermo Fisher Scientific 300 Industry Drive Pittsburgh, PA 15275 Direct: 724-517-2633 FAX: 412-490-9230 chuck.har...@thermofisher.com -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Ron Thomas Sent: Wednesday, July 24, 2013 5:20 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Unsigned packed decimal Hello. I have a input file where the data is stored in unsigned packed decimal format, now i need the data to be moved to 9(4) field. Could someone let me know how the data is retrived? Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Unsigned packed decimal
Hello. I have a input file where the data is stored in unsigned packed decimal format, now i need the data to be moved to 9(4) field. Could someone let me know how the data is retrived? Thanks, Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN