Is it possible to put a header at a logical 30th- icetool



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Is it possible to put a header at a logical 30th- icetool

Postby Swati Gupta » Thu May 12, 2011 12:42 pm

Hi,
I am trying to put a logical record using icetool before every 30th record of a file.
My job abends if record exceeds to 30 and hence need to put a batch header before 30th record logicaly.
logic is that the trailer can be just before the record whoes 4th byte is 0.
like file is:-Trailer should be near to 30th record but should be only before 4th character 0, or shoudl say after one sequence ends and another starts.

15004751310058568391000Z N249076310053589580552150000000001
1501 060387005 CH DOES NOT RECOGNISE NAME OR DAT
1505000000000000000000000000000 0000 0000000000c
TRAILER =========================================
15004751270039352929000Z 240248710060892957450311001276301
1501 0603790CH CANX 12/08/10 CH ATTEMPT TO RESOL
1505081005497868446000000001125840 0000B0000000011
15060000000000002000000000000029574503
Trailer ==========================================

I am already having a trailer at the end which now needs to be populated at every logical 30th record and also at last.

trailer is:- TC
INCLUDE COND=(CODE,EQ,9)
SORT FIELDS=(CODE,A)
SUM FIELDS=(A,B,C,D)

toolin
copy from(infile) to(outfile) using (TC)
Can you suggest how to add teh above logic to this.
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Is it possible to put a header at a logical 30th- icetool

 

Re: Is it possible to put a header at a logical 30th- icetoo

Postby NicC » Thu May 12, 2011 2:54 pm

header? trailer? which? Logical? record.
How is a sequence identified?
LRECL? RECFM?
What if the are 2 consecutive records with a zero in the fourth byte?

How does putting this extra record into your file stop your program abending? Surely you should fix your program rather than try and change the data it is using?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Is it possible to put a header at a logical 30th- icetoo

Postby Swati Gupta » Thu May 12, 2011 3:04 pm

Hi Nic,
This is putting a batch trailer to the nearest 30th logical record.
So if you get consecutive records with 4th byte zero, you are going to put it to the nearest possible record.

Let me know if you have more query on this.
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Is it possible to put a header at a logical 30th- icetoo

Postby NicC » Thu May 12, 2011 4:03 pm

You have not answered my other queries - 4 of them
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Is it possible to put a header at a logical 30th- icetoo

Postby skolusu » Thu May 12, 2011 10:12 pm

Swati Gupta,

It is easier to provide you with a solution than try to fix something with very little info. Please provide the complete deteails

1. What is the LRECL and RECFM of the input file?
2. What is the LRECL and RECFM of the output file?
3. Do you need to remove duplicates?
4. Show us a sample of input and desired output explaining the rules to insert the record.
5. What happens if you 35 records with none of them having a 0 in the 4th byte?
6. Your very first record starts with 0 in the 4th byte why don't you have a trailer for that record? Is having 0 in the 4th byte signal the end of a group of records? If so do you want to check if there are more than 30 records per group and then split them into multiples of 30 records each?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Is it possible to put a header at a logical 30th- icetoo

Postby Swati Gupta » Mon May 16, 2011 1:53 pm

Hi,
here are the details:-
1.Input file lrecl=168, recfm=fb
2.Output file Lrecl=168 recfm=fb (same as input file)
3. No,don't need to remove duplicates. just need to add a tariler to a logical point.
4.below is the sample
5.File has a extract of a table having single row length more than 168 hence data of a record is split into multiple records.
Say a single table record is split into 5 file records. here is the example:-

15004751310058568391000Z N249076310053589580552150000000001
1501 060387005 CH DOES NOT RECOGNISE NAME OR DAT
1505000000000000000000000000000 0000 0000000000
TRAILER =========================================
15004751270039352929000Z 240248710060892957450311001276301
1501 0603790CH CANX 12/08/10 CH ATTEMPT TO RESOL
1505081005497868446000000001125840 0000B0000000011
15060000000000002000000000000029574503

The first three characters are same and fouth is exceeding as 0,1,5 so 1500,1501,1505 makes a single group of data.
Similarly 1500,1501,1505,1506 makes another group. hence i need to put a trailer in a logical way so that it should have a complete group(one row of a table).
hence trailer can not be on exact 30th record. rather it can be on 34th or 33th or may be 30th record. as per table data one row can max strech to 8 records.
6.Each grouping starts with zero. one group can not have more than 8 records.

Hope its clearer now. Let me know if more questions on this. I am still nto able to fix it.
Thanks,
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Is it possible to put a header at a logical 30th- icetoo

Postby skolusu » Mon May 16, 2011 8:36 pm

Swati,

You show just a sample of data which I cannot figure out if it is input or the desired output. I still am not sure as to the number 30 comes into picture. From my understanding all you want is use add a line whenever the group changes. If that is what you need then the following DFSORT JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
15004751310058568391000Z N249076310053589580552150000000001         
1501 060387005 CH DOES NOT RECOGNISE NAME OR DAT                     
1505000000000000000000000000000 0000 0000000000                     
15004751270039352929000Z 240248710060892957450311001276301           
1501 0603790CH CANX 12/08/10 CH ATTEMPT TO RESOL                     
1505081005497868446000000001125840 0000B0000000011                   
15060000000000002000000000000029574503                               
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(4,1,CH,EQ,C'0'),PUSH=(169:ID=8))   
  OUTFIL REMOVECC,BUILD=(1,168),                                     
  SECTIONS=(169,8,TRAILER3=('TRAILER',161'='))                       
//*


The output from this job is

15004751310058568391000Z N249076310053589580552150000000001         
1501 060387005 CH DOES NOT RECOGNISE NAME OR DAT                     
1505000000000000000000000000000 0000 0000000000                     
TRAILER==============================================================
15004751270039352929000Z 240248710060892957450311001276301           
1501 0603790CH CANX 12/08/10 CH ATTEMPT TO RESOL                     
1505081005497868446000000001125840 0000B0000000011                   
15060000000000002000000000000029574503                               
TRAILER==============================================================


If that is not what you want you need to show better examples of input AND the desired output
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Is it possible to put a header at a logical 30th- icetoo

Postby Swati Gupta » Tue May 17, 2011 7:58 am

Hi skolusu,
The above input places a trailer after each group rather i want to put trailer to the group which is just before each 30th record(say 29, 57,97 etc etc records). This is because another batch will take the data till the first trailer and do the processing again data till the second trailer and do the processing and so on. So we want group of 30 logical records where 30 is not a specific number but rather it could be 29,28,27 or wherever one group ends and another starts.
Thanks for the above code but is it possible to put such a logic to the above code:-
1. using the same input, can we skip first 25 records and then find the group with 4th character 0.
2. Then putting a trailer just before the above found record.
3. then again skip 25 records from that new trailer that we have placed and then again find group.
4.then again putting the trailer and then reiterating the same by EOF.

Is this possible through icetool. This is what i want to do to the above input.
I will try the above icetool today to start putting above logic.
Have a nice day.
Swat P,
India
Swati Gupta
 
Posts: 10
Joined: Thu May 05, 2011 1:19 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post