Hi,
I need to initialize only the second level of a two-d array in cobol and preserve the filrst level without looping using a perform varying statement to the second level. Is there any way without using the subscript?
Ex -
01 ws-item-count occurs 9 times.
05 ws-item-1 X(1).
05 ws-item-2 x(2).
05 ws-item-3 occurs 4 times.
10 ws-it3-a1 X(01).
10 ws-it3-a2 x(01).
10 ws-it3-a3 x(01).
Now i need to initialize only WS-ITEM-3 (which occurs 4 times but need to save the upper items at level 1 of the array)
Thanks in advance.
Abhinav
Initialize second level of a two dimensional array
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Initialize second level of a two dimensional array
Hello and welcome to the forums,
If you better explain the real requirement, someone may have suggestions.
What determined this requirement? It makes no sense. . .I need to initialize only the second level of a two-d array in cobol and preserve the filrst level without looping using a perform varying statement to the second level. Is there any way without using the subscript?
Sure, define the arrays with an index instead.Is there any way without using the subscript?
If you better explain the real requirement, someone may have suggestions.
Hope this helps,
d.sch.
d.sch.
Re: Initialize second level of a two dimensional array
Well the code logic is such that we check for broken policies- by populating the 2 dimension first for each 1st D item now if we find that if any variable in the 2D of the array satisfies our criteria of a policy not broken we need to retain the 1st D item and move spaces to all the elements of the 2D indicating that the 1st D item is not broken for the output report.
Thus leading to the requirement - The broken policy pertain to Auto insurance sector where in the 1st D is for the number of vehicles on the policy and the 2 D is for the number of people driving the vehicle. Now if any of the drivers satisfy the condition we are looking for a particular vehicle we need to mark that policy asa not broken. Hope that makes a little sense wrt to the question asked by me.
We cannot move spaces to the vehicle count but need to remove all drivers for that vehicle before writing out the report.
Thanks in advance.
Thus leading to the requirement - The broken policy pertain to Auto insurance sector where in the 1st D is for the number of vehicles on the policy and the 2 D is for the number of people driving the vehicle. Now if any of the drivers satisfy the condition we are looking for a particular vehicle we need to mark that policy asa not broken. Hope that makes a little sense wrt to the question asked by me.
We cannot move spaces to the vehicle count but need to remove all drivers for that vehicle before writing out the report.
Thanks in advance.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Initialize second level of a two dimensional array
Hello,
How does that info relate to doing what you need without looping or using the subscript?
To navigate thru the array you will both loop and use the subscript.
I see nothng in your explanaton of the requirement that would cause problems if the code looped and used a subscript
How does that info relate to doing what you need without looping or using the subscript?
To navigate thru the array you will both loop and use the subscript.
I see nothng in your explanaton of the requirement that would cause problems if the code looped and used a subscript

Hope this helps,
d.sch.
d.sch.
Re: Initialize second level of a two dimensional array
Hello,
Well i also know that there would be no problem by looping thru thr array to initialize the second level
......but i just wanted to know if there was any other or better way to go about it other...cos writing an initialize statement for a Group variable would be a whole lot simpler than using a Perform varying statement on the array.
Well thanx neways....
Well i also know that there would be no problem by looping thru thr array to initialize the second level

Well thanx neways....
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Initialize second level of a two dimensional array
You're welcome
d

d
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1
- 4427
-
by TERMEN
View the latest post
Thu Mar 04, 2021 2:29 am
-
- 1
- 1679
-
by enrico-sorichetti
View the latest post
Sat Jun 12, 2021 12:18 pm
-
- 0
- 1351
-
by yodish
View the latest post
Thu Dec 24, 2020 3:23 am
-
-
Array processing and Table handling with packed decimal
by rogerstrycova » Tue Oct 26, 2021 3:55 pm » in IBM Cobol - 2
- 1723
-
by Robert Sample
View the latest post
Wed Oct 27, 2021 1:12 am
-
-
-
Error invoking java method (array) IGZ0045S
by JgbCobol » Mon Nov 07, 2022 3:54 pm » in Mainframe Java - 2
- 5561
-
by JgbCobol
View the latest post
Tue Nov 08, 2022 12:32 pm
-