Multi Format Flatfile

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
papan
Participant
Posts: 14
Joined: Mon Oct 17, 2005 12:28 pm

Multi Format Flatfile

Post by papan »

Hi

Using Datastage for XE390, I 've created a job which reads a VSAM-KSDS
dataset, having 4 record types (1, 2, 4 and 5), I want to create a 4 separate files (one for each record type).
After successfully compiling the correponding cobol code and JCLs, executed the job in Mainframe.
But the results are weird.
For type 1, Instead of writing 497 records, written 4970 records, each record has been repeated for 10 times.
For type 2, Instead of writing 497 records, written 2485 records, each record has been repeated for 5 times.
For type 3, only one record exists, written only 1 record without repeating.
For type 4, only 5 records exists, written only 5 records without repeating.

I really appreciate your suggestions, on how to avoid duplicates.

Thanks in advance
Data Mover
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard! :D

That behaviour usually only occurs where there is an OCCURS clause in the file definition. Can you check the FD manually to determine whether there is an OCCURS clause?

You might also inspect (or even post) the generated COBOL code to try to ascertain why these repeats are occurring.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Your record type 1 must have a field with an OCCURS 10 TIMES clause and your record type 2 must have an OCCURS 5 TIMES clause.

When you load the column metadata into the MFF stage you need to select flatten all arrays when prompted. If you choose normalize, you get the behavior that you are seeing.

Mike
papan
Participant
Posts: 14
Joined: Mon Oct 17, 2005 12:28 pm

Yep! I selected flatten all arrays but still the same proble

Post by papan »

I've selected flatten all arrays while loading the metadata and also
I right clicked the transform stage, and selected propagate columns from source link to target link.
But still the problem prevails as is.

Any help in this regard will be highly appreciated.

//thanks

[quote="Mike"]Your record type 1 must have a field with an OCCURS 10 TIMES clause and your record type 2 must have an OCCURS 5 TIMES clause.

When you load the column metadata into the MFF stage you need to select flatten all arrays when prompted. If you choose normalize, you get the behavior that you are seeing.

Mike[/quote]
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Well, if you've flattened all arrays, then you must have some other problem.

If you have successfully flattened the arrays, you should see column names with _002, _003, etc. appended at the end.

Have you met all of the requirements for using a MFF stage? For example, the record type identifier must be in the same physical location in every record type.

If possible, please post your actual COBOL copybook(s).
papan
Participant
Posts: 14
Joined: Mon Oct 17, 2005 12:28 pm

Post by papan »

Hi Pals,
The reason why DS is writing rectype 1 and 2, 10 and 5 times respectively is the CFD for RecType1 contains a statement like
aaaa redefines bbbb occurs 10 times, similarly for type2
xxx redefines yyy occurs 5 times.
DS is doing what its supposed to do.
DS can handle redefines and occurs separately but not together in the same statement.

Thanks for all who spent some time in finding the solution.
Data Mover
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Thanks for posting the resolution. I vaguely recall that that restriction is documented somewhere. I also vaguely recall a restriction against handling OCCURS DEPENDING ON and on more than one OCCURS in any FD. Apparently this last one has been relaxed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sankarsadasivan
Premium Member
Premium Member
Posts: 39
Joined: Tue Dec 23, 2003 3:47 am
Location: India

Post by sankarsadasivan »

I am new to mainframe jobs...

I have a similar situation.

My mainframe source file has header, data and trailer records.
So I am using a Multi format flat file, and using constraints to identify the records and it works fine.

In data record, I have an occurs clause - 6 times, and I setelect flatten all arrays, so I have all the columns appearing 6 times - with the suffix _1,2,3,4,5,6.

Now I have got them in my output tab of the MFF stage and my rest of the job has a transfomer and few fixed with flat file stages.

My input to transfoemer has say for eg: client_1, 2,3,4,5,6 and output file has only one client column.

How do I map this?....

I havent done this before and need help

Many thanks.
sankarsadasivan
Premium Member
Premium Member
Posts: 39
Joined: Tue Dec 23, 2003 3:47 am
Location: India

Post by sankarsadasivan »

And here are my CFDs...




