String Search & Record Count.



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

String Search & Record Count.

Postby Vineet » Thu Feb 07, 2013 1:48 am

Hi All,

I am having a sequential file which I am recving from 3rd Party. Record Count is varying daily. May possible for some day we may recieve 1 record, next day we may recieve 1000 records. One thing is sure, File will always have "EOF" Char. Below is my requirment. All records except "EOF" char. is termed as Valid Record.


1. If a File is having only 1 Record & Starting from Position = 1 & Length = 3, we have Char like 'EOF' then Need to set the Return Code = 4.
2. If File is having more than 1 Records & last Record is having Char as 'EOF' Starting from Position = 1 & Length = 3. All records except Char 'EOF' Should get written to an O/P file.
Example: 1. File Having 6 Valid Record.
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
444446|3789765|ABCDEFVHJK1234|.............. --> Written To O/P File
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
EOF --> Should NOT get Written To O/P File.

Exmple: 2. File Having only 1 Valid Record.
123456|3456789|ABCDEFVHJK1234|.............. --> Written To O/P File
EOF --> Should NOT get Written To O/P File

I/P & O/P file having attributes as LRECL = 3132 & Recfm = FB. How this can be done using SORT.

Thanks
KInd Rgd's
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: String Search & Record Count.

 

Re: String Search & Record Count.

Postby NicC » Thu Feb 07, 2013 6:41 pm

By using COPY and EXCLUDE. Then , without actually checking the manual for the correct keyword, use NULLOUT to set the return code.
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: String Search & Record Count.

Postby BillyBoyo » Thu Feb 07, 2013 7:58 pm

I'd do it like this. CHKOUT is a DD DUMMY in the JCL

  OPTION COPY
                                                           
  OUTFIL FNAMES=SORTOUT,OMIT=(1,3,CH,EQ,C'EOF'),NULLOFL=RC4
                                                           
  OUTFIL FNAMES=CHKOUT,SAVE,NULLOFL=RC16


With an empty file (no records at all), you'll get a 16. With an EOF but no data you'll get 4. With data but no EOF you'll get 16. With data and an EOF you'll get a 0.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: String Search & Record Count.

Postby Vineet » Thu Feb 07, 2013 8:10 pm

Thanks Billiyboyo, I'll try & update U on same.
Rgd's
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: String Search & Record Count.

Postby BillyBoyo » Thu Feb 07, 2013 9:13 pm

The option NULLOUT is for SORTOUT when not affected by OUTFIL.

This would work with a simple OMIT, but would not give the flexibility of being able to identify the absence of the "EOF" record.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: String Search & Record Count.

Postby Vineet » Thu Feb 07, 2013 9:26 pm

Thanks Billyboyo, it worked for me. Char. "EOF" is mandatory.
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: String Search & Record Count.

Postby BillyBoyo » Thu Feb 07, 2013 9:47 pm

If something is "mandatory" then I always check it is there, otherwise something is wrong - wrong file, incomplete file, whatever. That's why I said "I'd do it like this", because that's what I'd do :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: String Search & Record Count.

Postby skolusu » Fri Feb 08, 2013 11:48 pm

Vineet,

This is the second topic about setting a return code when a particular string is found. Why can't you specify the complete requirements once instead of bits and pieces of requirements? You are not only wasting your time but also the time of people who are trying to help you.
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: String Search & Record Count.

Postby Vineet » Fri Feb 08, 2013 11:54 pm

Hi Skolusu,

When U replied 1st time, I tested & presented the results. Later the requirement got changed & when I made the required changes 1 condition was failing. Because of this I raised the query. I am sorry if U feel I wasted the time.

Rgd's
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post