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

Requirement wherein i have to extract records like the below


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Tue Mar 03, 2009 3:55 am
Reply with quote

Hi,
I have a requirement wherein i have to extract records like the below

ey is first 17 bytes
I have to extract records based on first 17 bytes and next one byte ( Rec Disposition )


Case I
If the first 17 bytes are unequal , then keep the record disposition 6 in the output file

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX400057478000217E       
DXZBA30GX400098006000217N                   --> Keep this record
DXZBA30GX400098628000217E       


Case II
Remove the record type = 6 (as below)
If there are records with first 17 bytes equal and having record disposition of 6 and 8
then delete the type 6 and keep the type 8

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX550835018000217E       
DXZBA30GX550836896000217N                --> Delete this record
DXZBA30GX550836898000217E              --> Keep this record
DXZBA30GX550836928000217E       


Case III
Remove the Record Disposition = 6 and next Record Disposition = 8(as below)..
Keep the last record with the disposition 8

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX551116228000217E         
DXZBA30GX551216336000217N                --> Delete this record   
DXZBA30GX551216338000217E              --> Delete this record
DXZBA30GX551216338000217E              --> Keep this record       
DXZBA30GX551117208000217E         


Need help
if anyone can help then it would be great
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 03, 2009 4:44 am
Reply with quote

Thunderstrom,

The following DFSORT JCL will give you the desired results. I assumed that your inout is 80 bytes lrecl and FB recfm

Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *
DXZBA30GX400057478000217E                           
DXZBA30GX400098006000217N --> KEEP THIS RECORD     
DXZBA30GX400098628000217E                           
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                     
  OPTION EQUALS                                     
  INCLUDE COND=(18,1,SS,EQ,C'6,8')                 
  SORT FIELDS=(1,18,CH,A)                           
  OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,17))   
  OUTFIL REMOVECC,NODETAIL,BUILD=(1,80),           
  OMIT=(18,1,ZD,EQ,8,AND,81,8,ZD,EQ,1),             
  SECTIONS=(1,17,TRAILER3=(1,80))                   
/*
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Tue Mar 03, 2009 5:18 am
Reply with quote

Hi Skolusu,
I was expecting the output to be
DXZBA30GX400057478000217E
DXZBA30GX400098006000217N --> KEEP THIS RECORD

As the key is first 17 bytes.

Thanks
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 03, 2009 5:37 am
Reply with quote

thunderstorm wrote:
Hi Skolusu,
I was expecting the output to be
DXZBA30GX400057478000217E
DXZBA30GX400098006000217N --> KEEP THIS RECORD

As the key is first 17 bytes.

Thanks


huh? how did the first record get picked and the last record get dropped?
The sample input you have shown is
Code:

----+----1----+-- 18th
DXZBA30GX40005747 8
DXZBA30GX40009800 6
DXZBA30GX40009862 8


now all the 3 keys are different and how come you only picked the first and 2nd record? 2nd record has a 6 and that explains as to why you picked it , but how about DXZBA30GX40009862 key? Why did it get dropped? You need to do a better job of explaining the rules.
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Tue Mar 03, 2009 5:44 am
Reply with quote

i am sorry..the "--> Keep this record " AND "--> Delete this record" are given for the duplicate ones except for the CASE I..

so, in CASE I , the output will be all the 3 records
DXZBA30GX400057478000217E
DXZBA30GX400098006000217N --> Keep this record
DXZBA30GX400098628000217E

in CASE II
DXZBA30GX550835018000217E
DXZBA30GX550836898000217E --> Keep this record
DXZBA30GX550836928000217E

in CASE III

DXZBA30GX551116228000217E
DXZBA30GX551216338000217E --> Keep this record
DXZBA30GX551117208000217E


I am sorry again for the confusion..can you now tell me how it can be done via sort ?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 03, 2009 5:54 am
Reply with quote

thnderstorm.

Just delete the following line in my SYSIN control cards and re run your job

Code:

OMIT=(18,1,ZD,EQ,8,AND,81,8,ZD,EQ,1),   
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 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top