Hi All,
Could any one guide me for creating array to substitute the below cobol statment's
When 1
Add +1 to choice-1
When 2
Add +2 to choice-2
.
.
.
.
When 140
Add +140 to choice-140
your help is deeply appreciated.
Thanks
Creating array to substitute the below cobol statment
-
- Posts: 110
- Joined: Thu Dec 27, 2007 5:18 pm
- Skillset: Known little stuffs to answer a few queries!!
- Referer: Google
- Contact:
Re: Array creation.
Code something like.
Where n is the value in the evaluate class.
Post if you have any problems. Arun
Code: Select all
WORKING-STORAGE SECTION.
01 CHOICE-TABLE.
05 CHOICE PIC 9(08) OCCURS 140 TIMES.
PROCEDURE DIVISION.
IF NOT (N < 1 AND N > 140)
ADD +1 TO CHOICE(N)
ELSE
YOUR WHEN OTHERS CASE
END-IF.
Where n is the value in the evaluate class.
Post if you have any problems. Arun
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Array creation.
Hello,
Please note in the posted suggestion, there is no initial value in the counters. They should be set to zero before being used as accumulators. As is, invalid totals may result or an abend may occur.
I am also not sure about the requirement that adds 1 when the "value" is a 1 and adds 2 when the "value" is a 2 and so on. I believe that the suggested code (which is not the same as the request) is what is needed.
Please note in the posted suggestion, there is no initial value in the counters. They should be set to zero before being used as accumulators. As is, invalid totals may result or an abend may occur.
I am also not sure about the requirement that adds 1 when the "value" is a 1 and adds 2 when the "value" is a 2 and so on. I believe that the suggested code (which is not the same as the request) is what is needed.
Hope this helps,
d.sch.
d.sch.
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Creating Unix Directory using COBOL in Unix 0n Z/OS
by Heisenberg » Mon Jun 26, 2023 4:36 pm » in IBM Cobol - 2
- 3039
-
by Robert Sample
View the latest post
Wed Jul 05, 2023 6:36 pm
-
-
- 6
- 3124
-
by willy jensen
View the latest post
Thu Dec 05, 2024 11:59 pm
-
-
Need help in a rexx scenario for creating and updating PDS
by princesam89 » Fri Feb 02, 2024 4:20 pm » in CLIST & REXX - 3
- 2385
-
by willy jensen
View the latest post
Sat Feb 03, 2024 8:07 pm
-
-
-
Array processing and Table handling with packed decimal
by rogerstrycova » Tue Oct 26, 2021 3:55 pm » in IBM Cobol - 2
- 1712
-
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
- 5552
-
by JgbCobol
View the latest post
Tue Nov 08, 2022 12:32 pm
-