Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Increment a Number across Functional Maps 2

Status
Not open for further replies.

davout69

Programmer
Oct 26, 2001
11
US
I have a an 856 to create and need to increment a number in the HL segments. The problem is that the HL segment type required me to create 4 different HL loops, where I use functional maps of one inside the other. Shipments calls Orders, Orders calls Packages and Packages calls Items. All four of these loops needs to increment the HL segment, how can I do this without repeating the same number.

i.e
Shipment Orders Packages Items
HL*1
HL*2
HL*3
HL*4
HL*5
HL*6
HL*7
HL*8
HL*9
HL*10
HL*11
 
Hi,

As per my other thread - I never know what level you are in the mercator mapping world...!So I hope this isn't a backward step for you..

INDEX is the main function that allows you to increment numbers..

INDEX($) allows mercator to keep incremented values...

you can either introduce new INDEX($) at any functional map, or pass the results of an index down..

Mercator will track many indexes at one time...its a case of fitting them in, in the right place.

So F_DoMapA (Arg1, INDEX($)) will keep a count of how many times that funcy map is calles ...The result of INDEX($) then becomes card 2 (as its the 2nd Argument)...you now have this value at a lower level...the next time time you call F_DoMapA the value of INDEX is 2...

Another hint: When passing a described problem as you have done, why not describe the data as you want to see it...

E,g

SegmentA: Value1
Segment B Value 1
Segment B Value 2
Segment B Value 3
Segment A Value 2
Segment B Value 1

This enables me to say you need 2 running indexes one for each time Seg B gets created, and one for each time Segment A...

Hope it helps

Mike

 
Yes your way of doing the index works for your situation and it may work for mine but I found some difficulty implementing it and had to go a different route with mine. Well since I had HL segments that looped with in each other, and I had to keep a running count of all HL segments in the whole transaction. I used this method instead,
passing to the functional map the ID number of the last segment then incrementing by 1, and doing so on down into the other maps. This gave me a whole count of all the HL segments plus it incremented properly.ie.

HL_ID = 1
funcMapHLO(HL_ID[LAST] + 1)
HL_ID = 2
funcMapHLP(HL_ID[LAST] + 1)
HL_ID = 3
HL_ID =4
funcMapHLI(HL_ID[LAST] + 1)
hl_ID = 5

 
Another method of doing the same thing is to create an index field in the input type tree, assign it to an output card with a value of 0 to initialize it, and then perform a GETANDSET to place the number in the SequenceID# field of the 856 HL Loop. Using this method, you are using the output card's index field as a variable to hold a running count of the HL's. You then pass the index card down to the Order, Tare, Pack, and Item levels and map the In2 (assuming you have only two inputs into each functional map) source to target.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top