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

seperate according to header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
No new posts Adding a header when change data DFSORT/ICETOOL 6
No new posts Insert System Runtime in HEADER In SY... SYNCSORT 9
No new posts Create Header Dtae as MMDDYYYY DFSORT/ICETOOL 16
Search our Forums:

Back to Top