|
View previous topic :: View next topic
|
| Author |
Message |
abby.qiong.zhang
New User
Joined: 07 Jun 2012 Posts: 26 Location: China
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| 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 |
|
 |
abby.qiong.zhang
New User
Joined: 07 Jun 2012 Posts: 26 Location: China
|
|
|
|
| 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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
abby.qiong.zhang
New User
Joined: 07 Jun 2012 Posts: 26 Location: China
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
abby.qiong.zhang
New User
Joined: 07 Jun 2012 Posts: 26 Location: China
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|