I am trying to define a legacy COBOL copybook using the repeat and value of to handle occurs depending on in legacy data. When I define the MRM with a fixed record length (repeat count no) and I pad the MRM out to the maximum length, I can read the message. Now I change this to repeat and value of so I that I can test to see if the repeat works - I also remove the padding because some of the data can occur from 1 to 100 times, I get an error saying my message stream is longer than my definition. How do you handle defining the message set with repeat and value of and make it so the message can be read? It seems like it needs to know the exact record length but you can't know the exact record length with occurs depending on?
Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services
I've just done this for a project here. I used this as an example to get the hang of things before doing it for real. Import this copybook into a message set, and then in the msg flow just loop round for the value of the count.
01 INPUT-RECORD.
03 LINE-ITEM-COUNT PIC 99.
03 LINE-ITEMS OCCURS 0 TO 25 TIMES
DEPENDING ON LINE-ITEM-COUNT.
05 QTY PIC 9999.
05 DESC PIC X(30).
Don't worry about the upper limit on the occurs this does not effect the record in the MRM.
Will the solution that you propose also work for a flat file that has different record sets which make up one message, while the message still contains multiple messages?
Now I'll make sense of that statement.
I have a flat file which contains multiple messages. Each message however is made up of different "record numbers" appended to the front of each row. And these record numbers can appear multiple times.
Example: In the below message I want to parse rows 1-5 and create an xml message. Each row is 600 bytes, but the field lengths of each row are different. Can a cobol copybook properly defined help me? Thanks.
1<amount><name><some other stuff>
2<ponumber><some other stuff>
3<partner><some other stuff>
4<location><some other stuff>
5<details>
5<details>
1<amount><name><some other stuff>
2<ponumber><some other stuff>
3<partner><some other stuff>
4<location><some other stuff>
5<details>
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum