|
|
| Author |
Message |
jacobdng
New User
Joined: 27 Aug 2006 Posts: 11
|
|
|
|
The content of the the file are as the followings:
| Code: |
Customer No Record Type Info Customer Type
X(11) X(04) X(10) X(01)
--------------- -------------- ---------------- -----------------
10000000001 T100 AAAAAAAAAA A
10000000001 T200 BBBBBBBBBB
10000000001 T201 CCCCCCCCC
10000000001 T300 DDDDDDDDD
10000000002 T100 EEEEEEEEEEE B
10000000002 T200 FFFFFFFFFFFFF
10000000002 T201 GGGGGGGGG
10000000002 T300 HHHHHHHHHH
|
The requirement to omit is :
When the Customer Type = 'A' and the Record Type = 'T2xx' , the record should be omitted.
Therefore, the 2nd and 3rd records should be omitted.
How to accomplish this result with DFSORT? |
|
| Back to top |
|
 |
References
|
|
 |
Varun Singh
New User
Joined: 01 Aug 2007 Posts: 25 Location: Delhi
|
|
|
|
Hi jacob,
You can use the following JCL.....
| Code: |
//STEP10 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= i/p DSN,DISP=SHR
//SORTOUT DD DSN= o/p DSN,DISP=OLD
//SYSIN DD *
SORT FIELDS = COPY
OMIT COND=(12,2,CH,EQ,C'T2',AND,26,1,CH,EQ,C'A')
/* |
this should work... |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 650
|
|
|
|
Hi Varun,
have you tested what you have posted ?
There are space between FIELDS = COPY
How does your omit get rid of rec2 and 3 ? Neither have an A
Gerry |
|
| Back to top |
|
 |
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 133 Location: india
|
|
|
|
hello acobdng,
As per your rule:
| Quote: |
The requirement to omit is :
When the Customer Type = 'A' and the Record Type = 'T2xx' , the record should be omitted.
Therefore, the 2nd and 3rd records should be omitted. |
i feel none of the records should be omitted for the input records you posted above as in 2 and 3 records should have both the conditions meet i.e. both Customer Type = 'A' and the Record Type = 'T2xx'.
Your requriment is not clear can you explain it with some better example.
regards,
rajat |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 650
|
|
|
|
Hi,
I think the keyword here is GROUP (see title), so the first 4 records belong to customer type A and the next 4 belong to customer type B.
Gerry |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
jacobdng,
Assuming Gerry is right about what you're trying to do (and I think he is), here's a DFSORT/ICETOOL job that will do it:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/26)
//OUT DD DSN=... output file (FB/26)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(28,8,ZD) WITHALL WITH(1,26) -
KEEPNODUPS KEEPBASE USING(CTL1)
/*
//CTL1CNTL DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(28:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(26,1,CH,NE,C' '),
OVERLAY=(27:26,1,28:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(36:SEQNUM,8,ZD,
28:28,8,ZD,SUB,36,8,ZD,TO=ZD,LENGTH=8))
OUTFIL FNAMES=OUT,
OMIT=(27,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),
BUILD=(1,26)
/*
|
In the future, please try to explain what you want to do more clearly so people don't have to guess. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 356 Location: San Jose
|
|
|
|
The following DFSORT/ICETOOL JCL will give you the desired results. I assumed that your input is FB and is 26 bytes in length
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
----+----1----+----2----+----3----+----4----+----5----+----6-
10000000001T100AAAAAAAAAAA
10000000001T200BBBBBBBBBB
10000000001T201CCCCCCCCC
10000000001T300DDDDDDDDD
10000000002T100EEEEEEEEEEB
10000000002T200FFFFFFFFFF
10000000002T201GGGGGGGGG
10000000002T300HHHHHHHHHH
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,11,CH) WITHALL WITH(1,25) -
KEEPNODUPS KEEPBASE USING(CTL1)
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,IFOUTLEN=26,
OMIT=(26,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),
IFTHEN=(WHEN=INIT,OVERLAY=(27:SEQNUM,8,ZD,RESTART=(1,11))),
IFTHEN=(WHEN=(27,8,ZD,GT,1),OVERLAY=(26:X))
/*
|
|
|
| Back to top |
|
 |
jacobdng
New User
Joined: 27 Aug 2006 Posts: 11
|
|
|
|
Frank,
Your solution is perfect.
The statement of the omit requirement should be admended like
"When the Customer Type = 'A' , then the rows which has the same Customer No and the Record Type is like 'T2%' should be omitted."
Questions:
1) In the 3rd IFTHEN sentence, what is the function of "SUB" ?
2) How to edit the input in order to make it like a TSO frame?
Thanks again, and sincerely grateful to the other gentalemen.
I love this forum.
Jacob |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
| Quote: |
| 1) In the 3rd IFTHEN sentence, what is the function of "SUB" ? |
SUB does a subtract. Those IFTHEN clauses are all part of the "group trick" explained in the "Include or omit groups of records" Smart DFSORT Trick at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
| Quote: |
| 2) How to edit the input in order to make it like a TSO frame? |
I don't know what a TSO frame is. Perhaps somebody else can help with that, or you can show what you want the output to look like. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can do this more easily and efficiently using the new WHEN=GROUP function like this:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/26)
//SORTOUT DD DSN=... output file (FB/26)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(26,1,CH,NE,C' '),
PUSH=(27:26,1))
OUTFIL OMIT=(27,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),
BUILD=(1,26)
/*
|
For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ |
|
| Back to top |
|
 |
jacobdng
New User
Joined: 27 Aug 2006 Posts: 11
|
|
|
|
Frank,
Is there a way to verify the release version of DFSORT on-site without bothering the others?
Jacob |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8633 Location: 221 B Baker St
|
|
| Back to top |
|
 |
|
|
|