WTX Mapping question

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
edi1ssd
Participant
Posts: 4
Joined: Fri Nov 30, 2007 3:19 pm

WTX Mapping question

Post by edi1ssd »

Hello, people! I am new in here and may ask some silly questions. Please, don't scream ;)
I just started to code my first map in X12. The output - simple delimited file with one header H and multiple M details. I need to be able to count all detail lines, that follow each header H record.

Simply to say:

H
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4 etc...

H
M,,,,,,,,1
M,,,,,,,,2
M,,,,,,,,3
M,,,,,,,,4 etc...

I get the numbers using GETANDSET, but unfortunately, I don't know how to initialize the index after each H record. The ouput that I get looks like this:

H
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4 etc...

H
M,,,,,,,,5
M,,,,,,,,6
M,,,,,,,,7
M,,,,,,,,8 etc...
I appreciate all your help!!!
Mercmaven
Participant
Posts: 3
Joined: Sun Jan 01, 2006 2:23 pm
Contact:

Re: WTX Mapping question

Post by Mercmaven »

Hi edi1ssd,

You need to set the initiator in the component list in the Type Tree in the Record Group Type Component list, provided that your input file contains the "H" as the first element in the group record. That should solve your problem.
edi1ssd wrote:Hello, people! I am new in here and may ask some silly questions. Please, don't scream ;)
I just started to code my first map in X12. The output - simple delimited file with one header H and multiple M details. I need to be able to count all detail lines, that follow each header H record.

Simply to say:

H
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4 etc...

H
M,,,,,,,,1
M,,,,,,,,2
M,,,,,,,,3
M,,,,,,,,4 etc...

I get the numbers using GETANDSET, but unfortunately, I don't know how to initialize the index after each H record. The ouput that I get looks like this:

H
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4 etc...

H
M,,,,,,,,5
M,,,,,,,,6
M,,,,,,,,7
M,,,,,,,,8 etc...
I appreciate all your help!!!
RFox
edi1ssd
Participant
Posts: 4
Joined: Fri Nov 30, 2007 3:19 pm

Post by edi1ssd »

Mercmaven! Thank you sooooo much! I will try definitely! Will keep you posted! Thank you!
edi1ssd
Participant
Posts: 4
Joined: Fri Nov 30, 2007 3:19 pm

Post by edi1ssd »

Doesn't work. ':('

My input is EDI data. The output is the flat commspec format, and the first record in the group starts with H.

This is what I need:
H,,,,,
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4

H,,,,
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4

I have this record layout in the type tree:

Comfile-out-data (s)
File-group_out
Header_rec Records (put the Restart Attribute here?)
Item1_rec(s)
Item2_rec(s)
Item3_rec(s)
Item4_rec (s)

And this is what I got, when put the Restart attribute on the Header_rec Rcords

H,,,,,,,
M,,,,,,,1
M,,,,,,,2
M,,,,,,,3
M,,,,,,,4

H,,,,
M,,,,,,,5
M,,,,,,,6
M,,,,,,,7
M,,,,,,,8


Not sure though, is there any other initiator somewhere? :(
In my detail line i have a field for this: Line# and I set up the Index and use it in the rule =GETANDSET(In3, In3 +1, 1 ). Unfortunately, it counts the lines, but not exactly the way I need it. In Cobol I know I would initialize the index or field. But here...don't now. Any other thoughts? Thank you so much!
HariniAruna
Participant
Posts: 12
Joined: Mon Mar 31, 2008 11:39 pm

Post by HariniAruna »

quick question are u mapping any common field to both Header and Item if so ,
Just write one functional map at the header group level and pass the index and check that condition as the value(H)=value(M) and inside that functional map just map that index value
HariniAruna
Participant
Posts: 12
Joined: Mon Mar 31, 2008 11:39 pm

Post by HariniAruna »

quick question are u mapping any common field to both Header and Item if so ,
Just write one functional map at the header group level and pass the index and check that condition as the value(H)=value(M) and inside that functional map just map that index value
jvmerc
Participant
Posts: 94
Joined: Tue Dec 02, 2003 12:57 pm

Post by jvmerc »

Not sure I understand the question so... If you want assign a record number to each record 'M' in each group 'H' use INDEX($) at the record level....

f_map_record_m(input card 1, input card n, index($))

or

f_map_record_m(input card 1, input card n, index(input that drive unique record))

Using the index function at the 'M' record level will reset the index to 1 at each group 'H'.
Post Reply