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

Extracting matching records using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Wed Jul 25, 2007 3:37 pm
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
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
Reply with quote

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

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
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
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 Developer


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

PostPosted: Fri Jul 27, 2007 8:42 pm
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:

Use [URL] BBCode for External Links

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 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 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top