“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Hi
I do not have access to a compiler :-( so cannot test this answer . . . . .
Take a look at the "LENGTH OF " special register in the manual.
Something like
move length of FIREPEAT-FIELDS to tot-len.
compute no-occurs = (tot-len - 50) / 138.
Note the 138 above should be the length of each occurrence in the table, but the actual value could be up or down a couple according to how you are handling signs/decimal places in the compiled object.
The other thing to look at is the use of the "COUNT OF", this returns the number of times an item OCCURS. Your group that occurs is defined as FILLER, so it cannot be used on this. However, this could well work:
move COUNT OF FIREPEAT-TXT-ID to no-occurs.
I hope one of these helps
Cheers
Nigel
“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Hi
I do not have access to a compiler :-( so cannot test this answer . . . . .
Take a look at the "LENGTH OF " special register in the manual.
Something like
move length of FIREPEAT-FIELDS to tot-len.
compute no-occurs = (tot-len - 50) / 138.
Note the 138 above should be the length of each occurrence in the table, but the actual value could be up or down a couple according to how you are handling signs/decimal places in the compiled object.
The other thing to look at is the use of the "COUNT OF", this returns the number of times an item OCCURS. Your group that occurs is defined as FILLER, so it cannot be used on this. However, this could well work:
move COUNT OF FIREPEAT-TXT-ID to no-occurs.
I hope one of these helps
Cheers
Nigel
“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Hi
I do not have access to a compiler :-( so cannot test this answer . . . . .
Take a look at the "LENGTH OF " special register in the manual.
Something like
move length of FIREPEAT-FIELDS to tot-len.
compute no-occurs = (tot-len - 50) / 138.
Note the 138 above should be the length of each occurrence in the table, but the actual value could be up or down a couple according to how you are handling signs/decimal places in the compiled object.
The other thing to look at is the use of the "COUNT OF", this returns the number of times an item OCCURS. Your group that occurs is defined as FILLER, so it cannot be used on this. However, this could well work:
move COUNT OF FIREPEAT-TXT-ID to no-occurs.
I hope one of these helps
Cheers
Nigel
“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Russell, use COPY copybookname REPLACING ==10 FILLER OCCURS== BY ==10 FILLER-FIREPEAT OCCURS==.
This changes the source in the copybook to give the group a name that can be used with the COUNT special register. (Search the Language Reference Manual for 'special register'.)
Then in the procedure division you can use COUNT OF FILLER-FIREPEAT to represent the number of OCCURS.
“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Tom, Thank You very much. That resolved the issue. I really appreciate it!
“Hello” from Russell Haile with DPC. Please allow me to ask for help.
I’m working on a program. The attached copybook states:
******** FIREPEAT-OP-VAR-DATA ********
05 FIREPEAT-FIELDS.
08 FIREPEAT-SUBFIELDS.
10 FIREPEAT-TXT-TITLE
PIC X(00050).
10 FILLER OCCURS 15.
15 FIREPEAT-TXT-ID
PIC 9(008).
15 FIREPEAT-TXT-DESC
PIC X(00070).
15 FIREPEAT-TXT-VENDOR
PIC X(00040).
15 FIREPEAT-TXT-TYPE
PIC X(00010).
15 FIREPEAT-TXT-PRICE
PIC S9(06)V9(02).
The copybook is generated by another system. I can’t do anything about it. I just have to work with what I have.
Attached is the program I’m working on. There’s no use trying to go through it to see what it does. It’s messy and it does not work.
My problems:
- I can look at the copybook and see the occurs = 15.
- I can’t change the copybook
- I don’t know how to make the actual cobol program “know” the value = 15.
Here is my question:
Specifically, the copybook states 10 FILLER OCCURS 15. In the procedure division of the attached program, is there any way to determine the number of occurrences?
Tom, Thank You very much. That resolved the issue. I really appreciate it!