Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Requirement wherein i have to extract records like the below

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Requirement wherein i have to extract records like the below
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    Post subject: Reply to: Sort Query
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    Post subject: Reply to: Sort Query
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    Post subject: Re: Reply to: Sort Query
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    Post subject:
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    Post subject:
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    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Spool Extract for Z /os 1.04 version Khadhar Basha CLIST & REXX 3 Thu Sep 28, 2017 3:14 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us