View previous topic :: View next topic
|
Author |
Message |
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
Dear Experts,
Please suggest me, How to write the SYNCSORT for the below requirement
Input file looks like
ABINPDD1.....cm..Ç....ï....ï...b.{â.
ABINPDD1...|."...Z.............b.Gâ.
ABINPDD1...?...¼.Ô....&....&...b.óâ.
ABINPDD1..."..)â.|....ë....ë...b.Oâ.
ABINPDD1......Ãz.>.............b.Uâ.
ABINPPRF......É[.F.............b._â.
ABINPPRF.....bMr.Ï....ñ....ñ...b.Ëâ.
ABINPPRF...|.Ø¥Í.e.............b.Ìâ.
ACKBSIF0.....ae..¼.............b.{â.
ACKBSIF0...|.=.ë.*....î....î...b.Gâ.
ACKBTRL1...?...¹...............b.ÿâ.
ACKBTRL1...?.Ø...T.............b.Uâ.
ACKBTRL2...¤..Î................b.3â.
ACKBTRL2..............à....á...b..â.
ACKBTS01...?."3................b.ßâ.
ACKBTS01...".a7..i.........ï...b./â.
ACKBTS02...?."3................b.ßâ.
ACKBTS02...".a7..i.........ï...b./â.
ACKBTS02......¡..¬.............b._â.
ACKBTS03.....a.n.+.............b.{â.
ACKBTS03...|.@â@.:.............b.Gâ.
From the Input file, I'm interested in only 2 fields,
The first field is CUSTOMER-ID and is of 8-char
and the second field is CODE at positions 29-30 (Unisigned Packed).
A Single CUSTOMER-ID may have more than one row in a file.
Lets assume there is one row for each customer-no whenever he/she make a transaction in a particular month along with the CODE (it may differs after every transaction). The CODE value ranges from 00 - 12
I want to write an output file as follows:
ABINPDD1;00
ABINPPRF;00
ACKBSIF0;00
ACKBTRL#;00
ACKBTS##;00
Criteria:
1) If Customer Numbers
between the range ACKBTRL1 & ACKBTRL2 I want a row with Customer-No in the output file as ACKBTRL#
2) If the Customer Numbers
between the range ACKBTS01 & ACKBTS27
I want a row with the Customer-No in the output file as ACKBTS##
4) CODE is in a Un-signed Packaed decimal format, and like to convert it into the zoned decimal and like to print the maximum of all the CODE's for each CUSTOMER (or) CUSTOMER-Number Range as specified in the points 1 & 2
I will be waiting for your kind reponse. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
How to write the SYNCSORT for the below requirement |
topic moved to the proper forum section |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Please show us the code you tried and what error you are facing. |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
If you have not tried anything... suggest you take a look at IFTHEN parameter to check the range and build the output. Edit parameter to convert the packed field to readable format.
Skeleton would be
Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(range ACKBTRL1 & ACKBTRL2),
BUILD=(ACKBTRL#)),
IFTHEN=(WHEN=( ACKBTS01 & ACKBTS27),
BUILD=(ACKBTS##)),
IFTHEN=(WHEN=NONE,
BUILD=(values from input)) |
|
|
Back to top |
|
|
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
Hi kratos86,
I tried with WHEN=GROUP,BEGIN=(...
The IFTHEN did not work for me.
Is there any alternative either in DFSORT / SYNCSORT ? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
mkk157 wrote: |
Hi kratos86,
I tried with WHEN=GROUP,BEGIN=(...
The IFTHEN did not work for me.
Is there any alternative either in DFSORT / SYNCSORT ? |
Since you won't tell us how it doesn't work, we can't tell you how to change it so that it does, or what alternatives there might be. Too bad, so sad. |
|
Back to top |
|
|
|