How to create COBOL file with OCCURS clause?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
gv.subash
Participant
Posts: 1
Joined: Wed Feb 04, 2015 7:03 am
Location: Hyderabad

How to create COBOL file with OCCURS clause?

Post by gv.subash »

Hi,

I need to convert .csv file data to COBOL copybook format. I designed different jobs for header, detail and the trailer, and one other job to combine all these.

But, I have a scenario where there is an OCCURS clause (occurs 70 times). How to pass data in such scenario?

For example: Name, ID, Add1, Add2,Add3, Add4
Input file: venkat, 10, India, USA, Mexico, spain.

My output should be:
Venkat10IndiaVenkat10USAVenkat10MexicoVenkat10Spain

Could you please help me achieve this?

Thank you
Venkat
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... you can get up to 70 of these "Add" fields? Or is it always 70? And you need to repeat the ID and concatenate these together into one long string?

If so, what have you tried so far? If not, please clarify the requirements.
-craig

"You can never have too many knives" -- Logan Nine Fingers
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

I suppose a transformer loop would be a good approach. You need to do several things here.

You have to know how many instances of the OCCURS you need to use for each input row. Will it always be the same number?

Is there a direct link between the number of address columns in the .csv file and the output copybook? For example, are there 70 columns for addresses, with the ones not containing a valid address spaces, empty or null?

In general, the first requirement of a COBOL format record is that all fields contain valid values, whether usable data or defaults or just something to fill the space.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

FranklinE wrote:I suppose a transformer loop would be a good approach.
Was thinking the same thing.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You might also investigate using the extended properties to define a vector, and use functionality such as the Make Vector stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Oooo... interesting. Choose your own adventure!

The path forks ahead, where you can see a newly painted sign. To the right, the well-trodden path you've been following continues. To the left, a smaller trail branches off into the wilderness. You pause to read the sign, which asks you to consider taking the path less travelled to seek new adventures.

Which path do you chose?

:D
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply