Author |
Message
|
fszostak |
Posted: Wed Jul 27, 2011 4:59 am Post subject: Cobol Copybook - OCCURS into OCCURS issue |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
Hi all!
Anybody already did work with this kind of structure? Is possible work this?
Occurs inside occurs.
I already try, but dont have success.
Code: |
05 RQST-XX.
10 RQST-XX-ID PIC X(10).
10 RQST-XX-OCCUR-CNT PIC 9(04).
10 RQST-XX-TBL.
15 RQST-XX-ARRAY OCCURS 1 TO 20 TIMES
DEPENDING ON RQST-XX-OCCUR-CNT .
20 RQST-YY-ARRAY-P1.
25 RQST-YY-ID PIC X(30).
25 RQST-YY-DESC PIC X(10).
20 RQST-ZZ.
25 RQST-ZZ-ID PIC X(10).
25 RQST-ZZ-OCCUR-CNT PIC 9(04).
25 RQST-ZZ-TBL.
30 RQST-ZZ-ARRAY OCCURS 0 TO 50 TIMES
DEPENDING ON RQST-ZZ-OCCUR-CNT.
35 RQST-ZZ-ARRAY-P1.
40 RQST-ZZ-CDE PIC X(6). |
Thanks! _________________ WMB 6.1.005
Last edited by fszostak on Wed Jul 27, 2011 5:26 am; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jul 27, 2011 5:01 am Post subject: Re: Cobol Copybook - OCCURS into OCCURS issue |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fszostak wrote: |
I already try, |
How?
fszostak wrote: |
but dont have success. |
Be specific about what happened. |
|
Back to top |
|
 |
