LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Sep 2000 19:31:37 GMT
Reply-To:     sashole@mediaone.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: COBOL Layouts
Comments: To: Kim_LeBouton@TOYOTA.COM
Content-Type: text/plain; format=flowed

Kim LeBouton <Kim_LeBouton@TOYOTA.COM> wrote:

>I was given an incomplete COBOL layout that isn't working when I use >the >SAS utility to create a SAS INPUT statement. Thus, I've >resorted to >writing my own (sigh!!!). > >I was given the following: > >10 INTSLS-VSA-USE PIC S9(5)V USAGE COMP-3. > >I was told by a COBOL person who also knows SAS that I should use >PD5.0. >This didn't work--lots of warning messages in my SAS log, and >no values >reported for this field. Since I know this field >shouldn't be empty, I >thought I'd try PD3.0 after reading the SAS >On-line Documentation.

Kim,

An excellent hunch! PD3. it is. The Cobol picture says simply: it is packed-decimal (comp-3), therefore measure things in half-bytes. Reserve 5 half-bytes for the digits and 1 half-byte for the sign (C for plus, D for minus). If the total number of half-bytes (including the sign!) is even, then fine, the w-value in the PD informat is that number divided by 2. (Which is the case here where we have 6 half-bytes). If the number is odd, then add 1 and then divide by 2. The sign is always in the lowest nibble (rightmost bottom), so in the case the number of half-bytes is odd, the first nibble (leftmost top) remains empty. In hex notation, a packed-decimal number is hence read top-to-bottom, left-to-right. For example, +123456789 will be stored as (hex)

13579 2468C

whereas -12345678 will be stored as

02468 1357D

>What I'm hoping is that somebody can verify that I'm correctly using >this >informat. If I use the ISPF editor, and type HEX, the field >looks like >this. > >005 >00C > >When using informat PD5.0, I get a missing variable. When I use >PD3.0, I >get numeric value of 5 in my SAS dataset. If I have chosen >the right >informat, is it the COMP-3 in the COBOL layout that would >drive me to use >PD3.0?

From the above, it should be clear that both assertions are true. You can plainly see that your hex number does represent +5.

>I hope this note makes sense.

Absolutely!

>Every time I venture into COBOL, nothing makes sense.

Some things do, but just a little. If you possess of no entertaining reading at the moment, submit your statement to comp.lang.cobol and watch the response :-).

>(As you can probably guess, I'm working in MVS land.)

"Land that I love".

Kind regards, ======================== Paul M. Dorfman Jacksonville, Fl ======================== _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.


Back to: Top of message | Previous page | Main SAS-L page