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
 

 

extract subordinate values through DFSORT.

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

Active User


Joined: 05 Oct 2006
Posts: 144

PostPosted: Tue May 22, 2012 3:17 pm    Post subject: extract subordinate values through DFSORT.
Reply with quote

HI,

i have subgroup F,G, AND H and their subordinate values are as below.

F--F
F1
F11
F111
F111A

G--G
G1
G11
G111
G111A

H-H
H1
H11
H111
H111A


i have two files.

file1 is as below

01 INREC.
05 QTY PIC 9(2)

say example:

in file1

Code:
F   
G1   
H11 



in file 2 is as below
Code:
F   
F1   
F11 
F111A
G   
G1   
G11 
G111A
H   
H1   
H11 
H111A


my final output shoul include all the matching record from the file1 and subordinate value after that.

Code:
F   
F1   
F11 
F111A
G1   
G11 
G111A
H11 
H111A
please help me in this regard

Regds,
useit
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue May 22, 2012 3:19 pm    Post subject: Reply to: extract subordinate values through DFSORT.
Reply with quote

What is the significance, if any, of only one "dash" in between the H's?

How does your Cobol record-layout relate to any of this?

EDIT: Whilst at it, what are RECFM/LRECL of files? What is the maximum-length field for selection you can have on file 1?
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 144

PostPosted: Tue May 22, 2012 3:49 pm    Post subject:
Reply with quote

sorry, the record length was mentioned wrongly.

input file1 and file2 has record length =5.(recfm=fb)

01 inrec.

05 subgrp pic x(05).

maximum lenght field wqe can have on file1 is 5

Regds,
useit
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 144

PostPosted: Tue May 22, 2012 3:57 pm    Post subject:
Reply with quote

say for example.

1)

File1:

Code:
F

FILE2:

Code:
F
F1
F11
F111
F111A


MY OUTPUT WILL BE


Code:
F
F1
F11
F111
F111A
2)IF FILE 1 HAS

Code:
F1


MY OUTPUT WILL BE

Code:
F1
F11
F111
F111A

3)IF FILE 1 HAS

Code:
F11


OUTPUT WILL BE

Code:
F11
F111
F111A

4):IF FILE 1 HAS

Code:
F111

MY OUTPUT WILL BE

Code:
F111
F111A


5):IF FILE 1 HAS

Code:
F111A

MY OUTPUT WILL BE

Code:
F111A

Regds,
useit
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue May 22, 2012 4:28 pm    Post subject:
Reply with quote

inrec change all file2 to 7 bytes.
you want to joinkeys,
reformat hits to add "H" to byte 6 of file 2
keep all of file f2,

pass the output of above,
inrec:
when byte 6 = 'H",push byte 1 to byte 7
outrec/outfile:
include byte 1 = byte 7
reformat to 5 bytes.

using:
file 1
Code:
F   
G1   
H11


file 2
Code:
F   
F1   
F11
F111A
G   
G1   
G11
G111A
H   
H1   
H11
H111A


output of joinkeys:
Code:
F    H
F1   
F11
F111A
G   
G1   H
G11
G111A
H   
H1   
H11  H
H111A


INREC:
Code:
F    HF
F1    F   
F11   F
F111A F
G     F   
G1   HG
G11   G
G111A G
H     G
H1    G
H11  HH
H111A H


OUTREC/OUTFILE
Code:
F   
F1     
F11   
F111A
G1   
G11
G111A
H11
H111A
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 23, 2012 3:00 am    Post subject:
Reply with quote

The best option is to generate INCLUDE COND with SS format from file 1 and use those cards to extract the values.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
F                                                         
G1                                                       
H11                                                       
//SORTOUT  DD DSN=&&C,DISP=(,PASS),SPACE=(CYL,(2,2),RLSE)
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  OUTFIL REMOVECC,                                       
  HEADER1=(3:'OPTION COPY',/,                             
           3:'INCLUDE COND=(1,01,CH,NE,1,1,CH,OR,'),     
  BUILD=(17:1,8,SQZ=(SHIFT=LEFT,LEAD=C'1,10,SS,EQ,C''',   
              TRAIL=C''',OR,',LENGTH=65)),               
  TRAILER1=(17:'1,01,CH,NE,1,1,CH)')                     
//*


This will create the Control cards as
Code:

OPTION COPY                           
INCLUDE COND=(1,01,CH,NE,1,1,CH,OR,   
              1,10,SS,EQ,C'F',OR,     
              1,10,SS,EQ,C'G1',OR,     
              1,10,SS,EQ,C'H11',OR,   
              1,01,CH,NE,1,1,CH)       


Now we will use the above generated control cards to extract the desired records
Code:

//STEP0200 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                 
F                               
F1                               
F11                             
F111A                           
G                               
G1                               
G11                             
G111A                           
H                               
H1                               
H11                             
H111A                           
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD DSN=&&C,DISP=SHR   


This will produce the following output
Code:

F       
F1     
F11     
F111A   
G1     
G11     
G111A   
H11     
H111A   
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed May 23, 2012 3:20 am    Post subject:
Reply with quote

Simple and eloquent.
decide what to look for
build the required INCLUDEs
let er rip.
LEAD and TRAIL for the BUILD parameter are rather powerful.
between those two and SS,
you have reference modification in DFSORT. (Sorry..)

thx kolusu.
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 What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm


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