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

extract subordinate values through DFSORT.


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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue May 22, 2012 3:17 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 22, 2012 3:19 pm
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: 152

PostPosted: Tue May 22, 2012 3:49 pm
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: 152

PostPosted: Tue May 22, 2012 3:57 pm
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: 6966
Location: porcelain throne

PostPosted: Tue May 22, 2012 4:28 pm
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
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: 6966
Location: porcelain throne

PostPosted: Wed May 23, 2012 3:20 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top