combing 3 lines from 3 files in to a single record



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

Re: combing 3 lines from 3 files in to a single record

Postby BillyBoyo » Thu Oct 10, 2013 9:05 pm

You didn't answer the question about whether there is other data on the files.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 9:08 pm

Oh I'm sorry about that !!!

There is no other data in all 3 input files.
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby BillyBoyo » Thu Oct 10, 2013 9:28 pm

 OPTION COPY
 INCLUDE COND=(startpos,8,CH,EQ,C'SHIPMENT',
              OR,startpos2,1,CH,EQ,C'/',
              OR,startpos3,1,CH,EQ,NUM)


startpos1 is the start of SHIPMENT, startpos2 is either of the /s in the date, startpos3 is the rightmost digit of Packed Units.

If you concatenate your three files and run that then it should isolate the three lines of interest.

Start with that, and confirm that it works.

Then provide the start position and lengths of the data you need.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 9:52 pm

Billy,

Thank you very much for your code.

But this will copy the whole line of the condition that matches and i will be getting 3 lines of output data right ?

but what i expected is " 13,398 48,483 10,343 35,635 671 1059 "

where

13,398 48,483 ==> is from input file 1
10,343 35,635 ==> is from input file 2
671 1059 ==> is from input file 3.


please guide & Help.
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby BillyBoyo » Thu Oct 10, 2013 9:54 pm

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(351:SEQNUM,1,ZD)),
       IFTHEN=(WHEN=GROUP,BEGIN=(351,1,CH,EQ,C'1'),
                       PUSH=(352:start1,length1,start2,length2)),RECORDS=3),
       IFTHEN=(WHEN=GROUP,BEGIN=(351,1,CH,EQ,C'2'),
                       PUSH=(382:start3,length3,start4,length4)),RECORDS=2),
       IFTHEN=(WHEN=(351,1,CH,EQ,C'3'),
                       BUILD=(352,lenght1,X,(352+length1),length2,X,
                               382,length3,X,(382+length3),length4,X,
                               start5,length5,X,start6,length6,350:X,351,1))

  OUTFIL INCLUDE=(351,1,CH,EQ,C'3'),BUILD=(1,350)


Then you can add something like the above. fill in/calculate the starts and lengths.

The idea is to put a sequence number on your three remaining records, just for ease of identification.

To get data from one record to another, you have to use WHEN=GROUP and PUSH.

You will end up with two records with partial data which you now want to discard, so we do that with OUTFIL INCLUDE for the one we want.

Once working you can do some tidying for more efficient use of the space, but for so few records, it is hardly worth it. Just comment it to say why it wasn't done :-)

Not tested, but you wanted it ASAP. You'll have to work a bit, at least.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: combing 3 lines from 3 files in to a single record

Postby BillyBoyo » Thu Oct 10, 2013 9:56 pm

Yes. The first thing is to get the data you want to extract from isolated from the stuff you don't want. If that can't be done easily with an INCLUDE/OMIT, then something else is needed, so the results I requested need to be known.

Things don't just happen by magic.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Mon Feb 17, 2014 12:13 am

Hi Guys,

Thank you very much for all your help. This has been finally completed.
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby dick scherrer » Mon Feb 17, 2014 7:13 am

good to hear it is working - thank you for letting us know.

If you post your solution, it might help someone later.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post