Page 1 of 1

WTX Mapping question

Posted: Fri Dec 05, 2008 11:08 am
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!!!

Re: WTX Mapping question

Posted: Fri Dec 05, 2008 5:22 pm
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!!!

Posted: Fri Dec 05, 2008 6:14 pm
by edi1ssd
Mercmaven! Thank you sooooo much! I will try definitely! Will keep you posted! Thank you!

Posted: Fri Dec 05, 2008 7:16 pm
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!

Posted: Fri Jan 30, 2009 1:11 am
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

Posted: Fri Jan 30, 2009 1:13 am
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

Posted: Fri Feb 13, 2009 10:28 am
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'.