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
 

 

select detail records based on a check on header record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: select detail records based on a check on header record
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 Moderator


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

PostPosted: Wed May 27, 2009 3:02 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: select detail records based on a check on header r
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    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 Card to Remove Duplicate records... raj4neo SYNCSORT 0 Wed Jan 25, 2017 4:44 am
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am


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