Posted: Fri Nov 10, 2006 10:39 am Post subject: formatting the input records
My requirement is to pick up first SEQ and LAST SEQ and write a single record.
Key is FILE,BTCH,SERIAL.seq num gets incremented if the 3 are same.
For SEQ=1,I need to write create-by-pgm,mod-by-pgm and date-time-create
Write remainingg output layout fields for the last seq num of the same file batch serial key.
space differentiates each field.
Code:
Input file
----------
FILE BTCH sERIAL SEQ SUB RCD-CD DATE-TIME-CREATE CREATE-BY-PGM DATE-TIME-MOD MOD-BY-PGM
----------------------------------------------------------------------------------------------------------------
RT1 11 1145 1 M E 2006-02-14-14.21.05.637111 AAB 2006-02-25-14.21.05.637111 AAC
RT1 11 1145 2 M E 2006-02-14-14.21.05.637111 AAB 2006-02-26-14.21.05.637111 AAD
RT1 11 1145 3 M E 2006-02-14-14.21.05.637111 AAB 2006-02-27-14.21.05.637111 AAC
RT1 11 1145 4 M S 2006-02-14-14.21.05.637111 AAB 2006-02-28-14.21.05.637111 AAC
RT1 11 1145 5 M E 2006-02-14-14.21.05.637111 AAB 2006-02-29-14.21.05.637111 AAE
RT1 11 1146 1 M E 2006-02-14-14.21.05.637111 AAB 2006-02-25-14.21.05.637111 AAC
RT1 11 1146 2 M E 2006-02-14-14.21.05.637111 AAB 2006-02-26-14.21.05.637111 AAD
RT3 12 1145 1 M E 2006-02-14-14.21.05.637111 AAB 2006-02-25-14.21.05.637111 AAC
RT3 12 1145 2 M S 2006-02-14-14.21.05.637111 AAB 2006-02-25-15.21.05.637111 AAE
RT3 12 1145 3 M E 2006-02-14-14.21.05.637111 AAB 2006-02-25-16.21.05.637111 AAC
RT1 11 1145 1 M E 2006-02-14-14.21.05.637111 AAB 2006-02-25-14.21.05.637111 AAM
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Fri Nov 10, 2006 11:57 am Post subject:
small design problem, maybe. if the input was sorted correctly, you have 2 records with the same key (including ts) only difference is pgm mod.
1. how do you plan to handle duplicates? Need to come up with a plan.
2. if you are going to use a timestamp, use a different one for each record. Otherwise, use the date,hms and leave it at that. _________________ Dick Brenholtz
American living in Varel, Germany
Kolusu,
The output should pick that record.
Else i can seperate the single seq num record from the other.
For single seq record,there is no need for formatting.we can append it later.
Actually,I thought of extracting the first and last seq num of FIL BTCH SERIAL.
By FIRSTDUp and LASTDUP.But from these 2 records,we need to format the fields.
Not sure how to go along with it.
Duplicates are identified based on FILE BTCH and SERIAL.(first 3 fields)
these 3 fields are the key.
i.e. if the seq num for FILE BTCH SERIAL fields are 1,2,3,4,5
I need to pick create-by-pgm,mod-by-pgm and date-time-create from the first seq num and the remaining will be picked from the last (i.e 5 here) record.fields picked from first seq num and last seq num should be written as a single record.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Nov 10, 2006 2:14 pm Post subject:
The following DFSORT/ICETOOL will give you the desired results. The first sort operator gets the first the last seq num based on the combo of file,btch,serial. The second SPlice operator pads the pgm name at the end.
1-4 8-32 40-46
id desc serial
AAAA 53235326456457457
AAAA 31213253643646466
BBBB 12345678901234560
CCCC 98765432198765432
The 40-46(serial) should get popularted with 22-26 charcter in DESC field.
If the record is AAAA then fill serial with 22-26 char from DESC
If the record is bbbb then fill serial with 24-28 char from DESC
If the record is cccc then fill serial with 25-29 char from DESC
serial field is of s9(4)v9(1) or some ZD.
hope my query is clear.
expecting your valuable reply.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum