MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT/ICETOOL to identify Parent for a child

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Upendra
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 1

PostPosted: Wed Jun 22, 2016 1:47 am    Post subject: DFSORT/ICETOOL to identify Parent for a child Reply with quote

Hi,
My Input file layout is mentioned as below (col 1-3+col 4-5 is Key).
Code:

KODZENIZGZQZRZPZFTETGTKTL
KODZFNIZEZGZQZRZPTETG
KODZGNIZEZQZRZPZFTETGTKTL
KODZINIZEZGZQZP
KODZNNIZQ
KODEHNIEIZAZBZCZDZEZFZGZPZQZR
KODXRNIXQ

Where,
Col 1-3 --> Prog Sol Code
Col 4-5 --> Sub Prog Sol Code (parent) which can be transferred to sub prog sol code (child) represented by col 6-7, 8-9, 10-11 and so on (can occurs up to 100 times)

Now I have to determine for a sub prog sol codes (child), what could be the sub prog sol code (Parent) from which it can be transferred?
Like if we refer the above mentioned data:

Sub prog sol ZG (child) can be transferred from ZE, ZF, ZI, EH
& Sub prog sol ZF (child) can be transferred from ZE, ZG, EH
So I want my output as below
Code:

KODZG ZE,ZF,ZI,EH
KODZF ZE,ZG,EH

I am new to mainframe system. Could it be done in dfsort/icetool or in Cobol? Please help me out.

Thanks,
_________________
Upendra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Jun 22, 2016 10:53 am    Post subject: Reply with quote

Upendra,

The first rule of mvsforums is: You do not post the same question in multiple forums. The second rule of mvsforums: You do not post the same question in multiple forums.

Upendra wrote:
Now I have to determine for a sub prog sol codes (child), what could be the sub prog sol code (Parent) from which it can be transferred?


How do you determine the parent? Is that the first record in the input? ie. Does the child record come after the parent?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Upendra
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 1

PostPosted: Wed Jun 22, 2016 12:35 pm    Post subject: Reply with quote

Hi Kolusu,

I apologies for posting this question in multiple forum. I posted for the first time in this forum, so inadvertently committed this mistake.

Sorry for creating confusion by naming parent and child.

My question was:
In the input file, column 4-5 represent Sub Prog Sol Code (ZE for the first record) which can be transferred to NI, ZG, ZQ and so on (represented by col 6-7, 8-9, 10-11 and so on respectively
Similarly in 2nd record Sub Prog Sol Code ZF can be transferred to NI, ZE, ZG and so on (can be transferred to 100 sub prod sol code for some record)?

Now I want to identify what all sub prod sol code (represented from col 6-7 on wards) can be transferred from sub prod sol code (represented by column 4-5) e.g if we look all the records:
'NI' Can be transferred from ZE, ZF, ZG, ZI, ZN, EH & XR
'ZG' Can be transferred from ZE, ZF, ZI & EH
'ZF' Can be transferred from ZE, ZG & EH

So my output should look like:

KODNI ZE, ZF, ZG, ZI, ZN, EH, XR
KODZG ZE, ZF, ZI, EH
KODZF ZE, ZG, EH

Thanks
_________________
Upendra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Jun 22, 2016 4:06 pm    Post subject: Reply with quote

Upendra,

Here is a JCL that would give you the desired results. I am just showing how to manage 20 codes right now. You can expand the same to 100 codes. The changes you have to make are in CTL2CNTL for OUTREC and OUTFIL. I assumed your input lrecl file to be RECFM=FB and LRECL=205. This job will NOT if your input file is a VB file.

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DISP=SHR,DSN=Your Input FB 205 LRECL file               
//RZ       DD DSN=&&RZ,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  RESIZE FROM(IN) TO(RZ) TOLEN(2) USING(CTL1)                       
  SORT FROM(RZ) USING(CTL2)                                         
//*                                                                 
//CTL1CNTL DD *                                                     
  OPTION COPY                                                       
  INREC BUILD=(C'$',1,205)                                           
  OUTFIL OMIT=(1,2,CH,EQ,C' '),IFOUTLEN=7,                           
  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'$'),PUSH=(3:2,1,15:SEQ=3)), 
  IFTHEN=(WHEN=GROUP,BEGIN=(15,3,ZD,EQ,2),PUSH=(4:1,2)),             
  IFTHEN=(WHEN=GROUP,BEGIN=(15,3,ZD,EQ,3),PUSH=(6:1,2)),             
  IFTHEN=(WHEN=(15,3,ZD,LE,3),OVERLAY=(7X))                         
