Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Omit a group of records if meet some condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Omit a group of records if meet some condition
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun May 04, 2014 4:20 pm    Post subject: Reply to: Omit a group of records if meet some condition
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    Post subject: Re: Reply to: Omit a group of records if meet some condition
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon May 05, 2014 2:58 pm    Post subject: Reply to: Omit a group of records if meet some condition
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue May 06, 2014 11:56 am    Post subject: Reply to: Omit a group of records if meet some condition
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us