I am getting a input file with header/detail/and fooder
EXample
<HEADER_STR><ORDER_NUM><HEADER_DATE>
<DETAILA><ORD_DETAIL_NO1><QTY>
<DETAILA><ORD_DETAIL_NO2><QTY>
<DETAILA><ORD_DETAIL_NO3><QTY>
<TRAILER><ORDER_NUM>
Output file should be
<ORDER_NUM><HEADER_DATE><ORD_DETAIL_NO1><QTY>
<ORDER_NUM><HEADER_DATE><ORD_DETAIL_NO2><QTY>
<ORDER_NUM><HEADER_DATE><ORD_DETAIL_NO3><QTY>
I want to store the <HEADER_DATE> AND <ORDER_DATE>
in a varaiable until I reach the next record header and use it for each detail record.
How do I implement this....
Any help is appriciated
Thank you
Implement loop --- Header/Detail/Footer format input data fi
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The easiest way is to store the header string, order number and header date in stage variables, updating only when HeaderStr changes. After all of these have another, called svPrevHeaderStr, that records the incoming HeaderStr. Derivation of svHeaderDate, for example, is then
Derivation of the OrderNum and HeaderDate output columns is simply the value of the appropriate stage variable.
Code: Select all
If InLink.HeaderStr <> svPrevHeaderStr Then InLink.HeaderDate Else svHeaderDate
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 385
- Joined: Tue Oct 07, 2003 4:55 am
Since your file has a different format for each line type, you might have problems with the sequential stage. 'Suppress row trancation warnning might help' otherwise you can create a job that reads only the first line and pass the <HEADER_DATE> as user status.
Your second job will get the <HEADER_DATE> as a parameter and will read the file without the fist line (use 'first line iws column name' to ignore the header)
HTH,
Amos
Your second job will get the <HEADER_DATE> as a parameter and will read the file without the fist line (use 'first line iws column name' to ignore the header)
HTH,
Amos