Page 1 of 1

how to Read the COBOL Copybook file

Posted: Fri May 06, 2011 10:07 pm
by AKN
Dear Talent Pool,
I have to read two COBOL copybook files (JOA,AOA) as source system.

JOA file contains 2 segment and AOA contains 10 segment. There are some relationships exists between JOA & AOA.

The data files are having fixed length and EBCDIC data type.

I have imported these segments by importing the each segment individually as I had recieved 12 segments sturcture in 12 separate individual files.

For two files I have used two CFF stage.

While reading the file, I encountered with the error "The Offset doesn't match"

Even I have tryied in keeping the 2 segments in one file and other 10 segments in other and done the import,. Again the error is same .


Please suggest on this.


Thanks,

Posted: Mon May 09, 2011 2:07 am
by AKN
Just adding few details about the above to read the COBOL file.

JOA file contains two segments such as S00300X0 and S00300X1.

S00300X0 segmental stucture is as follows:

01 S00300X0.
05 S00X0-RGL-SA-DB-KEY.
10 S00X0-RGL-SA-DB-TYP PIC X.
88 S00X0-RGL-SA-POINTER VALUE '8'.
10 S00X0-RGL-SA-TBL-TYP PIC X.
88 S00X0-RGL-SA-CL VALUE '3'.
88 S00X0-RGL-SA-IL VALUE '4'.
88 S00X0-RGL-SA-MP VALUE '5'.
88 S00X0-RGL-SA-DC VALUE '6'.
88 S00X0-RGL-SA-CM VALUE '7'.
10 S00X0-RGL-SA-CLASS PIC X(5).
10 S00X0-RGL-FILLER-1
REDEFINES S00X0-RGL-SA-CLASS.
15 S00X0-RGL-SA-TBL-NO PIC XXX.
15 S00X0-RGL-FILLER-2 PIC XX.
10 S00X0-RGL-SA-ST-CD PIC XX.
05 S00X0-RGL-SA-DATA.
10 S00X0-RGL-FILLER-3 PIC X(10).

S00300X1 segmental stucture is as follows:

01 S00300X1.
05 S00X1-RGL-SA-DB-KEY.
10 S00X1-RGL-SA-ST-ADOPT-DT PIC 9(7).
10 S00X1-RGL-SA-MAINT-DT PIC 9(7).
05 S00X1-RGL-SA-DATA.
10 S00X1-RGL-SA-VER-ID PIC X(6).
10 S00X1-RGL-SA-TBL-NO PIC XXX.
10 S00X1-RGL-SA-FILLER PIC X(10).

I have taken the Import separately for these two segments.

While moving to the "LayOut" tab after setting up all properties in the previous tabs of CFF stage in parallel job, I am getting some error message in the "LayOut" tab as below.
The offsets for record ID columns do not match!
The record ID value <''> is not unique!
.
Due to which I am unable to read the JOA file.

Any idea what I am missing in the settings up?

Would appreciate your fast suggestion.

Posted: Mon May 09, 2011 7:21 am
by FranklinE
Anayak,

There are two considerations here. One is whether you are confident that CFF can handle the input layout as is. The other is how you intend to use the redefined fields.

The first important question: What platform are you reading from with CFF? If it is the usual mainframe OS with filehandling in catalogs, your first choice is to define your inputs with record type = implied and delimiter = none. With this, any offset problems can be identified easily by comparing the column definitions with the source data. Import can cause problems, especially when you let it flatten complex fields for you.

I've found it best to resolve redefines before importing. For example, do you need to know in the table definition that S00X0-RGL-SA-CLASS PIC X(5) contains S00X0-RGL-SA-TBL-NO PIC XXX plus filler, or can you handle that in a transformer? It's less convenient, but easier to handle downstream.

Posted: Mon May 09, 2011 9:26 am
by AKN
Thanks for your valuable input,Frankline
Here I am trying to read the cobol file from the UNIX environment using CFF stage in a parallel job.

So mainframe OS option is not available with me.

In the table definition S00X0-RGL-SA-CLASS PIC X(5) contains S00X0-RGL-SA-TBL-NO PIC XXX plus filler also.

Any idea how do I read it using any othere stages or options?

Posted: Mon May 09, 2011 10:29 am
by FranklinE
AKN wrote:Thanks for your valuable input,Frankline
Here I am trying to read the cobol file from the UNIX environment using CFF stage in a parallel job.

So mainframe OS option is not available with me.
You're welcome. Is it possible that CFF is the problem? I have little experience with it, and I'm wondering if you should be using a sequential file stage instead, or if you are dealing with a remote server use FTP. Anyone else reading this thread have an opinion? :?
AKN wrote:In the table definition S00X0-RGL-SA-CLASS PIC X(5) contains S00X0-RGL-SA-TBL-NO PIC XXX plus filler also.

Any idea how do I read it using any othere stages or options?
I would just use a transformer to parse the PIC X(5) field for the first three bytes when you need it for the TBL-NO value.

Code: Select all

Input_link.S00X0-RGL-SA-CLASS[1,3]
In my opinion -- I'm something of a conservative when it comes to Cobol design -- redefines should only be used when the format of the field needs to be changed and you want to avoid writing MOVE statements, not for a different set of values with a different length. I'm assuming there's some logic behind it, and I'd use that logic to decide when I need the redefined value.

Posted: Sat May 28, 2011 10:52 am
by AKN
I have changed the stucture of the segment based on the data available in the file to be read. After that the error I was encountering is elliminated. :D