# total number of bytes

Author Message
grasshopper

New User

Joined: 22 Jul 2021
Posts: 12
Location: germany

 Posted: Thu Jul 22, 2021 3:23 pm how many bytes will bee allocated for the below variable declaration? DCL 1 SATZ 3 TAB (2,5), 5 F1 BIN FIXED (15), 5 F2 BIT (16), 5 F3 DEC FIXED (15,7), 5 F4 PIC ‘999V,9‘, 3 F5 PIC ‘(3)9‘; I found the below but not sure if an array is defined? please help. F1 = 15 bits F2 = 16 bits F3 = 15 bytes F4 = 4 bytes F5 = 3 bytes
Garry Carroll

Senior Member

Joined: 08 May 2006
Posts: 1119
Location: Dublin, Ireland

 Posted: Thu Jul 22, 2021 4:03 pm F1 = 16 bits / 4 bytes (allow for the sign bit) F2 = 16 bits / 4 bytes F3 = 8 bytes @ 2 digits per byte + the sign nibble F4 = 5 byte there are 4 digits plus the comma F5 = 3 bytes The structure is a two-dimensional array ( TAB (2,5), ) with 10 elements and each instance has the above structure. Garry
sergeyken
Warnings : 2

Senior Member

Joined: 29 Apr 2008
Posts: 1231

 Posted: Thu Jul 22, 2021 4:47 pm 1) 16 bits = 2 bytes, but not 4 of them… 2) even BIN FIXED(5) would require 2 bytes = 16 bits in memory; it’s all rounded to the nearest hardware-supported size 3) DEC FIXED(15,7), and DEC FIXED(14,7) both require the same 8 bytes in memory 4) PIC ‘999’, and PIC ‘S999’ both require the same 3 bytes in memory, because the sign value is compacted with the last digit into the last byte In general, it is a good idea to learn about data format implementation in the mainframe architecture, to understand this better (if needed).
grasshopper

New User

Joined: 22 Jul 2021
Posts: 12
Location: germany

Posted: Sat Jul 24, 2021 9:56 pm

 Garry Carroll wrote: F1 = 16 bits / 4 bytes (allow for the sign bit) F2 = 16 bits / 4 bytes F3 = 8 bytes @ 2 digits per byte + the sign nibble F4 = 5 byte there are 4 digits plus the comma F5 = 3 bytes The structure is a two-dimensional array ( TAB (2,5), ) with 10 elements and each instance has the above structure. Garry

but F5 is in level 3 which is same level as the array declaration.
only the level 5 elements are inside the level 5 TAB?
sergeyken
Warnings : 2

Senior Member

Joined: 29 Apr 2008
Posts: 1231

Posted: Sun Jul 25, 2021 2:20 am

You need align your code properly, to avoid senseless questions in the future
 Code: DCL 1 SATZ,        3 TAB (2,5),      inner group of elements (level 5) repeats 2*5=10 times          5 F1 BIN FIXED (15),   one element 2 bytes (16 bits)          5 F2 BIT (16),          one element 2 bytes (16 bits)          5 F3 DEC FIXED (15,7),   one element 8 bytes          5 F4 PIC ‘999V,9‘,    one element 5 bytes        3 F5 PIC ‘(3)9‘;    single element after repeated group, 3 bytes

Now use a calculator, to count the total size.
Take into account the alignment of BIN FIXED(15): if the previous group ended at an odd byte offset, then the following BIN FIXED(15) shall start at the nearest even byte offset, and one extra byte may be skipped. This would not happen when extra attribute UNALIGNED has been used.
Also, a comma was missing in your sample, after SATZ (e.g. SENTENCE?)
enrico-sorichetti

Superior Member

Joined: 14 Mar 2007
Posts: 10803
Location: italy

 Posted: Sun Jul 25, 2021 4:15 am did anybody hear about the compile option AGGREGATE read the manual about the borderline cases where the results might be misleading
grasshopper

New User

Joined: 22 Jul 2021
Posts: 12
Location: germany

Posted: Sun Jul 25, 2021 12:25 pm

sergeyken wrote:
You need align your code properly, to avoid senseless questions in the future
 Code: DCL 1 SATZ,        3 TAB (2,5),      inner group of elements (level 5) repeats 2*5=10 times          5 F1 BIN FIXED (15),   one element 2 bytes (16 bits)          5 F2 BIT (16),          one element 2 bytes (16 bits)          5 F3 DEC FIXED (15,7),   one element 8 bytes          5 F4 PIC ‘999V,9‘,    one element 5 bytes        3 F5 PIC ‘(3)9‘;    single element after repeated group, 3 bytes

Now use a calculator, to count the total size.
Take into account the alignment of BIN FIXED(15): if the previous group ended at an odd byte offset, then the following BIN FIXED(15) shall start at the nearest even byte offset, and one extra byte may be skipped. This would not happen when extra attribute UNALIGNED has been used.
Also, a comma was missing in your sample, after SATZ (e.g. SENTENCE?)

please explain difference between dec fixed and PIC - both are decimal.
what is a packed numeric data? how to define it? THANKS. (am learning PL1)
sergeyken
Warnings : 2

Senior Member

Joined: 29 Apr 2008
Posts: 1231

 Posted: Sun Jul 25, 2021 5:20 pm In that case you need some basic knowledge of Assembler. DEC FIXED stands for “packed decimal”, or DS P in Assembler. PIC stands either for “unpacked decimal” (DS Z in Assembler), or for a “character string” (DS C in Assembler). I doubt this info might help, unless you start learning something from mainframe concepts.
sergeyken
Warnings : 2

Senior Member

Joined: 29 Apr 2008
Posts: 1231

 Posted: Sun Jul 25, 2021 6:33 pm I guess the last time I read any PL/I manual was about 35-40 years ago. But I’m pretty sure all the details you are interested in have been expounded in details in the most part of available manuals. At least, I personally have got all this information from those manuals - at that time neither web forums, nor Internet itself had been known.
grasshopper

New User

Joined: 22 Jul 2021
Posts: 12
Location: germany

Posted: Sun Jul 25, 2021 7:37 pm

 sergeyken wrote: I guess the last time I read any PL/I manual was about 35-40 years ago. But I’m pretty sure all the details you are interested in have been expounded in details in the most part of available manuals. At least, I personally have got all this information from those manuals - at that time neither web forums, nor Internet itself had been known.

if we all have the time and expertise to read manuals all the time, then there is no need for auto repairshops, painters, electricians, even this blog.
u must be feeling unrecognized.
so here i say it, you are a expert in pl1 and have more knowledge than others, i bet. I also say a BIG THANK YOU for taking the time to help me and ohers in this forum. But there is a reason am working on the weekend with no editor with me.
AGAIN a BIG THANK YOU for helping me understand the declarations.
PLEASE continue to do so. THANK YOU.
sergeyken
Warnings : 2

Senior Member

Joined: 29 Apr 2008
Posts: 1231

 Posted: Sun Jul 25, 2021 9:56 pm You might be angry at me, but without a serious learning of the very basic ideas and concepts you are condemned to stuck again and again at every new development step assigned to you. Just getting a short answer to each separate issue (out of thousands) would not help you to become an expert in any area. This forum cannot be a schoolbook to explain everything, starting from the very basic concepts.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics how to convert and use 1 bit hex-numb... COBOL Programming 10 Build a trailer with total an count SYNCSORT 6 Merge a variable number of records fr... DFSORT/ICETOOL 5 Chained RPL - How to get RRN number. JCL & VSAM 0 how to list the number of backup data... JCL & VSAM 3
Search our Forums: