Page 1 of 1

String Search & Record Count.

PostPosted: Thu Feb 07, 2013 1:48 am
by Vineet
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

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 6:41 pm
by NicC
By using COPY and EXCLUDE. Then , without actually checking the manual for the correct keyword, use NULLOUT to set the return code.

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 7:58 pm
by BillyBoyo
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.

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 8:10 pm
by Vineet
Thanks Billiyboyo, I'll try & update U on same.
Rgd's

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 9:13 pm
by BillyBoyo
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.

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 9:26 pm
by Vineet
Thanks Billyboyo, it worked for me. Char. "EOF" is mandatory.

Re: String Search & Record Count.

PostPosted: Thu Feb 07, 2013 9:47 pm
by BillyBoyo
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 :-)

Re: String Search & Record Count.

PostPosted: Fri Feb 08, 2013 11:48 pm
by skolusu
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.

Re: String Search & Record Count.

PostPosted: Fri Feb 08, 2013 11:54 pm
by Vineet
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