//*                                               
//CTL2CNTL DD *                                                 
  OMIT COND=(1,7,CH,EQ,C' ')                                   
  SORT FIELDS=(1,2,CH,A,6,2,CH,A)                               
  OUTREC IFTHEN=(WHEN=INIT,                                     
     BUILD=(3,3,1,2,301X,6,2,C',',SEQNUM,3,ZD,RESTART=(1,2))), 
  IFTHEN=(WHEN=(310,3,ZD,EQ,001),BUILD=(1,6,007:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,002),BUILD=(1,6,010:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,003),BUILD=(1,6,013:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,004),BUILD=(1,6,016:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,005),BUILD=(1,6,019:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,006),BUILD=(1,6,022:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,007),BUILD=(1,6,025:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,008),BUILD=(1,6,028:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,009),BUILD=(1,6,031:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,010),BUILD=(1,6,034:307,3)),       
                                                               
  IFTHEN=(WHEN=(310,3,ZD,EQ,011),BUILD=(1,6,037:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,012),BUILD=(1,6,040:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,013),BUILD=(1,6,043:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,014),BUILD=(1,6,046:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,015),BUILD=(1,6,049:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,016),BUILD=(1,6,052:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,017),BUILD=(1,6,055:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,018),BUILD=(1,6,058:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,019),BUILD=(1,6,061:307,3)),       
  IFTHEN=(WHEN=(310,3,ZD,EQ,020),BUILD=(1,6,064:307,3))         
                                                               
  OUTFIL FNAMES=OUT,REMOVECC,BUILD=(306X),         
  NODETAIL,SECTIONS=(1,6,                         
  TRAILER3=(1,6,                                   
            MAX=(007,3,BI,BI,LENGTH=3),           
            MAX=(010,3,BI,BI,LENGTH=3),           
            MAX=(013,3,BI,BI,LENGTH=3),           
            MAX=(016,3,BI,BI,LENGTH=3),           
            MAX=(019,3,BI,BI,LENGTH=3),           
            MAX=(022,3,BI,BI,LENGTH=3),           
            MAX=(025,3,BI,BI,LENGTH=3),           
            MAX=(028,3,BI,BI,LENGTH=3),           
            MAX=(031,3,BI,BI,LENGTH=3),           
            MAX=(034,3,BI,BI,LENGTH=3),           
            MAX=(037,3,BI,BI,LENGTH=3),           
            MAX=(040,3,BI,BI,LENGTH=3),           
            MAX=(043,3,BI,BI,LENGTH=3),           
            MAX=(046,3,BI,BI,LENGTH=3),           
            MAX=(049,3,BI,BI,LENGTH=3),           
            MAX=(052,3,BI,BI,LENGTH=3),           
            MAX=(055,3,BI,BI,LENGTH=3),           
            MAX=(058,3,BI,BI,LENGTH=3),           
            MAX=(061,3,BI,BI,LENGTH=3),           
            MAX=(064,3,BI,BI,LENGTH=3)))           
//*


For the input you have shown in your first post, the output is as shown below

Code:

KODEI EH,                           
KODNI EH,XR,ZE,ZF,ZG,ZI,ZN,         
KODTE ZE,ZF,ZG,                     
KODTG ZE,ZF,ZG,                     
KODTK ZE,ZG,                       
KODTL ZE,ZG,                       
KODXQ XR,                           
KODZA EH,                           
KODZB EH,                           
KODZC EH,                           
KODZD EH,                           
KODZE EH,ZF,ZG,ZI,                 
KODZF EH,ZE,ZG,                     
KODZG EH,ZE,ZF,ZI,                 
KODZP EH,ZE,ZF,ZG,ZI,               
KODZQ EH,ZE,ZF,ZG,ZI,ZN,           
KODZR EH,ZE,ZF,ZG,                 

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Upendra
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 1

PostPosted: Thu Jun 23, 2016 3:22 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for the prompt reply. Its working as expected. I have a query: can we get the last ',' removed from the output records. Instead of like below:

KODEI EH,
KODNI EH,XR,ZE,ZF,ZG,ZI,ZN,
KODTE ZE,ZF,ZG,

Can we get the output like below:

KODEI EH
KODNI EH,XR,ZE,ZF,ZG,ZI,ZN
KODTE ZE,ZF,ZG

Thanks
_________________
Upendra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Jun 23, 2016 9:55 am    Post subject: Reply with quote

Upendra,

You would need another pass of data to remove the last comma.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
t-bonham@scc.net
Supermod


Joined: 18 Oct 2012
Posts: 30
Topics: 0
Location: Minneapolis, MN

PostPosted: Thu Jun 23, 2016 7:52 pm    Post subject: Reply with quote

Or a single SPF Edit command on the output file:
Code:
Change ", " "  " ALL


done either online in a Edit session or a batch step in the job.

Such an edit of the output report should be much faster than another pass of the whole input file.
Back to top
View user's profile Send private message Send e-mail AIM Address
Upendra
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 1

PostPosted: Thu Jun 23, 2016 10:46 pm    Post subject: Reply with quote

Thanks Kolusu. Its done.
_________________
Upendra
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group