View previous topic :: View next topic
|
Author |
Message |
SlippingJimmy
New User
Joined: 21 Sep 2022 Posts: 10 Location: USA
|
|
|
|
A little background, I come from Java and JavaScript background, and PL/I is really new to me. Bear with me on this learning journey.
This is the code I am working with:
Code: |
dcl NAME varying char(8);
dcl COUNT fixed bin(15) init(0);
dcl TOTALS(5,5) char(8);
|
In the array I need to add the names in *,1 then the count in *,2.
As I understand it, in PL/I convention, the array cannot be mixed data types, in the languages I know it is easier to convert the Integer to a string and push it in the area of the array I need it in and convert it back to an Integer when I need to be an int. Well, PL/I doesn’t have that option because I scoured the documentation and read just about every built-in function known to man/woman here.
What’s the best way to handle this? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
read the pl/i reference manual whare it talks about
Aggregate combinations and mapping
..Combinations of arrays, structures, and unions
..Cross sections of arrays of structures or unions
..Structure and union operations
..Structure and union mapping
and the pages that follow |
|
Back to top |
|
|
SlippingJimmy
New User
Joined: 21 Sep 2022 Posts: 10 Location: USA
|
|
|
|
enrico-sorichetti wrote: |
read the pl/i reference manual whare it talks about
Aggregate combinations and mapping
..Combinations of arrays, structures, and unions
..Cross sections of arrays of structures or unions
..Structure and union operations
..Structure and union mapping
and the pages that follow |
I can’t use structures. I should have clarified that in the original post, my fault.
I can use
to convert it into an Integer but I can't figure out how to convert it to a string. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
SlippingJimmy wrote: |
I can’t use structures. I should have clarified that in the original post, my fault. |
Please, clarify:
1) you don't know how to use it?
2) your management doesn't know how to use it?
3) your compiler doesn't support it?
4) what else? - I cannot imagine...
If you "cannot use PL/I structures", then switch to another appropriate tool...
Or, you can define two separate arrays, with appropriate attributes! |
|
Back to top |
|
|
SlippingJimmy
New User
Joined: 21 Sep 2022 Posts: 10 Location: USA
|
|
|
|
sergeyken wrote: |
Please, clarify:
2) your management doesn't know how to use it?
|
My management stated the code I’ll be maintaining doesn’t use structs, so it isn’t important for me to learn them currently.
sergeyken wrote: |
you can define two separate arrays, with appropriate attributes!
|
Is there a way to map the names and counts to one another? The output should be as such without the brackets of course.
Code: |
[
[name], [count],
[name], [count]
]
|
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
SlippingJimmy wrote: |
Is there a way to map the names and counts to one another? The output should be as such without the brackets of course.
Code: |
[
[name], [count],
[name], [count]
]
|
|
Something like this.
Code: |
DO I = 1 TO 5;
PUT EDIT( NAMES(I), TOTALS(I) )
( A(10), F(10) );
END I; |
It's a huge problem, the total degradation of technical management... |
|
Back to top |
|
|
SlippingJimmy
New User
Joined: 21 Sep 2022 Posts: 10 Location: USA
|
|
|
|
sergeyken wrote: |
Something like this.
Code: |
DO I = 1 TO 5;
PUT EDIT( NAMES(I), TOTALS(I) )
( A(10), F(10) );
END I; |
|
Awesome thank you!
I was dreading using 2D arrays.
sergeyken wrote: |
It's a huge problem, the total degradation of technical management...
|
My manager is really good, he's trying to get me up to speed probably a little too fast but I can understand the reason. Are there really a shortage of PL/I developers? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
SlippingJimmy wrote: |
My manager is really good, he's trying to get me up to speed probably a little too fast but I can understand the reason. Are there really a shortage of PL/I developers? |
All modern experts schooled on Javas and Pythons do belong to the lost generation, forever… |
|
Back to top |
|
|
SlippingJimmy
New User
Joined: 21 Sep 2022 Posts: 10 Location: USA
|
|
|
|
sergeyken wrote: |
All modern experts schooled on Javas and Pythons do belong to the lost generation, forever… |
Not really... You can see that here but that doesn't mean COBOL and PL/I are going anywhere |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
SlippingJimmy wrote: |
sergeyken wrote: |
All modern experts schooled on Javas and Pythons do belong to the lost generation, forever… |
Not really... You can see that here but that doesn't mean COBOL and PL/I are going anywhere |
Whatever those tables show, but starting career from Java and Python is definitely the way to cerebral atrophy. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
|