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
 

 

seperate according to header

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

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Dec 21, 2010 11:16 am    Post subject: seperate according to header
Reply with quote

Hi All,
Please find the file below

Quote:

COMPANY
00000001ACCOUNT
00000002ACCOUNT
00000003ACCOUNT
COMPANY
00000001ACCOUNT
00000002ACCOUNT


The record which has 'COMPANY' word is header record, and the records below that are detail records. The output is needed in two files, such as the first header and its detail in one file and second header and its detail in second file.
Please help
Back to top
View user's profile Send private message

nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Tue Dec 21, 2010 1:02 pm    Post subject:
Reply with quote

Hi Sun,

Your input file will have only 2 Company record?
What is the RECFM & LRECL of your INPUT/OUTPUT file?
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Tue Dec 21, 2010 1:43 pm    Post subject:
Reply with quote

Hi Sun,

The below DFSORT JCL will give you desire output. Assumed your INPUT/OUTPUT LRECL=80 & RECFM=FB. JCL can be changed appropriately.
Code:
//STEP10   EXEC PGM=SORT                                               
//*                                                                   
//SYSOUT   DD  SYSOUT=*                                               
//*                                                                   
//SORTIN   DD *                                                       
COMPANY                                                               
00000001ACCOUNT                                                       
00000002ACCOUNT                                                       
00000003ACCOUNT                                                       
COMPANY                                                               
00000001ACCOUNT                                                       
00000002ACCOUNT                                                       
/*                                                                     
//*                                                                   
//OUT1     DD  SYSOUT=*                                               
//OUT2     DD  SYSOUT=*                                               
//*                                                                   
//SYSIN    DD  *    *** CONSTANT CONTROL CARDS ***                     
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'COMPANY'),PUSH=(81:ID=1))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)               
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)               
/*                                                                     

If this is not what you want, Show us with a better example and rules to achieve it.
Back to top
View user's profile Send private message
sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Dec 21, 2010 1:43 pm    Post subject: Hi
Reply with quote

yes, the input file will have only two company record

its a variable block file , LRECL = 1000
Back to top
View user's profile Send private message
sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Dec 21, 2010 2:13 pm    Post subject:
Reply with quote

Thanks a lot , Nelson . I appreciate your help. Its working. [/b]
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Dec 21, 2010 10:45 pm    Post subject: Re: Hi
Reply with quote

sun_job wrote:
yes, the input file will have only two company record

its a variable block file , LRECL = 1000


sun_job,

Do NOT use the same approach for VB file , appending an ID num at the end of a VB file will ruin the very basic concept of VB files. You will be making all the variable records of the same length.

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=Your input VB file,DISP=SHR
//OUT1     DD SYSOUT=*                                         
//OUT2     DD SYSOUT=*                                         
//SYSIN    DD  *                                                 
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,X,5)),                     
  IFTHEN=(WHEN=GROUP,BEGIN=(6,7,CH,EQ,C'COMPANY'),PUSH=(5:ID=1))
  OUTFIL FNAMES=OUT1,INCLUDE=(5,1,ZD,EQ,1),BUILD=(1,4,6)         
  OUTFIL FNAMES=OUT2,INCLUDE=(5,1,ZD,EQ,2),BUILD=(1,4,6)         
//*
Back to top
View user's profile Send private message
sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Thu Dec 23, 2010 3:10 pm    Post subject:
Reply with quote

Thanks a lot, Skolusu
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 Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm
No new posts GROUP - header data to be repeated in... Musab Ahmed DFSORT/ICETOOL 3 Mon Feb 01, 2016 11:36 am
No new posts Add Counts to Group Header Records Christopher Horowitz SYNCSORT 3 Sat Jul 11, 2015 1:21 am
No new posts Sort,remove & capture dup recs ha... subratarec DFSORT/ICETOOL 21 Tue Apr 28, 2015 9:28 pm
No new posts How to replace Trailer information wi... somapradeep1 DFSORT/ICETOOL 5 Tue Feb 24, 2015 1:12 pm


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