Hi,
I'm a newbie to PL1 and hope that someone can help with what I hope is a simple issue.
I'm declaring a constant in the program with repeating values so have defined it as follows:
DCL FIELD_A CHARACTER (80) INIT (40) '**';
However, it is giving me a compile error:
Message Line.File Message Description
IBM1352I E 8.0 The statement element '**' is invalid. The statement will be ignored.
I've tried different variations of this bit always with an error. It seems to follow any syntactical guidance I can find in PL1 manuals but obviously I am missing something here.
All help is appreciated.
Thanks in advance,
Eamonn
pl1 character string constant declaration
-
- Posts: 7
- Joined: Tue Apr 02, 2019 1:36 am
- Skillset: Cobol, JCL, VSAM, CICS DB2
- Referer: Online
- 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: pl1 character string constant declaration
Code: Select all
dcl whatever char(80) init ((40)'**');
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Posts: 7
- Joined: Tue Apr 02, 2019 1:36 am
- Skillset: Cobol, JCL, VSAM, CICS DB2
- Referer: Online
Re: pl1 character string constant declaration
Thank you very much Robert, seems so intuitive when you see the solution.
All the best,
Eamonn
All the best,
Eamonn
- 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: pl1 character string constant declaration
Next time use the proper name for the language, it's PL/I.
And for what it's worth, I think you can use
in Enterprise PL/I, saving you the trouble of changing the repetition factor when the length of a string (or bounds of an array) change. And mentioning arrays, never use
but always
and check out the PL/I builtin functions for a lot more of similar ones that help you to avoid hardcoding bounds, lengths, etc.

And for what it's worth, I think you can use
Code: Select all
dcl whatever char (123) init ((*)'!');
in Enterprise PL/I, saving you the trouble of changing the repetition factor when the length of a string (or bounds of an array) change. And mentioning arrays, never use
Code: Select all
dcl array(-1:33) fixed bin (31) init ((*)0);
do i = -1 to 31;
....
end;
but always
Code: Select all
do i = lbound(array, 1) to hbound(array, 1);
....
end;
and check out the PL/I builtin functions for a lot more of similar ones that help you to avoid hardcoding bounds, lengths, etc.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Similar Topics
- Replies
- Views
- Last post
-
-
How to overlay a constant value in PD format
by Shambu » Mon Jun 28, 2021 11:56 pm » in Syncsort/Synctool - 1
- 3494
-
by sergeyken
View the latest post
Tue Jun 29, 2021 1:18 am
-
-
-
Replace a string with another string with different length
by Devrana » Sun Jan 19, 2025 3:23 pm » in JCL - 1
- 1632
-
by sergeyken
View the latest post
Sun Jan 19, 2025 11:07 pm
-
-
- 4
- 1685
-
by Pedro
View the latest post
Sat Oct 30, 2021 6:48 am
-
- 6
- 2611
-
by sergeyken
View the latest post
Fri May 09, 2025 12:52 am
-
-
Retain non numeric character in IFTHEN - BUILD
by Shambu » Wed Dec 01, 2021 5:00 pm » in Syncsort/Synctool - 1
- 1966
-
by sergeyken
View the latest post
Sat Dec 04, 2021 2:28 pm
-