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
 

 

Need Header & detailed records in one file which have du

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

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Tue Nov 15, 2011 2:27 pm    Post subject: Need Header & detailed records in one file which have du
Reply with quote

Hi,
I have an requirement as below.

A file have multiple headers under which have multiple detailed records will be present.

If we have duplicates from column 5-8, then the corresponding header and all the corresponding detailed records needs to be written in to an output file.

If we dont have duplicates from column 5-8, then the corresponding header and all the corresponding detailed records needs to be written in to another output file.

Sample input and output files below.



Input file:

Code:
----+----1--
HEADER1     
ABCD1234   
ABCD2345   
ABCD1234   
HEADER2     
ABCD4567   
ABCD8765   
ABCD1234   
HEADER3     
ABCD4567   
ABCD8765   
ABCD4567   


Expected Output1:

Code:
HEADER1
ABCD1234
ABCD2345
ABCD1234
HEADER3   
ABCD4567 
ABCD8765 
ABCD4567 


Output2:
Code:
HEADER2
ABCD4567
ABCD8765
ABCD1234
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 Nov 16, 2011 3:01 am    Post subject:
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for. 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=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(81,8,ZD) ON(5,4,CH) FIRSTDUP USING(CTL1)
COPY JKFROM USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),
    PUSH=(81:ID=8))
  OUTFIL FNAMES=T1,BUILD=(81,8)
/*
//CTL2CNTL DD *
  JOINKEYS F1=T1,FIELDS=(1,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN,FIELDS=(81,8,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,80,?)
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)
/*
//JNF2CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),
    PUSH=(81:ID=8))
/*
Back to top
View user's profile Send private message
srajanbose
Warnings : 1

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Mon Nov 21, 2011 9:11 am    Post subject:
Reply with quote

Thanks Frank.Its working fine.
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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