ZA,

You don't have to define the filler bytes exclusively to align to the 
integral boundary. You can use SYNCRONISED clause to align. The compiler 
inserts the slack bytes for you.

10 A              PIC 9(9) COMP-5. 
10 B              PIC 9(4) COMP-5. 
10 D              PIC 9(9) COMP-5 SYNCHRONIZED. 
10 E              PIC 9(4) COMP-5. 
10 F              PIC 9(9) COMP-5 SYNCHRONIZED.


Check this link for a detailed explanation of  SYNCHRONIZED clause.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3lr50/5.3.16?

If you want to see the mapping of the variables you can MAP compiler 
directive to see the variable offsets 

CBL LIST,MAP 
IDENTIFICATION DIVISION. 
PROGRAM-ID.    MAIN. 
ENVIRONMENT DIVISION. 
DATA DIVISION. 
WORKING-STORAGE SECTION. 
01 WS-REC. 
   10 A              PIC 9(9) COMP-5. 
   10 B              PIC 9(4) COMP-5. 
   10 FILLER         PIC XX. 
   10 D              PIC 9(9) COMP-5. 
   10 E              PIC 9(4) COMP-5. 
   10 FILLER         PIC XX. 
   10 F              PIC 9(9) COMP-5. 
   10 G              PIC 9(4) COMP-5. 
 
01 WS-REC1. 
   10 A1             PIC 9(9) COMP-5. 
   10 B1             PIC 9(4) COMP-5. 
   10 D1             PIC 9(9) COMP-5 SYNCHRONIZED. 
   10 E1             PIC 9(4) COMP-5. 
   10 F1             PIC 9(9) COMP-5 SYNCHRONIZED. 
   10 G1             PIC 9(4) COMP-5. 
 
PROCEDURE DIVISION. 
 
     DISPLAY 'ALIGNMENT' 
 
     GOBACK. 

Kolusu



From:   "Ze'ev Atlas" <[email protected]>
To:     [email protected]
Date:   02/23/2015 10:15 AM
Subject:        Re: A possible bug in the IBM Runtimne C library
Sent by:        IBM Mainframe Discussion List <[email protected]>



Obviously, I know that and I realized that the issue is integral 
boundaries!
I am dealing with COBOL, not PL/I but the real issue was that the order is 
the other way around (i.e. the fullword is first and the halfword is 
second, leaving a two bytes gap unaccounted for after every pair.
So I resolved it by adding a dummy two bytes variable in the end of each 
pair:

10 A PIC 9(9) COMP-5.
10 B PIC 9(4) COMP-5.
10 FILLER PIC XX.    <=== compensating for the integral boundary of the 
next pair
10 D PIC 9(9) COMP-5.
10 E PIC 9(4) COMP-5.
10 FILLER PIC XX.    <=== compensating for the integral boundary of the 
next element

This works fine.

I still do not know how to make PL/I communicate with C, but COBOL and C 
communicate like a pair of newlyweds once this was resolved.

ZA

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



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

Reply via email to