IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Omit a group of records if meet some condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Sun May 04, 2014 2:45 pm
Reply with quote

I would like to remove a group of records B/C/D/E if col 287-288 in line C is not in range(EU, IT, NL,...)

The input file and output file is FB, length 512.

My input looks like this
Code:

col 1-512
@...
A...
B...
     col287-288
C...EU...
D...
E...
B...
C...IT...
D...
E...
B...
C...US
D
E
Many B/C/D/E lines
#


My output should looks like this
Code:

@...
A...
B...
     col287-288
C...EU...
D...
E...
B...
C...IT...
D...
E...
#


Here's my thoughts.
Step 1: split the file into FILE1(The first 2 lines), FILE2(B/C/D/E lines), FILE3(Trailer line)
Step 2: Create FILE3 by Concatenate B/C/D/E lines into one single line from FILE2 using RESIZE function.
Step 3: Create FILE4 omit records if col 1311-1312 not in specific range and using RESIZE function to split the concatenation line into 4 B/C/D/E lines.
Step 4: Combine FILE1, FILE4, FILE3 into the final file FILE5.

It seems too complex, I would like to ask for help if any simple solution on it. Many thanks!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun May 04, 2014 4:20 pm
Reply with quote

You already have a very similar topic. Have you thought to apply the same technique? GROUP, PUSH the entire record, GROUP, PUSH the country-code, INCLUDE=/OMIT= on OUTFIL. You should already have enough to do it, you just have to reallise it is a similar thing. Unless I'm mis-reading...
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Mon May 05, 2014 8:10 am
Reply with quote

Bill Woodger wrote:
You already have a very similar topic. Have you thought to apply the same technique? GROUP, PUSH the entire record, GROUP, PUSH the country-code, INCLUDE=/OMIT= on OUTFIL. You should already have enough to do it, you just have to reallise it is a similar thing. Unless I'm mis-reading...


Hi Bill,

Yes, i know the GROUP/PUSH technique, but i can't have a solution about how to push the country code from D line to every lines of the group B/C/D/E lines

You said push the entire record, do you mean push the entire B record?
Code:

B+B
C+B
D+B
E+B
B+B
C+B
D+B
E+B


However, the country code is in col 287-288 D line, how to make sure the country code will be pushed to every lines of group B/C/D/E?
[/quote]
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 05, 2014 2:58 pm
Reply with quote

You should, I think, be able to appy the same technique as used in [http://ibmmainframes.com/viewtopic.php?p=322603#322603]this[/url] one. If that does not work, you could look at the "offset" JOINKEYS. You join on sequence numbers allocated in both JNFnCNTL files, one starts from zero, the other starts from one. When you have the match, you have "current" and "previous" record at the same time. There's a recent example either in here or in the JCL part of the forum for SyncSort.

If you can apply neither, explain why, show sample input expected out.
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Tue May 06, 2014 10:25 am
Reply with quote

Thanks Bill, i tried with JOINKEYS, and it works for me.

Here's the code.
Code:

//JNF1CNTL DD *                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'B'),       
                PUSH=(513:ID=8))                         
/*                                                       
//JNF2CNTL DD *                                         
  INCLUDE COND=(1,1,CH,EQ,C'D')                         
  INREC OVERLAY=(513:SEQNUM,8,ZD)                       
/*                                                       
//SYSIN  DD  *                                           
  JOINKEYS F1=IN1,FIELDS=(513,8,A),SORTED,NOSEQCK       
  JOINKEYS F2=IN2,FIELDS=(513,8,A),SORTED,NOSEQCK       
  REFORMAT FIELDS=(F1:1,512,F2:287,2)                   
  OPTION COPY                                           
  OUTFIL FNAMES=SORTOUT,INCLUDE=(513,2,CH,EQ,C'NL',OR,   
                                 513,2,CH,EQ,C'DE',OR,   
                                 1,1,CH,EQ,C'#'),       
         BUILD=(1,512)                                   
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 06, 2014 11:56 am
Reply with quote

Thanks for letting us know and posting what works for you. When the data slipped from the 'C' to the 'D' record, you got yourself a solution.

Be aware that it relies upon the 'D' record, always, always, being present. I'd have a quick review that something somewhere else already verifies the integrity of the file.

Nice work.
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Tue May 06, 2014 12:18 pm
Reply with quote

icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top