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

select detail records based on a check on header record


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

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Wed May 27, 2009 2:11 am
Reply with quote

Code:

BH20090521ZX30002009052105USD  000000000        052415456
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052415457
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052421925
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052429561
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052451141
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052451142

This is my input file.

Now I want to give following as input based on which sorting will be done-
052415456
052421925
052429561

These values are at a certain position in BH(header record).
Now I want to output that particular BH record along with the PT records associated with it just below it. Number of PT records can vary.

Also need to know how can I give
052415456
052421925
052429561 values as condition to sort. Can it be done through a sysin?
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: Wed May 27, 2009 3:02 am
Reply with quote

You can use a DFSORT job like the following to do what you asked for. You can set up your values as Symbols in a SYMNAMES data set as shown (assuming you have a reasonable maximum number of values, e.g. less than 1500) and use the Symbols in the INCLUDE operand. I assumed your input file has RECFM=FB and LRECL=80 but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD *
T0001,'052415456'
T0002,'052421925'
T0003,'052429561'
/*
//SORTIN DD *
BH20090521ZX30002009052105USD  000000000        052415456
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052415457
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052421925
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052429561
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052451141
PT31                    LPUSD1226530000000000015036000000
PT407422000000                    30000000000015036000000
BH20090521ZX30002009052105USD  000000000        052451142
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'BH'),
     PUSH=(81:49,9))
  OUTFIL BUILD=(1,80),
   INCLUDE=(81,9,CH,EQ,T0001,OR,
            81,9,CH,EQ,T0002,OR,
            81,9,CH,EQ,T0003)
/*
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Wed May 27, 2009 8:17 pm
Reply with quote

Frank I got 1800+ values there. any improved option.?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed May 27, 2009 9:21 pm
Reply with quote

t5590ag,

Answer the following questions

What is the LRECL and RECFM of the master file.
What is the position and format of the key in the master file
What is the LRECL and RECFM of the lookup key file
What is the position and format of the key in this file?
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Wed May 27, 2009 10:32 pm
Reply with quote

master file is FB/400
---+----4----+----5----+----6--
op of Data ********************
000000000 052529991
2653000000000001503600000000000
3000000000001503600000000000
000000000 052529992
2653000000000001503600000000000
3000000000001503600000000000
000000000 052522021
2653000000000001503600000000000
3000000000001503600000000000
000000000 052522022
2653000000000001503600000000000
3000000000001503600000000000
000000000 052484322
6653000000000003756400000000000
3000000000003020000000000000
3000000000000736400000000000
000000000 052484323
6653000000000003756400000000000

key is at position 49-57 in master.
Lookup key file am going to create with these key values taken from somewhere else so as of now it will be FB/9(length of key value).
Pos will be 1-9. Nothing else will be there.[/code]
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Wed May 27, 2009 10:40 pm
Reply with quote

Code:

3----+----4----+----5----+---
 Top of Data ****************
  000000000        052529991
12265300000000000150360000000
     300000000000150360000000
  000000000        052529992
12265300000000000150360000000
     300000000000150360000000
  000000000        052522021
12265300000000000150360000000
     300000000000150360000000
  000000000        052522022
12265300000000000150360000000
     300000000000150360000000
  000000000        052484322
14665300000000000375640000000
     300000000000302000000000
     300000000000073640000000
  000000000        052484323
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Wed May 27, 2009 10:41 pm
Reply with quote

above is my master file in proper format
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed May 27, 2009 11:42 pm
Reply with quote

t5590ag,

Since you haven't yet created the lookup file, I suggest you create it as FB 400 so that we can concatenate it to the master file as is with following layout.

Have '$$' in pos 1-2 and the key in pos 49 for 9 bytes and rest spaces

Once you create that dataset , concatenate it with Master file and make sure it is first in the list and use this 1 pass solution which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your created 400 byte lookup key file,DISP=SHR
//         DD DSN=your 400 byte master file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(401:8C'0',10X)),                   
  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'BH'),PUSH=(401:ID=8,410:49,9)),
  IFTHEN=(WHEN=(1,2,CH,EQ,C'$$'),OVERLAY=(410:49,9))                   
                                                                       
  SORT FIELDS=(410,9,CH,A,401,9,CH,A),EQUALS                           
                                                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(401,8,ZD,EQ,0),PUSH=(401:49,9))     
  OUTFIL BUILD=(1,400),                                               
  INCLUDE=(401,9,CH,EQ,410,9,CH,AND,1,2,CH,NE,C'$$')                   
/*
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top