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

DFSORT ..


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

New User


Joined: 13 Oct 2009
Posts: 11
Location: India

PostPosted: Thu Apr 08, 2010 12:22 pm
Reply with quote

Hi ,
Please help me out in coding this ,using DFSORT / ICETOOL.

My I/P file:

Attachment : Input
Code:
Name Addr Phone F1    F2    F3
AAA  BBB  111   Y
CCC  DDD  222         Y
EEE  FFF  333               Y
GGG  HHH  444         Y
III  JJJ  555               Y


My O/p file should be a single report file which should have:

Attachment : Output
Code:
Header : F1 =Y
Name  Addr  Phone
AAA   BBB   111
Trailer : Count =1
Header : F2 =Y
Name  Addr   Phone
CCC   DDD    222
GGG   HHH    444
Trailer : Count =2
Header : F3 =Y
Name  Addr   Phone
EEE   FFF    333
III   JJJ    555
Trailer : Count =2

Attachments imbedded and deleted.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Apr 08, 2010 12:45 pm
Reply with quote

Please DO NOT use attachments as not everyone can open, or choose to open them.

This limits the number of people available to help you.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 08, 2010 1:32 pm
Reply with quote

Input:
Field names are

Name Addr Phone F1 F2 F3
Data in the file is
Code:

AAA   BBB   111   Y      
CCC   DDD   222       Y   
EEE   FFF   333         Y
GGG   HHH   444      Y   
III   JJJ   555         Y


Output:
Code:

Header : F1 =Y
   
Name    Addr    Phone
      
AAA   BBB   111
      
Trailer : Count =1   
      

Code:

Header : F2 =Y
   

Name    Addr    Phone
      
CCC   DDD   222
GGG   HHH   444
      
Trailer : Count =2   
   
   

Code:

Header : F3 =Y
   
Name    Addr    Phone

EEE   FFF   333
III   JJJ   555
      
Trailer : Count =2   

Your input and required output is as above...
What is lrecl and recfm of the files?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 08, 2010 1:51 pm
Reply with quote

Change the fields positions(positions of Y or values at header) if required.
Code:

//S1    EXEC  PGM=SORT                                   
//SORTIN DD *                                           
AAA   BBB   111   Y                                     
CCC   DDD   222     Y                                   
EEE   FFF   333       Y                                 
GGG   HHH   444     Y                                   
III   JJJ   555       Y                                 
//F1      DD SYSOUT=*                                   
//F2      DD SYSOUT=*                                   
//F3      DD SYSOUT=*                                   
//SYSOUT    DD  SYSOUT=*                                 
//SYSIN    DD  *                                         
  SORT FIELDS=COPY                                       
  OUTFIL FNAMES=F1,REMOVECC,INCLUDE=(19,1,CH,EQ,C'Y'),   
  BUILD=(1,15,80:X),                                     
  HEADER1=('HEADER : F1 =Y',/,'NAME    ADDR    PHONE'), 
  TRAILER1=('TRAILER : COUNT =',COUNT=(M11,LENGTH=6))   
  OUTFIL FNAMES=F2,REMOVECC,INCLUDE=(21,1,CH,EQ,C'Y'),
  BUILD=(1,15,80:X),                                   
  HEADER1=('HEADER : F2 =Y',/,'NAME    ADDR    PHONE'),
  TRAILER1=('TRAILER : COUNT =',COUNT=(M11,LENGTH=6)) 
  OUTFIL FNAMES=F3,REMOVECC,INCLUDE=(23,1,CH,EQ,C'Y'),
  BUILD=(1,15,80:X),                                   
  HEADER1=('HEADER : F3 =Y',/,'NAME    ADDR    PHONE'),
  TRAILER1=('TRAILER : COUNT =',COUNT=(M11,LENGTH=6)) 
/*
Back to top
View user's profile Send private message
Valli Vaithilingam

New User


Joined: 13 Oct 2009
Posts: 11
Location: India

PostPosted: Thu Apr 08, 2010 2:13 pm
Reply with quote

@ Expat : Going forward , I shall avoid using attachments.

@ Sambhaji : Thanks . But my o/p file should be a single report file not 3 different files .
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 08, 2010 2:39 pm
Reply with quote

Valli Vaithilingam wrote:
@ Sambhaji : Thanks . But my o/p file should be a single report file not 3 different files .

Use below sort step

Code:

//S1    EXEC  PGM=SORT                                       
//SORTIN DD *                                                 
AAA   BBB   111   Y                                           
CCC   DDD   222     Y                                         
EEE   FFF   333       Y                                       
GGG   HHH   444     Y                                         
III   JJJ   555       Y                                       
//SORTOUT DD SYSOUT=*                                         
//SYSOUT    DD  SYSOUT=*                                     
//SYSIN    DD  *                                             
  SORT FIELDS=(81,1,CH,A)                                     
  INREC IFTHEN=(WHEN=(19,1,CH,EQ,C'Y'),OVERLAY=(81:C'1')),   
        IFTHEN=(WHEN=(21,1,CH,EQ,C'Y'),OVERLAY=(81:C'2')),   
        IFTHEN=(WHEN=(23,1,CH,EQ,C'Y'),OVERLAY=(81:C'3'))     
  OUTFIL REMOVECC,SECTIONS=(81,1,                             
  HEADER3=('HEADER : F',81,1,' =Y',/,'NAME    ADDR    PHONE'),
  TRAILER3=('TRAILER : COUNT =',COUNT=(M11,LENGTH=6))),       
  BUILD=(1,15,80:X)                                           
Back to top
View user's profile Send private message
Valli Vaithilingam

New User


Joined: 13 Oct 2009
Posts: 11
Location: India

PostPosted: Thu Apr 08, 2010 3:55 pm
Reply with quote

Thanks a lot , Sambhaji .

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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top