fszostak |
Posted: Wed Jul 27, 2011 5:16 am Post subject: Re: Cobol Copybook - OCCURS into OCCURS issue |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
mqjeff wrote: |
fszostak wrote: |
I already try, |
How?
fszostak wrote: |
but dont have success. |
Be specific about what happened. |
It was in another project, i solve using with TDS and the second level was defined as another register, in that situation I could change the copybook, but now I would like to avoid the change in copybook.
In another case, solve like this:
01WWW000211AAA22BBB
0201RRR
0202SSS
0203TTT
But in this case:
01WWW000211AAA22BBB00030201RRR02SSS03TTT
I remember that the parser has requested that the variable structure should be the last. _________________ WMB 6.1.005
Last edited by fszostak on Wed Jul 27, 2011 5:18 am; edited 1 time in total |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 27, 2011 5:17 am Post subject: Re: Cobol Copybook - OCCURS into OCCURS issue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fszostak wrote: |
Anybody already did work with this kind of structure? Is possible work this?
Occurs inside occurs. |
The problem as I see it is not that you have an occurs within an occurs, by that the variables quoted in the DEPENDING ON clause don't seem to be part of the record. They don't appear in the quoted code segment and names like WS-XX-CNT & WS-ZZ-CNT imply working storage variables rather than data division.
So how will WMB, faced with a single record, know how many instances are on an input record? Can it be determined from anything in the record structure? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fszostak |
Posted: Wed Jul 27, 2011 5:24 am Post subject: Re: Cobol Copybook - OCCURS into OCCURS issue |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
Vitor wrote: |
fszostak wrote: |
Anybody already did work with this kind of structure? Is possible work this?
Occurs inside occurs. |
The problem as I see it is not that you have an occurs within an occurs, by that the variables quoted in the DEPENDING ON clause don't seem to be part of the record. They don't appear in the quoted code segment and names like WS-XX-CNT & WS-ZZ-CNT imply working storage variables rather than data division.
So how will WMB, faced with a single record, know how many instances are on an input record? Can it be determined from anything in the record structure? |
Sorry! I did copy and paste a part of copybooy and I made changes to explain the problem... it's wrong.
DEPENDING ON RQST-XX-OCCUR-CNT AND RQST-ZZ-OCCUR-CNT _________________ WMB 6.1.005 |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 27, 2011 6:30 am Post subject: Re: Cobol Copybook - OCCURS into OCCURS issue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fszostak wrote: |
Sorry! I did copy and paste a part of copybooy and I made changes to explain the problem... it's wrong.
DEPENDING ON RQST-XX-OCCUR-CNT AND RQST-ZZ-OCCUR-CNT |
I was wondering what the COBOL compiler had had of that construction...
So given that the record counts are safely included in the record layout, this brings us back to the question of my most worthy associate - what have you tried and what happened? In theory at least, you are simply getting WMB to count RQST-XX-OCCUR-CNT numbers of segments, where the length of that segment itself is determined by the number of segments within it. Might require a little dancing but sounds straightforward.
I can also see how you could use TDS to detect segment change as you indicate. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fszostak |
Posted: Wed Jul 27, 2011 8:23 am Post subject: |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
being more specific...
COPY BOOK
Code: |
01 RQST-SEG.
05 RQST-INSOBJIDN-SEG.
10 RQST-INSOBJIDN-SEG-ID PIC X(10).
10 RQST-INSOBJIDN-SEG-OCCUR-CNT PIC 9(04).
10 RQST-INSOBJIDN-TBL.
15 RQST-INSOBJIDN-ARRAY OCCURS 1 TO 20 TIMES
DEPENDING ON RQST-INSOBJIDN-SEG-OCCUR-CNT.
20 RQST-INSOBJIDN-ARRAY-P1.
25 RQST-INS-OBJ-ID PIC X(30).
25 RQST-INS-OBJ-TYPE PIC X(10).
20 RQST-COVDAT-SEG.
25 RQST-COVDAT-SEG-ID PIC X(10).
25 RQST-COVDAT-SEG-OCCUR-CNT PIC 9(04).
25 RQST-COVDAT-TBL.
30 RQST-COVDAT-ARRAY OCCURS 0 TO 50 TIMES
DEPENDING ON RQST-COVDAT-SEG-OCCUR-CNT.
35 RQST-COVDAT-ARRAY-P1.
40 RQST-COVER-CDE PIC X(6). |
Test buffer:
11111111110002333333333333333333333333333333101010101011111111110001660166444444444444444444444444444444111111111122222222220001660266
**** RQST-INSOBJIDN-ARRAY should be repeated two times
After parser:
Code: |
MRM
RQST_INSOBJIDN_SEG
RQST_INSOBJIDN_SEG_ID:CHARACTER:1111111111
RQST_INSOBJIDN_SEG_OCCUR_CNT:INTEGER:2
RQST_INSOBJIDN_TBL
RQST_INSOBJIDN_ARRAY
RQST_INSOBJIDN_ARRAY_P1
RQST_INS_OBJ_ID:CHARACTER:333333333333333333333333333333
RQST_INS_OBJ_TYPE:CHARACTER:1010101010
RQST_COVDAT_SEG
RQST_COVDAT_SEG_ID:CHARACTER:1111111111
RQST_COVDAT_SEG_OCCUR_CNT:INTEGER:1
RQST_COVDAT_TBL
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:660166
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:444444
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:444444
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:444444
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:444444
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:444444
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:111111
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:111122
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:222222
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:220001
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:660266
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
CHARACTER:ImbRecoverableException caught from worker->parseNext. |
_________________ WMB 6.1.005 |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 27, 2011 8:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
And you're sure the message set correctly deals as described here? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fszostak |
Posted: Wed Jul 27, 2011 8:49 am Post subject: |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
Works now!
The DEPENDING ON was not assigned correctly.
Thanks for all!
Code: |
MRM
RQST_INSOBJIDN_SEG
RQST_INSOBJIDN_SEG_ID:CHARACTER:1111111111
RQST_INSOBJIDN_SEG_OCCUR_CNT:INTEGER:2
RQST_INSOBJIDN_TBL
RQST_INSOBJIDN_ARRAY
RQST_INSOBJIDN_ARRAY_P1
RQST_INS_OBJ_ID:CHARACTER:333333333333333333333333333333
RQST_INS_OBJ_TYPE:CHARACTER:1010101010
RQST_COVDAT_SEG
RQST_COVDAT_SEG_ID:CHARACTER:1111111111
RQST_COVDAT_SEG_OCCUR_CNT:INTEGER:2
RQST_COVDAT_TBL
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:660116
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:660126
RQST_INSOBJIDN_ARRAY
RQST_INSOBJIDN_ARRAY_P1
RQST_INS_OBJ_ID:CHARACTER:444444444444444444444444444444
RQST_INS_OBJ_TYPE:CHARACTER:1111111111
RQST_COVDAT_SEG
RQST_COVDAT_SEG_ID:CHARACTER:2222222222
RQST_COVDAT_SEG_OCCUR_CNT:INTEGER:1
RQST_COVDAT_TBL
RQST_COVDAT_ARRAY
RQST_COVDAT_ARRAY_P1
RQST_COVER_CDE:CHARACTER:660266 |
_________________ WMB 6.1.005 |
|
Back to top |
|
 |
|