Hi Friends,
I was trying to read through a Cobol File which has a occur clause in it. I tried to read data using the complex flat file stage.
I am able to read the file however datastage is not able to filter the group according to the occur clause.
Ex.
05 FIELD-A PIC X(4)
05 FIELD-E PIC 9(02)
05 FIELD-B OCCURS 0-5 TIMES depending on the value of E
10 FIELD-C PIC X(4)
10 FIELD-D PIC X(4)
In this example I want datastage to read the value of field E and repeat the group B as many times as its value.
If the value of E is ZERO(0)
The reading of the file should be like
FIELD-A, FIELD-E (Group B does not occur as E is 0)
If the value of E is One(1)
The reading of the file should be like
FIELD-A,FIELD-E,FIELD-C,FIELD-D
If the value of E is Two(2)
The reading of the file should be like
FIELD-A,FIELD-E,FIELD-C,FIELD-D,FIELD-C_1,FIELD-D_1
And so on...!
However I am not able to achieve this even after specifying the occurs depending on clause in the stage properties.
Kindly, Help...!!!
Thanks
Ramesh
Reading Cobol File using CFF Stage
Moderators: chulett, rschirm, roy
Re: Reading Cobol File using CFF Stage
Make sure you have the right file definition (copy book).bikan wrote:I was trying to read through a Cobol File which has a occur clause in it. I tried to read data using the complex flat file stage.
I am able to read the file however datastage is not able to filter the group according to the occur clause.
Ramesh
complex flat file stage will extract data based on your metadata definition which happen to be a copy book in this case.
Important column is Level number, which represents the level number of the column within a COBOL file description.
If you can not figure out, give more information like exact metadata definitions and the errors.
Kris~
~Kris
Complex Flat File Usage
I've used the CFF stage frequently, and found it is easiest to setup if you do the following:
1) Get the cobol copybook (note what column the level #'s are in)
2) Right-click on Table Definitions and select Import COBOL definitions.
- Put the path to the copybook and the start column for level #'s.
- Hit Import
3) Go to the CFF stage Input Columns and the load the columns from the table definitions.
That seems to keep everything straight...
If you continue having problems please post the copybook in your next response.
1) Get the cobol copybook (note what column the level #'s are in)
2) Right-click on Table Definitions and select Import COBOL definitions.
- Put the path to the copybook and the start column for level #'s.
- Hit Import
3) Go to the CFF stage Input Columns and the load the columns from the table definitions.
That seems to keep everything straight...
If you continue having problems please post the copybook in your next response.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
With such a simple layout, you could read this as a single VarChar field (using a Sequential File stage) and parse it in a Transformer stage, flattening the repeating group into separate columns. Whether or not you keep E is rather irrelevant - you simply parse into five pairs of columns, perhaps substituting @NULL for "".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.