Hi All, Hoping you are doing well.
Just for my understanding on the PL1 concepts of based and defined I was trying to do the below but getting compilation error.
DCL C FIXED DEC(5,0) INIT(10);
DCL C_DEF CHAR(02) DEF C;
I am getting -> IBM1385I E Invalid DEFINED - string overlay defining attempted.
( I have even tried doing the same using BASED but to no avail)
Does it mean that we cannot do this way?
I was just trying to think it in terms of Cobol redefine where we have numeric value of date and can redefine it in char.
Please advise whether it is possible in PL1 as I am new to PL1 arena.
Thanks in advance.
DEFINED and BASED query
- prino
- Posts: 641
- Joined: Wed Mar 11, 2009 12:22 am
- Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
- Referer: Google
- Location: Vilnius, Lithuania
- Contact:
Re: DEFINED and BASED query
Code: Select all
dcl c_based char(2) based(addr(c));
dcl 1 * union,
2 c fixed (5),
2 cc char (3);
And it is PL/I, not PL1
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Posts: 5
- Joined: Mon Aug 23, 2021 5:01 pm
- Skillset: Cobol pl1 jcl db2 cics ims clist easytrieve
- Referer: Website
Re: DEFINED and BASED query
Thanks Robert for the reply and indeed for PL1-> PL/I thing 
Also, I am trying to test this below but getting Invalid DEFINED - string overlay defining attempted compilation error.
DCL A FIXED DEC(7,1) INIT(0);
DCL AX CHAR(3) DEF A;
PUT SKIP LIST ('A IS:',A);
PUT SKIP LIST ('AX IS:',AX);
is it that I have to set some compiler option to overcome this?
Because I have seen exactly the same code in one of the existing program ( but not able to test that as it belongs to some other system and present in endevor)
If it has been there in prod then why I am getting error while testing using my own compile JCL.
Maybe some compiler option need to be active?
Thanks

Also, I am trying to test this below but getting Invalid DEFINED - string overlay defining attempted compilation error.
DCL A FIXED DEC(7,1) INIT(0);
DCL AX CHAR(3) DEF A;
PUT SKIP LIST ('A IS:',A);
PUT SKIP LIST ('AX IS:',AX);
is it that I have to set some compiler option to overcome this?
Because I have seen exactly the same code in one of the existing program ( but not able to test that as it belongs to some other system and present in endevor)
If it has been there in prod then why I am getting error while testing using my own compile JCL.
Maybe some compiler option need to be active?
Thanks
-
- Posts: 5
- Joined: Mon Aug 23, 2021 5:01 pm
- Skillset: Cobol pl1 jcl db2 cics ims clist easytrieve
- Referer: Website
Re: DEFINED and BASED query
Hi Robert, also as you suggested I tested the based thing the union way you suggested but it is not displaying what I was expecting:
I moved 12 to -> c fixed (5) and was expecting that c_based will also display 12 but it is not.
Same way I tried to move 10 to c_based and was expecting C to have the same value but it is causing data exception somehow. (IBM0537S ONCODE=8097 Data exception).
do you have any idea please suggest what I might be doing wrong.
I moved 12 to -> c fixed (5) and was expecting that c_based will also display 12 but it is not.
Same way I tried to move 10 to c_based and was expecting C to have the same value but it is causing data exception somehow. (IBM0537S ONCODE=8097 Data exception).
do you have any idea please suggest what I might be doing wrong.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: DEFINED and BASED query
AusZosGuy wrote:Hi Robert, also as you suggested I tested the based thing the union way you suggested but it is not displaying what I was expecting:
I moved 12 to -> c fixed (5) and was expecting that c_based will also display 12 but it is not.
Same way I tried to move 10 to c_based and was expecting C to have the same value but it is causing data exception somehow. (IBM0537S ONCODE=8097 Data exception).
do you have any idea please suggest what I might be doing wrong.
After the value 12 has been "moved" to a DEC FIXED(5) variable, its value is stored in memory (as hex, 3 bytes) like '00012C'X
When trying to print this value as CHAR(3) it is printed as 3 characters:
#1: code '00'X - non-printable character
#2: code '01'X - non-printable character
#3: code '2C'X - non-printable character
What you are trying to do has no sense, at all, from the very beginning.
I recommend you to start studying the Computer Science from scratch, and then to learn PL/I basics, and syntax.
Before that, do not try to create any real program, except simple and trivial tests.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Posts: 5
- Joined: Mon Aug 23, 2021 5:01 pm
- Skillset: Cobol pl1 jcl db2 cics ims clist easytrieve
- Referer: Website
Re: DEFINED and BASED query
Thanks Sergeyken for your time to reply, agree with you, I will study it.
Guess I got confused with decimal as normal INT in COBOL like 9(5) where as it is equivalent to comp-3 which is packed decimal.
So I have tried using PIC type in PL/I and moving fixed dec to pic and then CHAR defined on this pic and it worked fine.
DCL A FIXED DEC(7,1) INIT(0);
DCL A_PIC PIC '(7)9'
DCL AX CHAR(7) DEF A_PIC;
DCL A_NUMB PIC '(06)9' INIT(0);
DCL A_CHAR CHAR(6) DEF A_NUMB;
A_PIC = A;
PUT SKIP LIST ('A:',A);
PUT SKIP LIST ('A_PIC:',A_PIC);
PUT SKIP LIST ('AX:',AX);
PUT SKIP LIST ('A_NUMB:',A_NUMB);
PUT SKIP LIST ('A_CHAR:',A_CHAR);
Thanks.
Guess I got confused with decimal as normal INT in COBOL like 9(5) where as it is equivalent to comp-3 which is packed decimal.
So I have tried using PIC type in PL/I and moving fixed dec to pic and then CHAR defined on this pic and it worked fine.
DCL A FIXED DEC(7,1) INIT(0);
DCL A_PIC PIC '(7)9'
DCL AX CHAR(7) DEF A_PIC;
DCL A_NUMB PIC '(06)9' INIT(0);
DCL A_CHAR CHAR(6) DEF A_NUMB;
A_PIC = A;
PUT SKIP LIST ('A:',A);
PUT SKIP LIST ('A_PIC:',A_PIC);
PUT SKIP LIST ('AX:',AX);
PUT SKIP LIST ('A_NUMB:',A_NUMB);
PUT SKIP LIST ('A_CHAR:',A_CHAR);
Thanks.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: DEFINED and BASED query
DEC FIXED in PL/I is equivalent to COMP-3 in COBOL.
BIN FIXED in PL/I is equivalent to COMP (or COMP-1) in COBOL.
In both cases it makes absolutely no sense to re-define different data types at the same location of memory, as shown in your post.
You did not explain your final goal, but your intermediate example is absolutely senseless.
BIN FIXED in PL/I is equivalent to COMP (or COMP-1) in COBOL.
In both cases it makes absolutely no sense to re-define different data types at the same location of memory, as shown in your post.
You did not explain your final goal, but your intermediate example is absolutely senseless.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Posts: 5
- Joined: Mon Aug 23, 2021 5:01 pm
- Skillset: Cobol pl1 jcl db2 cics ims clist easytrieve
- Referer: Website
Re: DEFINED and BASED query
Thanks Sergeyken for your feedback!!
I was just fiddling around to see if it was possible to achieve such thing in PL/I, no real requirement as such !!
I am just trying to explore different attributes/variables/features of the language.
Believe PL/1 is far more versatile than Cobol with lots of builtin functions and other stuff.
I am a learner here and appreciate all the feedback.
I am happy that people are active here and replying too
Have a great weekend!!
I was just fiddling around to see if it was possible to achieve such thing in PL/I, no real requirement as such !!
I am just trying to explore different attributes/variables/features of the language.
Believe PL/1 is far more versatile than Cobol with lots of builtin functions and other stuff.
I am a learner here and appreciate all the feedback.
I am happy that people are active here and replying too

Have a great weekend!!
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1
- 6542
-
by prino
View the latest post
Mon Mar 21, 2022 8:18 pm
-
-
SORT the records based on the second word
by seethahexa » Wed Aug 19, 2020 1:30 pm » in DFSORT/ICETOOL/ICEGENER - 1
- 1389
-
by sergeyken
View the latest post
Wed Aug 19, 2020 6:08 pm
-
-
- 3
- 1781
-
by Blackthorn
View the latest post
Fri Mar 05, 2021 9:34 pm
-
-
How To display the count based on a specific string?
by Chintu333 » Fri Aug 19, 2022 12:59 am » in DFSORT/ICETOOL/ICEGENER - 3
- 2063
-
by sergeyken
View the latest post
Fri Aug 19, 2022 8:52 pm
-
-
-
Create multiple records based on one record within a file.
by chillmo » Thu Aug 11, 2022 3:54 am » in Syncsort/Synctool - 5
- 7669
-
by sergeyken
View the latest post
Fri Aug 12, 2022 2:23 am
-