* DATA EXTRACT RECORD
01 ABC-CLIENT-ACCOUNT.
05 ABC-CONTROL-SECTION.
10 ABC-SYSTEM-ID PIC X(03).
10 ABC-ACCOUNT-NUMBER PIC X(12).
10 ABC-NUM-OF-CLIENTS PIC 9(02).
10 ABC-LEVEL-3-4-IND PIC 9(01).
88 ABC-LEVEL-3-AMA VALUE '3'.
88 ABC-LEVEL-4-EQS VALUE '4'.
10 ABC-ACCOUNT-STATUS PIC X(01).
88 ABC-OPEN VALUE 'O'.
88 ABC-CLOSED VALUE 'C'.
10 ABC-ACCOUNT-TERM-REASON PIC X(01).
88 ABC-RESTRICTED VALUE 'R'.
88 ABC-NOT-RESTRICTED VALUE ' '.
10 ABC-BDDS-PLAN-CODE.
15 ABC-PLAN-CODE PIC X(04).
15 FILLER PIC X(08).
10 ABC-TIN-TYPE-CODE PIC X(01).
10 ABC-ACCOUNT-TAXPAYER-ID PIC X(09).
10 ABC-REG-NAME-LINE1 PIC X(50).
10 ABC-REG-NAME-LINE2 PIC X(50).
10 ABC-REG-NAME-LINE3 PIC X(50).
10 ABC-REG-ADDRESS-LINE1 PIC X(50).
10 ABC-REG-ADDRESS-LINE2 PIC X(50).
10 ABC-REG-CITY-LINE PIC X(20).
10 ABC-REG-STATE-CODE PIC X(02).
10 ABC-REG-ZIP-CODE PIC X(09).
10 ABC-DATE-OPENED PIC X(08).
10 ABC-DATE-CLOSED PIC X(08).
******************************************************************
* ABC-CLIENT-INFORMATION OCCURS 6 TIMES *
******************************************************************
05 ABC-CLIENT-INFORMATION OCCURS 6 TIMES.
10 ABC-CLIENT-TYPE PIC X(01).
88 ABC-INDIVIDUAL VALUE 'I'.
88 ABC-CORPORATE VALUE 'C'.
88 ABC-TRUST VALUE 'T'.
10 ABC-CLIENT-ROLE PIC X(02).
88 ABC-PRIMARY-OWNER VALUE '00'.
88 ABC-CO-OWNER VALUE '01'.
10 ABC-TAXPAYER-ID PIC X(09).
10 ABC-TAXPAYER-ID-TYPE PIC X(01).
88 ABC-INDIV-SSN VALUE '0'.
88 ABC-ORG-TIN VALUE '1'.
88 ABC-UNKNOWN VALUE ' '.
10 ABC-NAME-LOOKUP PIC X(25).
10 ABC-GENDER PIC X(01).
88 ABC-MALE VALUE 'M'.
88 ABC-FEMALE VALUE 'F'.
88 ABC-UNKNOWN VALUE ' '.
10 ABC-DATE-OF-BIRTH PIC X(08).
10 ABC-NAME-LAST PIC X(100).
10 ABC-NAME-FIRST PIC X(50).
10 ABC-NAME-MIDDLE PIC X(50).
10 ABC-NAME-SUFFIX PIC X(20).
10 ABC-ADDRESS-LINE1 PIC X(50).
10 ABC-ADDRESS-LINE2 PIC X(50).
10 ABC-CITY PIC X(50).
10 ABC-STATE-CODE PIC X(02).
10 ABC-ZIP-CODE PIC X(09).


TARGET RECORD:
01 SPLTC-CUSTOMER-RECORD.
05 SPLTC-SYSTEM-SOURCE PIC X(01).
05 SPLTC-POLICY-NUMBER PIC X(12).
05 SPLTC-CUSTOMER-OCCRNCE PIC 9(02).
05 SPLTC-CUSTOMER-TYPE PIC X(01).
05 SPLTC-UNIT-SUBUNIT-NUMBER PIC 9(10).
05 SPLTC-UNIT-INDICATOR PIC X(01).
05 SPLTC-TITLE-ID PIC X(02).
05 SPLTC-NAME PIC X(46).
05 SPLTC-ADDR-1 PIC X(35).
05 SPLTC-ADDR-2 PIC X(35).
05 SPLTC-ADDR-3 PIC X(35).
05 SPLTC-ADDR-4 PIC X(35).
05 SPLTC-ADDR-5 PIC X(35).
05 SPLTC-TYPE-FEDERAL-ID PIC X(01).
05 SPLTC-FEDERAL-ID PIC 9(10).
05 SPLTC-SEX PIC X(01).
05 SPLTC-DATE-OF-BIRTH.
10 SPLTC-DOB-CENT PIC 9(02).
10 SPLTC-DOB-YEAR PIC 9(02).
10 SPLTC-DOB-MONTH PIC 9(02).
10 SPLTC-DOB-DAY PIC 9(02).
05 SPLTC-CLIENT-STATUS PIC 9(02).
05 SPLTC-DATE-OF-DEATH.
10 SPLTC-DOD-CENT PIC 9(02).
10 SPLTC-DOD-YEAR PIC 9(02).
10 SPLTC-DOD-MONTH PIC 9(02).
10 SPLTC-DOD-DAY PIC 9(02).
05 SPLTC-PREM-TAX-CITY PIC 9(03).
05 SPLTC-ALIAS PIC X(46).
05 SPLTC-HANDLING-CODE PIC X(01).
05 SPLTC-NOTICE-ID PIC 9(01).
05 SPLTC-POLICY-STOP PIC X(02).
05 SPLTC-UPDATE-INDICATOR PIC X(01).
05 SPLTC-UNDELIVER-MAIL-IND PIC X(01).
05 FILLER PIC X(15) VALUE SPACES.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

And here is your chastisement for hijacking a thread. Your problem is not the same as that of the original poster.

If you have a new question, start a new thread. It helps future searchers.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply