|
View previous topic :: View next topic
|
| Author |
Message |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
I have one file with RECFM=VB & Record Length is 1504 with different types of data with Header record as record type '1' Detail '2' & trailer '3' @ position 37.
There is an X ID from 23rd column for 9 bytes which has all these 3 types of record i.e. 1 or 2 or 3 type.
All the record starts with a Y ID for first 5 bytes which would be same for a same set of X ID records.
Now I need to make the 2 output files.
1. will contain only those records whose first 5 bytes or Y ID is a value say '77777' and also the 751 th column upto 3 Bytes of Detail record i.e record type '2' is having numeric value as 888 Or 999 or 000. While writing this file the group of records should be on the basis of X ID.
2. The rest of the file..
| Code: |
I/p example..
----+----1----+----2----+----3----+----4----+----5----+
********************************* Top of Data *********
77777056072124201110195600218960000112011100320111003A1 .. Header rec
7777705607212420111019560021896000022 395608N492810860 .. Detail Rec .. @751 value is 999 as numeric
7777705607212420111019560021896000033000010000002862B00 .. Trailer Rec
88888056072124201110197001720290000112011100520111005A1
8888805607212420111019700172029000022 599746N597623721 .. Detail rec @751 value is 001
8888805607212420111019700172029000032 800351N001210775 .. Detail rec @751 value is 001 these wud be same
8888805607212420111019700172029000073000050000000976F00
88888056072124201110197001721100000112011100520111005A1
8888805607212420111019700172110000022 953911N540920191 .. Detail rec @751 value is 000
8888805607212420111019700172110000032 762815N003952775 .. Detail rec @751 value is 000
8888805607212420111019700172110000042 614406N000245800 .. Detail rec @751 value is 000
8888805607212420111019700172110000052 065255N495020500 .. Detail rec @751 value is 000
8888805607212420111019700172110000075000050000017994D00 |
E.g: here Y Id s are 77777 & 88888 with X ID s starting from 23rd column of 9 bytes i.e. 560021896 or 700172029 or 700172110 that have data type '1' '2' or '3'.
And in the Data type '2' there could be multiple entries but 751 th column wud be same for a specific X ID; wud be either '000' or '888' & '999' etc.
Note: The first file would be written only when Y ID = '77777' & 751 th column is among '000' / '888' / '999'.
So Output 1 will be :
| Code: |
77777056072124201110195600218960000112011100320111003A1 ..
7777705607212420111019560021896000022 395608N492810860 ..
7777705607212420111019560021896000033000010000002862B00 .. |
Output 2 will contain rest of the unsatisfying records..
& Output 2 will be:
| Code: |
88888056072124201110197001721100000112011100520111005A1
8888805607212420111019700172110000022 953911N540920191 ..
8888805607212420111019700172110000032 762815N003952775 ..
8888805607212420111019700172110000042 614406N000245800 ..
8888805607212420111019700172110000052 065255N495020500 ..
8888805607212420111019700172110000075000050000017994D00
88888056072124201110197001720290000112011100520111005A1
8888805607212420111019700172029000022 599746N597623721 ..
8888805607212420111019700172029000032 800351N001210775 ..
8888805607212420111019700172029000073000050000000976F00 |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
1. will contain only those records whose first 5 bytes or Y ID is a
value say '77777' and also the 751 th column upto 3 Bytes of Detail
record i.e record type '2' is having numeric value as 888 Or 999 or 000. |
I'm not clear on all of the variations you want to handle. Perhaps a more extensive example of input and output would help.
Specifically:
Will you only be selecting on a single value of the X ID (e.g. 77777) or could you select on multiple values of the X ID (e.g. 77777 and 99999 and 00000)?
Can you select more than one X ID/Y ID group? For example, could you have
77777 group with YID1 and 999
77777 group with YID2 and 666
77777 group with YID3 and 888
77777 group with YID4 and 000
Would you want the groups for 77777 YID1, YID2 and YID4 in output1? |
|
| Back to top |
|
 |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
Hi Frank,
Actually I need only for a single value of YID and that is '77777' under which group would be on the basis of a single X ID with its detail value as 999/000/888.
each XID will be either with 999 or 000 or 888 but the Detail line i.e. '2' occurrence could be multiple
such that...
YID1 with XID1 Header i.e. record type '1'
YID1 with XID1 Detail i.e. record type '2' with 000
YID1 with XID1 Detail i.e. record type '2' with 000
YID1 with XID1 Detail i.e. record type '2' with 000
YID1 with XID1 Trailer i.e. record type '3'
But the Output file would be
first file:
77777 group with XID1 with value 000/999/888
77777 group with XID2 with value 000/999/888
77777 group with XID6 with value 000/999/888
second file could be :
77777 group with XID3 with value other than 000/999/888
88888 group with XID4 with value other than 000/999/888
99999 group with XID5 with value other than 000/999/888
77777 group with XID7 with value like 111/222 i.e. anything other than 000/999/888
please let me know if its still not comprehending..
Thanks in advance..
D Rishi |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If I understand correctly what you want to do, then you can use a DFSORT/ICETOOL job like this:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB/1504)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=... output file1 (VB/1504)
//OUT2 DD DSN=... output file2 (VB/1504)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY JKFROM USING(CTL2)
//CTL1CNTL DD *
OPTION VLSCMP
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:16X,21:5)),
IFTHEN=(WHEN=GROUP,BEGIN=(57,1,CH,EQ,C'1'),
PUSH=(5:ID=8,13:SEQ=8))
OUTFIL FNAMES=T1,
INCLUDE=(13,8,ZD,EQ,2,AND,21,5,CH,EQ,C'77777',AND,
771,3,SS,EQ,C'000,999,888'),
VTOF,BUILD=(5,8)
//CTL2CNTL DD *
JOINKEYS F1=T1,FIELDS=(1,8,A)
JOINKEYS F2=IN,FIELDS=(5,8,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,4,?,F2:13)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(5,1,CH,EQ,C'B'),BUILD=(1,4,6)
OUTFIL FNAMES=OUT2,INCLUDE=(5,1,CH,EQ,C'2'),BUILD=(1,4,6)
//JNF2CNTL DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:8X,13:5)),
IFTHEN=(WHEN=GROUP,BEGIN=(49,1,CH,EQ,C'1'),
PUSH=(5:ID=8))
/*
|
|
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
D Rishi,
See if below works...
Because your positions match sample input data shown and because your input is VB, I have added 4 bytes for RDW. If that's not the case you need to re-adjust positions. If your input file already sorted on key fields then add SORTED,NOSEQCK in your joinkey to save extra processing.
Frank,
I might have completely misunderstood OP's requirement. Below is just an attempt for the alternate solution.
| Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=INPUT.VB1504
//SORTJNF2 DD DISP=SHR,DSN=INPUT.VB1504
//MATCHED DD DSN=OUTPUT.MATCHED.VB1504,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA
//DROPPED DD DSN=OUTPUT.DROPPED.VB1504,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(5,5,A,27,9,A)
JOINKEYS FILES=F2,FIELDS=(5,5,A,27,9,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,4,F2:755,3,F1:5)
SORT FIELDS=COPY
OUTFIL FNAMES=MATCHED,INCLUDE=(5,3,SS,EQ,C'888,999,000'),
BUILD=(1,4,8)
OUTFIL FNAMES=DROPPED,SAVE,BUILD=(1,4,8)
/*
//JNF2CNTL DD *
OPTION VLSCMP
INCLUDE COND=(05,05,CH,EQ,C'77777',AND,41,01,CH,EQ,C'2',AND,
755,03,SS,EQ,C'888,999,000')
SUM FIELDS=NONE
/* |
Thanks, |
|
| Back to top |
|
 |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
hello Sqlcode1,
I tried with u r code but giving the error like..
| Code: |
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 20:03 ON SUN OCT
JOINKEYS FILES=F1,FIELDS=(5,5,A,27,9,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
|
Seemingly Join is not working.. and my question is when this code will be moved to production am I suppose to give two Inputs of same file?
Thanks D Rishi |
|
| Back to top |
|
 |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
Hi Frank,
I tried also with your code & it is giving Maxcc = 12 & the error..
| Code: |
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN
ICE630I 0 MODE IN EFFECT: STOP
COPY FROM(IN) USING(CTL1)
ICE606I 0 DFSORT CALL 0001 FOR COPY FROM IN TO OUTFIL USING CTL1CNTL COM
ICE602I 0 OPERATION RETURN CODE: 00
COPY JKFROM USING(CTL2)
$
ICE604A 0 ERROR IN KEYWORD, PARAMETER, OR DELIMITER
ICE602I 0 OPERATION RETURN CODE: 12
|
(Note: '$' is in below to J of JKFROM)
do I need to change anything in place of '?' in below
| Code: |
REFORMAT FIELDS=(F2:1,4,?,F2:13)
|
Thanks, D Rishi |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
also you need ICE201I message to be at least ICE201I G or higher for JOINKEYS to function, it appears from the errors you are getting you do not have the correct Level of DFSORT.
Gerry |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
| Quote: |
Using JOINKEYS with ICETOOL SORT and COPY
You can use a JOINKEYS application with a COPY or SORT operator of ICETOOL, but not with any of the other
ICETOOL operators. A new JKFROM operand can be used instead of a FROM(indd) operand for the SORT and
COPY operators to tell DFSORT you will provide a JOINKEYS statement with F1=ddname1 for the F1 file and a
JOINKEYS statement with F2=ddname2 for the F2 file, as well as JOIN and REFORMAT statements as needed.
With JKFROM, ICETOOL will use 'JOINKEYS' in the ICE606I message instead of the FROM ddname and will
terminate if a JOINKEYS application is not specified correctly.
For multiple JOINKEYS applications within a single ICETOOL step:
You can reference different JOINKEYS F1 and F2 input files for the different SORT and/or COPY operators
by using F1=ddname and F2=ddname on the various JOINKEYS statements as appropriate
User Guide |
Gerry |
|
| Back to top |
|
 |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
Hi Dick & gcichet,
I personally regard Frank the SORT GURU.. I also want to update my knowledge in ICETOOL a bit.. can you please suggest any tutorial for basics..
I am getting maxcc 16 as i changed the JKFROM with
COPY FROM(T1) USING(CTL2)..
COPY FROM(T1) USING(CTL2)
ICE606I 0 DFSORT CALL 0002 FOR COPY FROM T1 TO OUTFIL USING CTL2CNTL TE
ICE602I 0 OPERATION RETURN CODE: 16
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16
Thank you also for guiding me..
D Rishi |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Jerry,
I didn't doubt Frank's code, but every once in a while a typo creaps in
No DFSORT here, so i couldn't run a simple test and as it was weekend, thought i'd participate anyway.
I expect Frank will clean out most of this
Not only is Frank the guru, he is the author of much of the product. . .
d |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 20:03 ON SUN OCT |
This message indicates you are using z/OS DFSORT V1R5, an unsupported release of DFSORT on an unsupported release of z/OS. And you're using a downlevel version of that DFSORT release which doesn't support JOINKEYS.
The supported versions are z/OS DFSORT V1R10 for z/OS 1.10-1.11 and z/OS DFSORT V1R12 for z/OS 1.12-1.13. You really need to move to a supported version of DFSORT before I can help you.
Ask your System Programmer why your site is running on an unsupported z/OS release and when you will be moving to a supported release. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| I also want to update my knowledge in ICETOOL a bit.. can you please suggest any tutorial for basics. |
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
unfortunately for me we are still on ICE201I E level of DFSORT (April 2006 )
Gerry |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Wow, that is really downlevel. Might I ask why? |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
| Trying to get anything changed here is like pushing shit up a hill. (pardon the expression) |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Just out of curiosity - what release of z/OS is your site using (or are you still using OS/390 or MVS/ESA)?  |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
| z/OS 1.9 |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Hey, that's not as bad as I thought. Only one z/OS release away from being supported.
Hopefully you'll get to a supported release of z/OS one of these days (that would be z/OS 1.10 and above as of this writing) and get the updated DFSORT release that goes with it. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Actually we are going to z/OS 1.11 in the next couple of months.
Looking forward to playing with some of new DFSORT functions which are unvailable to me at the moment  |
|
| Back to top |
|
 |
D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
Frank,
Thanks for your help.. I have started the workaround for this problem through Cobol program. Lets see how it works..
Sorry for late reply.. was on Holiday leave for Diwali..
Happy Diwali to all of you..
Regards, D Rishi |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|