Billy,

It is quite simple to convert the Binary/Packed to readable format.  Few 
clarifications needed

•       You seem to have an OVERLAP from Binary3 field onwards. Ie, if you 
start Binary field-3 at 96 and it occupies 2 bytes then the next text field 
should start at 98. You show that it starts at 97 which is incorrect. The 
following fields are off by 1 byte.
•       Remember both COMP(Binary) and COMP-3 (Packed Decimal) Fields can 
contain NEGATIVE numbers.  Don't want a SIGN (+ or - ) when converting them to 
DISPLAYABLE data?
•       Decimal 1 field has 4 decimal digits as per the COBOL defintion.  Don't 
you want to show it with decimal point? Ie 1048732.2488 instead of 10487322488 ?



I assumed the following COBOL layout.

01 INPUT-LAYOUT.
   05 TXT-FIELD-01              PIC X(23).
   05 BIN-FIELD-01              PIC S9(08) COMP.
   05 TXT-FIELD-02              PIC X(66).
   05 BIN-FIELD-02              PIC 9(03) COMP.
   05 BIN-FIELD-03              PIC S9(04) COMP.
   05 TXT-FIELD-03              PIC X(15).
   05 DEC-FIELD-01              PIC S9(11)V9999 COMP-3.
   05 DEC-FIELD-02              PIC S9(09) COMP-3.
   05 TXT-FIELD-04              PIC X(22).

Going with your descrption here are the sample control cards ( This will create 
a 176 byte file )

//SYSIN    DD *
  OPTION COPY
  OUTREC BUILD=(001,23,                      # TXT-FIELD-01
                024,04,BI,M11,LENGTH=10,     # BIN-FIELD-01
                028,66,                      # TXT-FIELD-02
                094,02,BI,M11,LENGTH=08,     # BIN-FIELD-02
                096,02,BI,M11,LENGTH=06,     # BIN-FIELD-03
                098,15,                      # TXT-FIELD-03
                113,08,PD,M11,LENGTH=16,     # DEC-FIELD-01
                121,05,PD,M11,LENGTH=10,     # DEC-FIELD-02
                126,22)                      # TXT-FIELD-04
/*


You can find about M10 and other edit masks here 
https://www.ibm.com/docs/en/zos/3.2.0?topic=statements-outfil-control  ( search 
for Table 8. Edit mask patterns)

Alternatlively instead of using the pre-defined mask 10, you can code the edit 
mask as follows.  ( Code the “n” of “T”’s to cater to length.  If you want the 
leading zeroes supressed then code “I” (capital i)

024,04,BI,EDIT=(TTTTTTTTTT)

If you decide to add the positive and negative signs , then it is an easy fix.

Thanks,
Kolusu


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

Reply via email to