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
 

 

DFSORT ..

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT ..
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: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 08, 2010 12:45 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: DFSORT ..
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    Post subject: Re: Reply to: DFSORT ..
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    Post subject:
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    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 DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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