Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extracting matching records using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vidusha

New User


Joined: 01 Feb 2006
Posts: 20
Location: Chennai

PostPosted: Wed Jul 25, 2007 3:00 pm    Post subject: Extracting matching records using DFSORT
Reply with quote

Hi,

My input file has three types of record AA, AB and AC like below

AA0001000123
AB48901
AC0009
AA0001000222
AB00121
AA0001000123
AA0001000233
AA0001000123
AB80909

AA is the main record..AB and AC are optional under that.
I want to extract all AA records which satisfy (10,3,EQ,123) and its optional records

so my output should look like

AA0001000123
AB48901
AC0009
AA0001000123
AA0001000123
AB80909

Could you please provide the approach of getting this using DFSORT
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Jul 25, 2007 3:37 pm    Post subject:
Reply with quote

Vidusha,

Quote:
AA is the main record


What happend to AA0001000222 and AA0001000233
record in the OP file?

Post more info with regard to your requirement along with file attributes.
Back to top
View user's profile Send private message
Vidusha

New User


Joined: 01 Feb 2006
Posts: 20
Location: Chennai

PostPosted: Wed Jul 25, 2007 3:52 pm    Post subject:
Reply with quote

Hi,

I want to extract all AA records which satisfy (10,3,EQ,123) and its optional records

So the records you have mentioned do not satify the condition.

The file is FB of LRECL 125

Let me know if you need any other information
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 25, 2007 5:12 pm    Post subject:
Reply with quote

Vidusha
Check the Include or omit groups of records Smart DFSORT trick at

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Fri Jul 27, 2007 12:00 pm    Post subject:
Reply with quote

// EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
AA0001000123
AB48901
AC0009
AA0001000222
AB00121
AA0001000123
AA0001000233
AA0001000123
AB80909
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)
//T2 DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(5,5),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(T1) TO(T2) USING(CTL2)
COPY FROM(T1) TO(T2)
SPLICE FROM(T2) TO(OUT) ON(90,9,ZD) WITHALL WITH(1,80) USING(CTL3)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,9,ZD)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'AA'),OVERLAY=(90:SEQNUM,9,ZD)),
IFTHEN=(WHEN=NONE,OVERLAY=(99:SEQNUM,9,ZD,90:81,9,ZD,SUB,99,9,ZD,M11,LENGTH=9))
/*
//CTL2CNTL DD *
INCLUDE COND=(1,2,CH,EQ,C'AA',AND,10,3,CH,EQ,C'123')
INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'AA',AND,10,3,CH,EQ,C'123'),OVERLAY=(108:C'*'))
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(108,1,CH,EQ,C'*'),OUTREC=(1,80)
/*
//
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Fri Jul 27, 2007 1:23 pm    Post subject:
Reply with quote

Tuned the before one is below
// EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
AA0001000123
AB48901
AC0009
AA0001000222
AB00121
AA0001000123
AA0001000233
AA0001000123
AB80909
//T DD DSN=&&T,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(T) USING(CTL1)
SPLICE FROM(T) TO(OUT) ON(90,9,ZD) WITHALL WITH(1,80) KEEPBASE KEEPNODUPS USING(CTL2)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,9,ZD)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'AA'),OVERLAY=(90:SEQNUM,9,ZD)),
IFTHEN=(WHEN=NONE,OVERLAY=(99:SEQNUM,9,ZD,108:X,90:81,9,ZD,SUB,99,9,ZD,M11,LENGTH=9))
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'AA',AND,10,3,CH,EQ,C'123'),OVERLAY=(108:C'*'))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(108,1,CH,EQ,C'*'),OUTREC=(1,80)
/*
//
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jul 27, 2007 8:42 pm    Post subject:
Reply with quote

Vidusha,

Here's a DFSORT/ICETOOL job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/125)
//OUT DD DSN=...  output file (FB/125)
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(127,8,ZD) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,125) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(126:C'N',127:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'AA'),
                OVERLAY=(127:SEQNUM,8,ZD),HIT=NEXT),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'AA',AND,10,3,CH,EQ,C'123'),
                OVERLAY=(126:C'Y')),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(135:SEQNUM,8,ZD,
                         127:127,8,ZD,SUB,135,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,INCLUDE=(126,1,CH,EQ,C'Y'),
    BUILD=(1,125)
/*
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us