                                Packed Decimal in C 
 
        Packed Decimal in C is a collection of subroutines that will convert 
IBM/370 format packed decimal numbers to C language long binary numbers and 
Also convert C language long binary to packed decimal.  These routines could  
be useful in a client server environment where data is being exchanged with 
an IBM mainframe.  IBM CICS/ESA supports C language, but C language does not 
support packed decimal data.  CICS fields like EIBDATE and EIBTIME are in  
packed decimal.  A bonus program provided to registered users will simulate 
the IBM/370 edit and mark instruction.  The edit and mark program will help 
in formatting numbers for reports. 
 
Packed Decimal in C is not public domain or free.  You may use it for a 30 
day evaluation period.  After the evaluation period you are expected to 
register. 
 
Shareware is a marketing technique that allows and encourages free sharing  
or copying of programs as a method of distribution. This practice benefits  
both users and developers. Users can test programs and become familiar with  
them before deciding whether to buy them. Shareware programs are usually  
less expensive than commercial software because there is very little  
advertising expense; most of the price you pay actually goes to the  
developer. However, none of this would be possible if the users did not do  
their part by paying for the programs they decide to use. We who write  
shareware depend on the good faith of you, the user, for our profit. When you  
pay for this and other shareware programs, you allow developers to continue  
making high quality, low-cost software available to everyone.  
 
DISCLAIMER:  Use Packed Decimal in C at your own risk. The author does not   
warrant the suitability of Packed Decimal in C for any specific purpose,  
and assumes no responsibility for damages of any kind resulting from its use.   
Use of these programs for any period of time constitutes your assumed  
acceptance of this agreement.  
 
Shareware distributors may not charge more than $8.00 per diskette to  
distribute this product.  This price restriction does not apply to CD-ROM or  
BBS distribution. 
 
Support is provided to registered users.  Problem reports and suggestions are   
also welcome from unregistered users.  We can be contacted at: 
 
        IAMBIC SOFTWARE, Inc. 
        6607 West 77th Street 
        Overland Park, Kansas  66204-3143 
 
        Compuserve:  70541,3215 
        Internet:    70541.3215@compuserve.com 
 
Telephone support is also provided for registered users.

CICS/ESA, IBM/370 are trademarks of International Business Machines, Inc.

/************************************************************ 
 
   Name:  sPackedToBin 
 
   Function: 
 
      This routine will convert IBM 370 packed decimal numbers to fixed 
      point binary numbers four bytes long. 
 
   arguments: 
 
      1.  unsigned char pointer to the packed decimal number, max length 
          is six bytes. 
 
      2.  pointer to a long int to receive the result. 
 
      3.  short int length of argument 1, the packed decimal number. 
 
   return codes: 
 
      0   success 
      1   invalid decimal digit 
      2   overflow, numbers greater than 2,147,483,647 (0x7fffff) 
      3   invalid length specified 
 
 
*************************************************************/ 
 
 
 
/************************************************************ 
 
   Name:  sBinToPacked 
 
   Function: 
 
      This routine will convert long binary number to IBM 370 packed 
      decimal format eight bytes long. 
 
   arguments: 
 
      1.  unsigned char pointer to the packed decimal number result 
          8 bytes long 
 
      2.  pointer to a long int to convert. 
 
   return codes: 
 
      0   success 
 
*************************************************************/ 


 
 
 
/************************************************************ 
 
Name:  sEdMk       ( bonus program for registered users ) 
 
Function: 
 
This routine will edit a IBM/370 packed decimal numbers under control of 
an edit mask.   The IBM/370 principles of operation manual describes 
the instruction that this routine will simulate.   This routine uses 
different edit codes because ASCII code uses 0x20, 0x21, 0x22 for space, 
'!', and '"' respectively.  The packed is changed to zone format and 
modified under control of the edit pattern.  The edited result replaces 
the edit mask.  The first byte of the edit mask is a fill byte.  The fill 
byte replaces non significant digits. 
 
Examples: 
 
                          23,000 
                        $153,237.25 
                         $$$$$$2.32CR 
 
 
Edit mask characters: 
 
    This routine               original IBM/370 EDMK codes 
 
        0x10       digit selector              0x21 
        0x11       significance starter        0x21 
        0x12       field separator             0x22 
                   other message byte 
 
arguments: 
 
1.  unsigned char pointer to an edit mask. 
 
2.  short int length of argument 1, includes length of 0x00 for end of 
    string. 
 
3.  unsigned char pointer to a packed decimal number. 
 
4.  unsigned char pointer to pointer of the 
    byte before the first significant result byte 
 
returns condition code: 
 
0.  last field is zero or of zero length 
1.  last field is less than zero 
2.  last field is greater than zero 
3.  not defined 
4.  data exception,  ( first nibble of byte is not a digit ) 
**\


                        Registration Form 
 
        QTY     Registration Type       Price           Ext. Price 
  
        ____    Single PC               $10.00          ______ 
 
 
        ____    Mainframe/Midrange      $20.00          ______ 
 
 
        ____    Unlimited Site License $100.00          ______ 
 
 
                TOTAL                                   ______ 
 
 
Registration is required for the development platform only. 
 
 
Name _______________________________________________________________ 
 
 
Company ____________________________________________________________ 
 
 
Address_____________________________________________________________ 
 
 
City ______________________________State_______Zip__________________ 
 
 
Phone/E-mail________________________________________________________ 
 
 
 
Where did you obtain your copy of Packed Decimal in C? 
 
 
_____________________________________________________________________ 
 
 
 
 
 
Mail payment to: 
 
 
 
 
        IAMBIC SOFTWARE, Inc. 
        6607 West 77th Street 
        Overland Park, Kansas  66204-3143 
 
 
 
 
 

