Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What's the difference beween aligned and unaligned ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 6:14 pm    Post subject: What's the difference beween aligned and unaligned ?
Reply with quote

when i define varinat as below;

DCL 1 INPUT_REC ,
2 FILLER15 CHAR(01),
2 SAP_ORDER_LINE FIXED BINARY(31) UNALIGNED;

By default the fixed binary is alighend, so anyone can tell me why the input_rect length is 5 when using unaligned attribute. If by default, what's the length?
Back to top
View user's profile Send private message

PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 6:25 pm    Post subject:
Reply with quote

The length of fields never changed : FILLER15 is 1 and SAP_..... is 4.

When Aligned is used the starting position can change and the mapping can add extra bytes. If you really want to learn that, I can give you a reference.

Ah Good old days !!!
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 6:27 pm    Post subject: pls give me the reference
Reply with quote

Could you give me the reference for it? appreciate it.
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 6:31 pm    Post subject: in fact the length is changed
Reply with quote

in fact in my program , i though the record lenth is 5 so i write it to the output file which i define 5 length, but when i use the default aligned attribute to the SAP... field, the job run error at the record variant length is greater than the file length.

so it means the length changed ,right? or what happend in detail?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 6:38 pm    Post subject:
Reply with quote

check here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ibm3lr60/8.14.4.4?SHELF=&DT=20071130131006
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 6:40 pm    Post subject:
Reply with quote

As said, when aligned, extra bytes can be added.
So if the length of every field is constant, the total length of the structure can be bigger.
Follow the rules icon_lol.gif
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 6:42 pm    Post subject: but can we know how much it's added?
Reply with quote

any way to know how much it's added?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 6:59 pm    Post subject:
Reply with quote

... follow the rules ... icon_sad.gif

But you can also see that with :

- File Aid will tell you when you use the entry 8 if I remember well,
- your compiling list will tell you also.
- maybe FileManager ( don't know - possibly ).
- you can edit your file ans inspect the locations and count
- .....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Thu Jan 15, 2009 7:03 pm    Post subject:
Reply with quote

The PL/I Language Reference (link at top of this page) section 8.5 on Data Alignment indicates in some cases doubleword alignment will be used, so as much as 7 bytes could be added. Specifics depend, though -- BINARY (31) is fullword aligned, so based on your layout 3 filler bytes would be added.
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 7:18 pm    Post subject: i tried add 3 bytes , but it's wrong
Reply with quote

sitll can find the right length. vey sad icon_sad.gif
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 7:19 pm    Post subject:
Reply with quote

Robert,
Not sure. It is more complex.

Joe,

have a look here ( via File-Aid rules )
Code:
                                                  FIELD                         
 --------- FIELD LEVEL/NAME ---------- -PICTURE- -NUMBER START     END  LENGTH 
 INPUT_REC                                                   1      13      13 
 2 FILLER15                            CHAR(1)        1      1       1       1 
 2 SAP_ORDER_LINE                      BFX(31)        2      2       5       4 
 2 FILLER15                            CHAR(1)        3      6       6       1 
 2 SAP_ORDER_LINE                      BFX(31)        4     10      13       4 
 ******************************* Bottom of data ********************************
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 7:26 pm    Post subject:
Reply with quote

yes, if we just sum every field , it's sure the length is the total of every field. but for the structure, the total length will change, it's not 38 . not sure where really take effect?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 7:36 pm    Post subject:
Reply with quote

???????? the sum of every field is ( in my exemple ) 10.
The length of the structure is ( not 38 ?? ) but 13.

And the data are stored accordingly by the program in the file.

It is a question of addressing.
Back to top
View user's profile Send private message
Joe_Song
Currently Banned

New User


Joined: 22 Jan 2008
Posts: 53
Location: china

PostPosted: Thu Jan 15, 2009 7:42 pm    Post subject:
Reply with quote

So it's not fixed for the length, right? everytime the total length should not same according to the system allocation.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 7:51 pm    Post subject:
Reply with quote

I am not sure I understang correctly.
But...

To keep consistancy in your data, you MUST keep the same structure applied on the file.
It must be a matching between the data in the file and the layout.

Cheers
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 15, 2009 10:17 pm    Post subject:
Reply with quote

Hello,

I don't "speak" pl/i, but is there not a compiler option that shows the displacement of each field from some "base".

Looking at these displacements, could one see what alignment caused to the data layout?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Jan 15, 2009 10:45 pm    Post subject:
Reply with quote

That's what I said, Dick.

On the other hand, it can be a pure academic discussion.
If you use the fileds in a PL/I program, each field is written/read by its name. So no problem.

The problem - the difficulty - can happen when you read "manually-visually" data from a file with the help of a structure with aligned attribute.

Some times it is confusing.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am
No new posts Difference between COBOL for MAINFRAM... dejunzhu COBOL Programming 1 Sat Oct 31, 2015 2:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us